Skip to content

Commit 93ea01a

Browse files
Thinh Nguyendimitri-yatsenko
andauthored
Update elements_ephys/readers/spikeglx.py
Co-authored-by: Dimitri Yatsenko <dimitri@vathes.com>
1 parent d656108 commit 93ea01a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

elements_ephys/readers/spikeglx.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,13 @@ def get_original_chans(self):
297297
# output = int32, 0 to nSavedChans - 1
298298
channels = np.arange(0, int(self.meta['nSavedChans']))
299299
else:
300-
# parse the snsSaveChanSubset string
301-
channels = np.arange(0, 0) # creates an empty array of int32
302-
for sL in self.meta['snsSaveChanSubset'].split(sep = ','): # split at commas
303-
current_list = sL.split(sep = ':')
304-
# each set of continuous channels specified by chan1:chan2 inclusive
305-
new_channels = np.arange(int(current_list[0]), int(current_list[min(1, len(current_list) - 1)]) + 1)
306-
channels = np.append(channels, new_channels)
300+
# parse the channel list self.meta['snsSaveChanSubset']
301+
channels = np.arange(0) # empty array
302+
for channel_range in self.meta['snsSaveChanSubset'].split(','):
303+
# a block of contiguous channels specified as chan or chan1:chan2 inclusive
304+
ix = [int(r) for r in channel_range.split(':')]
305+
assert len(ix) in (1, 2), f"Invalid channel range spec '{channel_range}'"
306+
channels = np.append(np.r_[ix[0]:ix[-1] + 1])
307307
return channels
308308

309309

0 commit comments

Comments
 (0)