-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New waveform analysis class to interpolate waveforms using tapered sinc kernel #208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Yashwanth, thanks again for the updated PR. I've left some comments on general code restructuring. In general, this looks good!
I've mentioned in one of the comments, but it would be great if there's a writeup detailing the math being done here for users in the future.
Thanks again!
Thanks for the comments, James! I will work on these. |
Hey @JamesJieranShen, I have updated the code. I am able to run it without any errors. Please let me know if I have to change anything or include any comments, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
static int fNumInterpPoints; // number of interpolated points per data point (or the number of points in each lobe of | ||
// the tsinc kernel) | ||
static double fTaperingConst; // tapering constant (determines how fast the kernel decays) | ||
static int fNumSincLobes; // number of sinc lobes to be included in the kernel (determines the length of the kernel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these values kept static? There's no reason for them to be since they can be individually configured for each instance of the processor.
double fFitPeak; | ||
|
||
static std::vector<double> tsinc_kernel; // Stores the tsinc kernel | ||
static void calculateTSincKernel() { // Calculates the tsinc kernel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsinc_kernel
should not be kept static, same reason as above. If you would like to have the method be kept static, return the computed kernel.
Also, tsinc_kernel should probably be a std::array
as they are more performant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey James, thanks for the comments! I have changed the code to not keep the kernel and the other variables as static.
The size of the kernel is determined by the inputs from the ratdb table (num_interp_points
and num_sinc_lobes
). That's why I chose std::vector
over std::array
. Is there a better way to do this with std::array
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.. no need to worry about array vs vector here then. My mistake.
Thanks @YashBezawada -- we will probably be interested in adding some tests for this fitter. But that could be a separate PR. |
Added a new WaveformAnalysisSinc class (based on the existing WaveformAnalysis class and the WaveformAnalysisLognormal class) to interpolate waveforms using tapered sinc kernel.