Skip to content

Commit 60e320d

Browse files
author
Thinh Nguyen
committed
bugfix in waveform extraction
1 parent be82f4e commit 60e320d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

elements_ephys/readers/openephys.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ def extract_spike_waveforms(self, spikes, channel, n_wf=500, wf_win=(-32, 32)):
153153
:param wf_win: number of sample pre and post a spike
154154
:return: waveforms (sample x channel x spike)
155155
"""
156-
data = self.ap_data.T # (sample x channel)
157156
channel_ind = [np.where(self.ap_meta['channels_ids'] == chn)[0][0] for chn in channel]
158157

159158
# ignore spikes at the beginning or end of raw data
@@ -166,7 +165,7 @@ def extract_spike_waveforms(self, spikes, channel, n_wf=500, wf_win=(-32, 32)):
166165
if len(spikes) > 0:
167166
spike_indices = np.searchsorted(self.ap_timestamps, spikes, side="left")
168167
# waveform at each spike: (sample x channel x spike)
169-
spike_wfs = np.dstack([data[int(spk + wf_win[0]):int(spk + wf_win[-1]), channel_ind]
168+
spike_wfs = np.dstack([self.ap_data[int(spk + wf_win[0]):int(spk + wf_win[-1]), channel_ind]
170169
for spk in spike_indices])
171170
return spike_wfs
172171
else: # if no spike found, return NaN of size (sample x channel x 1)

0 commit comments

Comments
 (0)