Skip to content

Fix ISI histogram bins for constant intervals - #656

Merged
gviejo merged 1 commit into
pynapple-org:devfrom
viranovskaya:fix/isi-constant-intervals
Sep 16, 2026
Merged

gviejo merged 1 commit into
pynapple-org:devfrom
viranovskaya:fix/isi-constant-intervals

Conversation

@viranovskaya

Copy link
Copy Markdown

I traced the intermittent ISI test failure in #640 to the existing bin-edge calculation. When all intervals are equal, linspace(min_isi, max_isi, bins + 1) produces repeated edges. This puts every observation in the last bin and gives duplicate output indices.

This uses np.histogram_bin_edges for integer bins, matching NumPy's handling of a constant range while retaining shared edges for a TsGroup. Explicit bin edges are unchanged.

The regression tests cover a single interval and repeated equal intervals across Ts, Tsd, TsdFrame, TsdTensor and TsGroup, with linear and log scales. The grouped test reference now uses NumPy's histogram edges too.

Checked locally on current dev: 5,390 unit tests passed, 274 skipped; Black, isort and flake8 passed. The failing implementation was identical in the base and head of #640, so I have kept this fix separate from that feature.

@gviejo

gviejo commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Merging it. Thanks @viranovskaya

@gviejo
gviejo merged commit 8152648 into pynapple-org:dev Sep 16, 2026
17 checks 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.

2 participants