Skip to content

Commit 9c487f5

Browse files
committed
allow to only memmap one stream
1 parent 2731729 commit 9c487f5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

neo/rawio/tdtrawio.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
class TdtRawIO(BaseRawIO):
3737
rawmode = 'one-dir'
3838

39-
def __init__(self, dirname='', sortname=''):
39+
def __init__(self, dirname='', sortname='', stream_name_neo=None):
4040
"""
4141
Initialize reader for one or multiple TDT data blocks.
4242
@@ -48,6 +48,9 @@ def __init__(self, dirname='', sortname=''):
4848
if sortname=='PLX', there should be a ./sort/PLX/*.SortResult file in the tdt block,
4949
which stores the sortcode for every spike
5050
Default: '', uses the original online sort.
51+
stream_name (str):
52+
If there are several streams, specify the stream name you want to load.
53+
Default: None, load all streams.
5154
5255
5356
"""
@@ -64,6 +67,7 @@ def __init__(self, dirname='', sortname=''):
6467
raise ValueError(f'No data folder or file found for {dirname}')
6568

6669
self.sortname = sortname
70+
self.stream_name_neo = stream_name_neo
6771

6872
def _source_name(self):
6973
return self.dirname
@@ -178,12 +182,16 @@ def _parse_header(self):
178182
self._sigs_t_start = {seg_index: {}
179183
for seg_index in range(nb_segment)} # key = seg_index then group_id
180184

181-
keep = info_channel_groups['TankEvType'] == EVTYPE_STREAM
185+
if self.stream_name_neo is not None:
186+
keep = info_channel_groups['StoreName'].astype(str) == self.stream_name_neo
187+
else:
188+
keep = info_channel_groups['TankEvType'] == EVTYPE_STREAM
189+
182190
missing_sev_channels = []
183191
for stream_index, info in enumerate(info_channel_groups[keep]):
184192
self._sig_sample_per_chunk[stream_index] = info['NumPoints']
185193

186-
stream_name = str(info['StoreName'])
194+
stream_name = info['StoreName'].astype(str)
187195
stream_id = f'{stream_index}'
188196
signal_streams.append((stream_name, stream_id))
189197

0 commit comments

Comments
 (0)