Skip to content

fix TdtRawIO multi-block SEV file lookup (wrong path + case mismatch)#1815

Merged
alejoe91 merged 3 commits intoNeuralEnsemble:masterfrom
ree-gupta:fix/tdt-multiblock-sev-lookup
Feb 13, 2026
Merged

fix TdtRawIO multi-block SEV file lookup (wrong path + case mismatch)#1815
alejoe91 merged 3 commits intoNeuralEnsemble:masterfrom
ree-gupta:fix/tdt-multiblock-sev-lookup

Conversation

@ree-gupta
Copy link
Contributor

Fixes multi-block SEV file lookup in TdtRawIO. Two bugs caused silent fallback to TEV, resulting in all channels reading identical data:

  1. path variable at L290 was stale (from iterdir() loop at L103 or reassigned to tank root at L170), never pointed to the block subdirectory where SEV files live
  2. Filename used lowercase ch but TDT writes Ch, not found on case-sensitive filesystems (Linux)

Fix: use self.dirname / segment_name for the correct block directory, and [cC]h glob 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

@pauladkisson
Copy link
Contributor

I can confirm that this fix also works for my use case (hidden ._ files/folders)

Copy link
Contributor

@h-mayorquin h-mayorquin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

One small comment and I am fine with this if the tests pass : )

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minute, made an indentation error

@ree-gupta
Copy link
Contributor Author

One small comment and I am fine with this if the tests pass : )

The available tests for this file pass locally :)

@h-mayorquin
Copy link
Contributor

h-mayorquin commented Feb 12, 2026

@alejoe91 @samuelgarcia @zm711
This looks good to me. I think is a simple fix to an obvious error. Let me know if you want to take a look otherwise it would be good to merge so I can work on:

#1817

@alejoe91 alejoe91 added this to the 0.14.4 milestone Feb 13, 2026
@alejoe91 alejoe91 merged commit 1610b48 into NeuralEnsemble:master Feb 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TdtRawIO: multi-block SEV files not found (wrong path + case mismatch)

4 participants