mne-tools / mne-tools/mne-python

Specify an Alternate Event Files in Functions Like mne.io.read_raw_nirx

Open
#10,475 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ENH
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Like many other labs I'm sure, our triggers were not originally set up correctly to record in NIRStar all of the events that PsychoPy has intended, and so I've gone and generated (from the PsychoPy output) a new custom .evt file. I'd like to be able to read in these events using mne.read_events, but this function does not accommodate for NIRx systems or .evt style files, which the NIRx io function is reading. It is trivial to replace the old .evt files, except I would like to keep the original .evt files as well, side by side.

This could be accomplished with an optional keyword parameter in mne.io.read_nirx, which, when set, replaces the line expecting the filename prior to ".evt" to the custom parameter setting.

On this page: https://github.com/mne-tools/mne-python/blob/maint/1.0/mne/io/nirx/nirx.py#L26-L51

we would include:

  1. optional parameter in read_raw_nirx, alt_evt=None
  2. pass the param to RawNIRX ?
  3. under the comment "read triggers from event file" line ~ 441:
    if alt_evt is not None:
    files['tri'] = alt_evt+".evt"

This alone should accomplish this feature.

Describe possible alternatives

If you've suggested an implementation above, list here any alternative
implementations you can think of, and brief comments explaining why the chosen
implementation is better.

The alternative solution would be to build out the read_events file to accommodate .evt style files. This may be beneficial, but from the documentation it appears that they only accept .fif currently, a changing format that might be hard to stay compatible with.

Open to other alternative solutions!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mne/io/nirx/nirx.py, especially read_raw_nirx, RawNIRX, and the event-file handling around the “read triggers from event file” comment. Check how the requested optional alt_evt value would flow through these entry points, then verify that an alternate .evt file can be used while the original remains alongside it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.