Skip to content

Commit

Permalink
Add test to check correct order of spikes with borders
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 committed Sep 22, 2023
1 parent 73ceaac commit b9b6c15
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/spikeinterface/core/tests/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ def test_generate_sorting_with_spikes_on_borders():
num_spikes_per_border=num_spikes_on_borders,
border_size_samples=border_size_samples,
)
# check that segments are correctly sorted
all_spikes = sorting.to_spike_vector()
np.testing.assert_array_equal(all_spikes["segment_index"], np.sort(all_spikes["segment_index"]))

spikes = sorting.to_spike_vector(concatenated=False)
# at least num_border spikes at borders for all segments
for i, spikes_in_segment in enumerate(spikes):
for spikes_in_segment in spikes:
# check that sample indices are correctly sorted within segments
np.testing.assert_array_equal(spikes_in_segment["sample_index"], np.sort(spikes_in_segment["sample_index"]))
num_samples = int(segment_duration * 30000)
assert np.sum(spikes_in_segment["sample_index"] < border_size_samples) >= num_spikes_on_borders
assert (
Expand Down

0 comments on commit b9b6c15

Please sign in to comment.