Draft
Fix V1 (spike-detection-only) burst analysis: load spike_times.npy when sorting is unavailable#170
Conversation
…entation and load spike_times.npy when self.sorting is None Agent-Logs-Url: https://github.com/roybens/MEA_Analysis/sessions/c62d626f-541c-4707-b60b-95aa7c72cc78 Co-authored-by: mandarmp <33731455+mandarmp@users.noreply.github.com>
…d path Agent-Logs-Url: https://github.com/roybens/MEA_Analysis/sessions/c62d626f-541c-4707-b60b-95aa7c72cc78 Co-authored-by: mandarmp <33731455+mandarmp@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix burst analysis failing with no spike times found
Fix V1 (spike-detection-only) burst analysis: load spike_times.npy when sorting is unavailable
Apr 28, 2026
e8da8c9 to
f19b58c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running in spike-detection-only mode (
skip_spikesorting=True), burst analysis always failed with "No spike times found" despite spikes being detected and saved to disk.Root cause
_spike_detection_only()saves spike times tospike_times.npybut never setsself.sorting._run_burst_analysis()gated all spike time loading behindif self.sorting:, so theelsebranch immediately returned an error — the saved file was never consulted.A secondary issue: the function body was indented at 12 spaces instead of 8, and the
exceptblock was at a mismatched level, causing anIndentationErrorthat made the entire module unparseable.Changes
_run_burst_analysisbody to 8-space indent;try/exceptnow properly paired at the same levelself.sortingisNone— theelsebranch now loads from the file written by_spike_detection_only, filters byids_listif provided, and emits distinct error messages for each failure mode (file missing / file empty / empty after filtering):