-
Notifications
You must be signed in to change notification settings - Fork 0
Merge main into restricted_window_match development #71
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
Conversation
* Use robust std estimate for hit threshold calculation Replaces standard deviation with a robust estimate based on the central 68% (16th-84th percentiles) of the signal distribution when calculating the hit threshold. This change makes the threshold calculation more resistant to extreme values. * Version bump * Fix hit length calculation in DxHits plugin Updated the calculation of 'hit["length"]' to use the number of samples in the record (right_i - left_i) instead of the waveform array size (target_end - target_start), ensuring consistency when endtime is clamped to record boundaries. * Use exact dt for endtime calculations in plugins Updated endtime calculations in QUALIPHIDETHzReader and NX3LikeReader to use the more precise dt_exact value instead of the integer-cast dt. Also clarified the calculation of hit length in DxHits for consistency. * Revert changes on online readout plugin
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.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on February 16
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| results = self.chunk( | ||
| start=np.min(results["time"]), | ||
| end=np.max(results["time"]) + self.dt * self.config["record_length"], | ||
| end=np.max(results["time"]) + np.int64(self.dt * self.config["record_length"]), |
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.
Inconsistent use of dt vs dt_exact in chunk end
In NX3LikeReader.compute(), the chunk's end time at line 555 uses self.dt (integer, truncated), but the record's endtime at line 543 uses self.dt_exact (float, precise). This inconsistency was introduced when updating timing precision - QUALIPHIDETHzReader at line 168 was correctly updated to use dt_exact for the chunk end, but NX3LikeReader was not. For certain sampling frequencies (e.g., 38kHz), the truncation error accumulates over long records, causing the chunk boundary to not align with the actual record end time by potentially seconds.
Additional Locations (1)
* Add match_window_ms option to Match plugin Introduces a configurable time window (match_window_ms) around waveform maxima for matching hits and truth events in the Match plugin. Updates the plugin to restrict matching to this window if set, adds related configuration for sampling frequency, and provides a test to verify the new option's behavior. * Hit threshold by percentile (#70) (#71) * Use robust std estimate for hit threshold calculation Replaces standard deviation with a robust estimate based on the central 68% (16th-84th percentiles) of the signal distribution when calculating the hit threshold. This change makes the threshold calculation more resistant to extreme values. * Version bump * Fix hit length calculation in DxHits plugin Updated the calculation of 'hit["length"]' to use the number of samples in the record (right_i - left_i) instead of the waveform array size (target_end - target_start), ensuring consistency when endtime is clamped to record boundaries. * Use exact dt for endtime calculations in plugins Updated endtime calculations in QUALIPHIDETHzReader and NX3LikeReader to use the more precise dt_exact value instead of the integer-cast dt. Also clarified the calculation of hit length in DxHits for consistency. * Revert changes on online readout plugin * Fix chunk end time calculation in NX3LikeReader Replaces use of self.dt with self.dt_exact when calculating the chunk end time to ensure more accurate timing based on the exact data type. * Improve endtime consistency check in tests Enhanced the _check_endtime_consistency function to use the sampling frequency (fs) for more accurate endtime calculation when available, with a fallback to dt and a tolerance for rounding errors. Updated test_records_data_consistency to pass fs from the context config. * Set timeout for pytest workflow job Added a 60-minute timeout to the test job in the GitHub Actions pytest workflow to prevent jobs from running indefinitely. * Fix endtime calculation in test cases using dt_exact Updated endtime consistency checks in test_baseline_monitor.py and test_records.py to use dt_exact calculated from sampling frequency (fs) and SECOND_TO_NANOSECOND, ensuring accurate endtime computation in tests. * A little bit more debug info * Add template interpolation support to Match plugin Introduces a new config option for specifying the template interpolation file path and updates the Match plugin to use an interpolated template for accurate pulse maximum alignment. The calculation of the pulse template argmax is now based on the interpolated template, improving matching precision for different sampling frequencies. * Bump Match plugin version to 0.0.4 Updated the __version__ attribute of the Match plugin from 0.0.3 to 0.0.4. * Improve hit max time calculation in match plugin Replaces the previous approximation of hit maximum times with a calculation that finds the actual maximum position in each hit's waveform, accounting for waveform padding. This increases the accuracy of hit timing in the plugin. * Update match.py * Add .cursorrules with conda environment guidelines Introduces a .cursorrules file outlining mandatory usage of the 'straxion' conda environment for all Python commands and scripts. Provides examples and rationale to prevent dependency issues. * Add tests for Match._restrict_to_maximum_window method Introduces a new TestMatchRestrictWindow class with comprehensive unit tests for the _restrict_to_maximum_window method in the Match plugin. Tests cover window restriction logic for both hits and truth data, including cases with and without waveform padding, boundary conditions, and behavior with different sampling frequencies.
Note
DxHits): Use robust std estimate from the 16th–84th percentiles forcalculate_hit_threshold; update hitlengthto the sample span (right_i - left_i); bump__version__to0.0.3.endtimewith exactdt(dt_exact) and cast toint64in bothQUALIPHIDETHzReader.computeandNX3LikeReader.compute; adjust chunkendcalculations accordingly.Written by Cursor Bugbot for commit 0a89bc9. This will update automatically on new commits. Configure here.