Skip to content

Commit

Permalink
fix preprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Dec 17, 2024
1 parent 61f4018 commit 0429152
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/spikeinterface/preprocessing/tests/test_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def test_clip():
rec1 = clip(rec, a_min=-1.5)
rec1.save(verbose=False)

traces0 = rec0.get_traces(segment_index=0, channel_ids=[1])
traces0 = rec0.get_traces(segment_index=0, channel_ids=["1"])
assert traces0.shape[1] == 1

assert np.all(-2 <= traces0[0] <= 3)

traces1 = rec1.get_traces(segment_index=0, channel_ids=[0, 1])
traces1 = rec1.get_traces(segment_index=0, channel_ids=["0", "1"])
assert traces1.shape[1] == 2

assert np.all(-1.5 <= traces1[1])
Expand All @@ -34,11 +34,11 @@ def test_blank_staturation():
rec1 = blank_staturation(rec, quantile_threshold=0.01, direction="both", chunk_size=10000)
rec1.save(verbose=False)

traces0 = rec0.get_traces(segment_index=0, channel_ids=[1])
traces0 = rec0.get_traces(segment_index=0, channel_ids=["1"])
assert traces0.shape[1] == 1
assert np.all(traces0 < 3.0)

traces1 = rec1.get_traces(segment_index=0, channel_ids=[0])
traces1 = rec1.get_traces(segment_index=0, channel_ids=["0"])
assert traces1.shape[1] == 1
# use a smaller value to be sure
a_min = rec1._recording_segments[0].a_min
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ def test_output_values():
expected_weights = np.r_[np.tile(np.exp(-2), 3), np.exp(-4)]
expected_weights /= np.sum(expected_weights)

si_interpolated_recording = spre.interpolate_bad_channels(recording, bad_channel_indexes, sigma_um=1, p=1)
si_interpolated_recording = spre.interpolate_bad_channels(
recording, bad_channel_ids=bad_channel_ids, sigma_um=1, p=1
)
si_interpolated = si_interpolated_recording.get_traces()

expected_ts = si_interpolated[:, 1:] @ expected_weights
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_normalize_by_quantile():
rec2 = normalize_by_quantile(rec, mode="by_channel")
rec2.save(verbose=False)

traces = rec2.get_traces(segment_index=0, channel_ids=[1])
traces = rec2.get_traces(segment_index=0, channel_ids=["1"])
assert traces.shape[1] == 1

rec2 = normalize_by_quantile(rec, mode="pool_channel")
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/preprocessing/tests/test_rectify.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_rectify():
rec2 = rectify(rec)
rec2.save(verbose=False)

traces = rec2.get_traces(segment_index=0, channel_ids=[1])
traces = rec2.get_traces(segment_index=0, channel_ids=["1"])
assert traces.shape[1] == 1

# import matplotlib.pyplot as plt
Expand Down

0 comments on commit 0429152

Please sign in to comment.