Skip to content

Commit b92e074

Browse files
authored
Merge pull request #3631 from cwindolf/avg_chans_bug use
Fix channels bug in average_across_direction, and add a test
2 parents cabe66e + dafed80 commit b92e074

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/spikeinterface/preprocessing/average_across_direction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def get_traces(self, start_frame, end_frame, channel_indices):
132132
# now, divide by the number of channels at that position
133133
traces /= self.n_chans_each_pos
134134

135-
return traces
135+
return traces[:, channel_indices]
136136

137137

138138
# function for API

src/spikeinterface/preprocessing/tests/test_average_across_direction.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ def test_average_across_direction():
3737
assert np.all(geom_avgy[:2, 0] == 0)
3838
assert np.all(geom_avgy[2, 0] == 1.5)
3939

40+
# test with channel ids
41+
# use chans at y in (1, 2)
42+
traces = rec_avgy.get_traces(channel_ids=["0-1", "2-3"])
43+
assert traces.shape == (100, 2)
44+
assert np.all(traces[:, 0] == 0.5)
45+
assert np.all(traces[:, 1] == 2.5)
46+
4047
# test averaging across x
4148
rec_avgx = average_across_direction(rec, direction="x")
4249
traces = rec_avgx.get_traces()

0 commit comments

Comments
 (0)