fix TdtRawIO multi-block SEV file lookup (wrong path + case mismatch)#1815
Conversation
|
I can confirm that this fix also works for my use case (hidden ._ files/folders) |
h-mayorquin
left a comment
There was a problem hiding this comment.
LGTM.
One small comment and I am fine with this if the tests pass : )
neo/rawio/tdtrawio.py
Outdated
| block_path = self.dirname / segment_name | ||
| sev_regex = f"{tankname}_{segment_name}_{stream_name}_[cC]h{chan_id}.sev" | ||
| sev_filename = list(block_path.glob(sev_regex)) | ||
| sev_filename = sev_filename[0] if len(sev_filename) == 1 else None |
There was a problem hiding this comment.
I find the None strange here. Did you copied this from the segment branch, correct?
I think this is a mistake (see here #1817)
Given that you are using a fully qualified name here finding two files should throw an error.
Maybe something like this would be better
sev_filename = list(block_path.glob(sev_regex))
if len(sev_filename) == 1:
sev_filename = sev_filename[0]
elif len(sev_filename) == 0:
sev_filename = None # Indirect flag for TEV Format, see issue 1087
else:
raise ValueError(f"Multiple SEV files matched for channel {chan_id}: {sev_filename}")
There was a problem hiding this comment.
Ah, thanks, I didnt know the that the format only allows either sev or tsv. Updated the PR with your suggestion, please have a look :)
There was a problem hiding this comment.
One minute, made an indentation error
See related issue NeuralEnsemble#1817
The available tests for this file pass locally :) |
|
@alejoe91 @samuelgarcia @zm711 |
Fixes multi-block SEV file lookup in TdtRawIO. Two bugs caused silent fallback to TEV, resulting in all channels reading identical data:
pathvariable at L290 was stale (fromiterdir()loop at L103 or reassigned to tank root at L170), never pointed to the block subdirectory where SEV files livechbut TDT writesCh, not found on case-sensitive filesystems (Linux)Fix: use
self.dirname / segment_namefor the correct block directory, and[cC]hglob to match both cases (same pattern the single-block path already uses).Not caught by tests because
aep_05(the only multi-block test dataset) has no SEV files.Closes #1814