Skip to content

Fix unit presence time axis binning - #5014

Open
Fireguy1 wants to merge 2 commits into
SpikeInterface:mainfrom
Fireguy1:fix-unit-presence-time-axis
Open

Fireguy1 wants to merge 2 commits into
SpikeInterface:mainfrom
Fireguy1:fix-unit-presence-time-axis

Conversation

@Fireguy1

@Fireguy1 Fireguy1 commented Dec 6, 2026

Copy link
Copy Markdown

Summary

Fixes #5006.

This PR fixes two issues in UnitPresenceWidget:

  • Corrects the X-axis extent when time_range=None, so the axis displays time in seconds instead of bin indices.
  • Uses a consistent bin width in samples when calculating the number of time bins and spike bin indices, preventing an IndexError at certain sampling frequencies.

Testing

Added a regression test covering:

  • 10-second recording at 30,000 Hz.
  • 60-second recording at 24,414.0625 Hz.

Tested with:

python -m pytest src/spikeinterface/widgets/tests/test_widgets.py::TestWidgets::test_plot_unit_presence_time_axis -v

Result: 1 passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plot_unit_presence shows bin indices on the Time (s) axis when time_range is not given

1 participant