Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Create functions to read Epochs and Evoked Neuroscan formats #12392

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion mne/io/cnt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright the MNE-Python contributors.
"""CNT data reader."""

from .cnt import read_raw_cnt
from .cnt import read_raw_cnt, read_epochs_cnt, read_evoked_cnt
17 changes: 16 additions & 1 deletion mne/io/cnt/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ def _read_teeg(f, teeg_offset):
)


EpochHeader = namedtuple(
"EpochHeader",
("Accept Ttype Correct Rt Response Reserved"),
)
# char Accept; /* accept byte */
# short Ttype; /* trial type */
# short Correct; /* accuracy */
# float Rt; /* reaction time */
# short Response; /* response type */
# short Reserved; /* not used */


def _get_event_parser(event_type):
if event_type == 1:
event_maker = CNTEventType1
Expand All @@ -83,8 +95,11 @@ def _get_event_parser(event_type):
elif event_type == 3:
event_maker = CNTEventType3
struct_pattern = "<HBclhhfccc" # Same as event type 2
elif event_type == "epoch":
event_maker = EpochHeader
struct_pattern = "<chhfh"
else:
raise ValueError("unknown CNT even type %s" % event_type)
raise ValueError("unknown CNT header type %s" % event_type)

def parser(buffer):
struct = Struct(struct_pattern)
Expand Down