question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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!

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
larsonercommented, Mar 31, 2022

So far the way we’ve handled “optional/other annotation-like files” for other readers is by making read_annotations support reading those files, then letting people do raw.set_annotations or raw.annotations.append(...). Since the .evt show up as Annotations in the raw data, I think it makes sense to live in read_annotations.

0reactions
claytonjschneidercommented, Mar 31, 2022

Ultimately, @larsoner this is preferable! I’m going to start work on a fork now to try to implement this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mne.io.Raw — MNE 1.2.2 documentation - MNE-Python
If a file-like object is provided, preloading must be used. ... The first column specifies the sample number of each event, ...
Read more >
Exploring MNE's data structure
In this lesson, we will load a raw EEG data file using MNE and gain an understanding of ... function, we have to...
Read more >
Error in mne.io.read_raw_curry · Issue #7300 - GitHub
In our experiments we did not have an event file. The matlab function reads data even without this file. However, my experience with...
Read more >
Data Loading
To import data into python, we will use functions of the MNE package. ... The output is time-locked to an external event, and...
Read more >
Working with events - Jupyter Notebooks Gallery
As usual we'll start by importing the modules we need, loading some example data <sample-dataset> , and cropping the :class: ~mne.io.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found