Skip to content
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

Merged
merged 7 commits into from
Jan 21, 2025

Conversation

YashBezawada
Copy link
Contributor

Added a new WaveformAnalysisSinc class (based on the existing WaveformAnalysis class and the WaveformAnalysisLognormal class) to interpolate waveforms using tapered sinc kernel.

Copy link
Contributor

@JamesJieranShen JamesJieranShen left a 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!

src/daq/src/WaveformAnalysisSinc.cc Outdated Show resolved Hide resolved
src/daq/src/WaveformAnalysisSinc.cc Outdated Show resolved Hide resolved
src/daq/src/WaveformAnalysisSinc.cc Outdated Show resolved Hide resolved
src/daq/src/WaveformAnalysisSinc.cc Show resolved Hide resolved
src/daq/src/WaveformAnalysisSinc.cc Outdated Show resolved Hide resolved
@YashBezawada
Copy link
Contributor Author

Thanks for the comments, James! I will work on these.

@YashBezawada
Copy link
Contributor Author

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.

Copy link
Contributor

@JamesJieranShen JamesJieranShen left a 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)
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

src/daq/src/WaveformAnalysisSinc.cc Show resolved Hide resolved
@JamesJieranShen
Copy link
Contributor

Thanks @YashBezawada -- we will probably be interested in adding some tests for this fitter. But that could be a separate PR.

@tannerbk tannerbk merged commit 528e299 into rat-pac:main Jan 21, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants