Skip to content

Return unit-aware empty spike-triggered phase results - #731

Open
Kulraj69 wants to merge 5 commits into
NeuralEnsemble:masterfrom
Kulraj69:fix-empty-spike-triggered-phase
Open

Kulraj69 wants to merge 5 commits into
NeuralEnsemble:masterfrom
Kulraj69:fix-empty-spike-triggered-phase

Conversation

@Kulraj69

Copy link
Copy Markdown

spike_triggered_phase accepts a SpikeTrain and ignores spikes outside the Hilbert signal interval. If the train is empty or has no overlapping spikes, result conversion reads entry[0].units on an empty list and raises IndexError.

Take amplitude units from the owning Hilbert signal and time units from the owning SpikeTrain instead. Empty outputs then retain their correct units. Phase, interpolation and index-selection math are unchanged.

Two new regression methods cover six cases: empty and out-of-interval trains with interpolation on/off, plus shared/paired signals with mixed populated and empty trials and different units. Original runtime raises IndexError in all six cases. On a fresh isolated snapshot at 86add3b5eb10a74bcedd7c298691db433f33e0dc, this patch passes 21 selected offline methods across SpikeTriggeredPhaseTestCase, MeanVectorTestCase, PhaseDifferenceTestCase, and PhaseLockingValueTestCase. All 189 unchanged files were Git-blob verified. The third changed file adds my name to the author list.

WeightedPhaseLagIndexTestCase was not run because its class setup downloads three unrelated external fixtures. A pre-existing E127 style finding outside the changed lines remains. Full-project CI, other platforms, independent QA and real-neural-data validation are not claimed.

Linux CPython 3.10.12, NumPy 2.2.6, SciPy 1.15.3, Neo 0.14.6, Quantities 0.16.4. Prepared and tested with AI assistance. Independent of the spectral normalization, SNR, zscore and wavelet candidates.

Kulraj69 and others added 5 commits November 20, 2026 14:01
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

1 participant