Skip to content

Replace int() truncation with shared ms_to_samples() #4484

Merged
alejoe91 merged 1 commit intoSpikeInterface:mainfrom
Antorhythms:fix-int-truncation
Apr 2, 2026
Merged

Replace int() truncation with shared ms_to_samples() #4484
alejoe91 merged 1 commit intoSpikeInterface:mainfrom
Antorhythms:fix-int-truncation

Conversation

@Antorhythms
Copy link
Copy Markdown
Contributor

Utility for waveform/template sample count conversions. Adds ms_to_samples() to core_tools.py using round() instead of int() to prevent ±1 sampleinconsistencies across datasets with nearly identical sampling rates (e.g. 29999 vs 30000 Hz). Tried to spot int truncation behavior in the codebase with AI and adopted new util across 21 production files and 5 test files for all waveform/template window geometry; non-waveform conversions (margins, exclusion zones, refractory periods) left unchanged.

Fixes issue #4474

…form/template sample count conversions. Adds ms_to_samples() to core_tools.py using round() instead of int() to prevent ±1 sampleinconsistencies across datasets with nearly identical sampling rates (e.g. 29999 vs 30000 Hz). Adopted across 21 production files and 5 test files for all waveform/template window geometry; non-waveform conversions (margins, exclusion zones, refractory periods) left unchanged.
@alejoe91 alejoe91 added the core Changes to core module label Apr 1, 2026
@samuelgarcia
Copy link
Copy Markdown
Member

merci

@alejoe91 alejoe91 merged commit 4f3c04e into SpikeInterface:main Apr 2, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants