Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions neo/rawio/tdtrawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,12 @@ def _parse_header(self):
raise ValueError("Dtype is changing!!")

# data buffer test if SEV file exists otherwise TEV
# path = self.dirname / segment_name
if self.tdt_block_mode == "multi":
# for multi block datasets the names of sev files are fixed
sev_stem = f"{tankname}_{segment_name}_{stream_name}_ch{chan_id}"
sev_filename = (path / sev_stem).with_suffix(".sev")
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread
ree-gupta marked this conversation as resolved.
Outdated
else:
# for single block datasets the exact name of sev files is not known
sev_regex = f"*_[cC]h{chan_id}.sev"
Expand Down
Loading