Skip to content

Commit 2db450e

Browse files
committed
changed regular expression and added an evtype
1 parent 8428d44 commit 2db450e

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
@@ -197,7 +197,8 @@ def _parse_header(self):
197197
for seg_index, segment_name in enumerate(segment_names):
198198
# get data index
199199
tsq = self._tsq[seg_index]
200-
mask = (tsq['evtype'] == EVTYPE_STREAM) & \
200+
mask = ((tsq['evtype'] == EVTYPE_STREAM) | \
201+
(tsq['evtype'] == int(33041))) & \
201202
(tsq['evname'] == info['StoreName']) & \
202203
(tsq['channel'] == chan_id)
203204
data_index = tsq[mask].copy()
@@ -248,16 +249,23 @@ def _parse_header(self):
248249
sev_filename = (path / sev_stem).with_suffix('.sev')
249250
else:
250251
# for single block datasets the exact name of sev files in not known
251-
sev_regex = f".*_ch{chan_id}.sev"
252+
store = info['StoreName'].decode('ascii')
253+
# sev_regex = f".*_ch{chan_id}.sev"
254+
sev_regex = f'*_{store}_Ch{chan_id}.sev'
252255
sev_filename = list(self.dirname.parent.glob(str(sev_regex)))
253256

254257
# in case non or multiple sev files are found for current stream + channel
255258
if len(sev_filename) != 1:
256259
missing_sev_channels.append(chan_id)
257260
sev_filename = None
261+
else:
262+
sev_filename = sev_filename[0]
258263

259264
if (sev_filename is not None) and sev_filename.exists():
260265
data = np.memmap(sev_filename, mode='r', offset=0, dtype='uint8')
266+
# sev_info = tdt.read_sev(sev_filename)
267+
# data = sev_info[store].data
268+
# sampling_rate = sev_info[store].fs
261269
else:
262270
data = self._tev_datas[seg_index]
263271
assert data is not None, 'no TEV nor SEV'
@@ -593,4 +601,4 @@ def is_tdtblock(blockpath):
593601
if file_ext >= tdt_ext: # if containing all the necessary files
594602
return True
595603
else:
596-
return False
604+
return False

0 commit comments

Comments
 (0)