Issues with read_raw_snirf imported from NIRTOOLBOX

  • MNE version: e.g. 0.24.1
  • operating system: Ubuntu 18.04

Hi everyone,

I’ve been working until now on my nirs data with the Matlab nirs toolbox but it is missing some functionnalities and documentation so I want to change to mne to analyze my data.

The thing is I’ve been doing some preprocessing on the nirs toolbox and I’d like to import these preprocessed data in mne_nirs.
The only common format between these 2 is the .snirf format.
So I used the nirs.io.saveSNIRF() function in Matlab, I obtain a .snirf file per subject.
I woud like now to import it in mne.
But when I do so like this:
raw = mne.io.read_raw_snirf(participant_path,verbose=True, preload=True)
I obtain this error:
AttributeError: ‘NoneType’ object has no attribute ‘groups’
When I traceback, I end up finding in the nirs.py that some info object that contains channels information should have a .group() attribute that should contain channel’s wavelength information but is empty:
freq = float(_S_D_F_RE.match(info['ch_names'][ii]).groups()[2])

Could someone help me with this? I think that maybe it comes from the nirs toolbox importation…

Thank you so much if you find the time to help me !!

1 Like

I should have specified that the original raw data came from a NIRX system (NIRStar version=15.0 or something).
Maybe I should tag @rob-luke ? Sorry if I shouldn’t have :grimacing:

1 Like

Hi @Jeremie,

Thanks for taking the time to try MNE for your fNIRS processing. The aim of the SNIRF format was to enable exactly what you are trying to do, transfer data between fNIRS software, so you’ve chosen the correct approach and it should work. We should be able to solve this problem together, and if there are software bugs we can fix them. To start investigating can you please answer the following questions (or whichever you are able to):

I think we can get this solved pretty quick, thanks Jeremie.

Rob

Hi @rob-luke,
Thank you so much for your answer, I am sorry I couldn’t answer earlier :grimacing:

To answer your questions:

  • I tried importing as raw and Hb and both of them returned the same error

  • I tried the SNIRF validation and here is what I get when I try to validate a raw data file conveted in .snirf:

<pysnirf2.pysnirf2.ValidationResult object at 0x7fdf73da1970>
//formatVersion FATAL   REQUIRED_DATASET_MISSING    
//nirs          FATAL   REQUIRED_INDEXED_GROUP_EMPTY

Found 0 OK      (hidden)
Found 0 INFO    (hidden)
Found 0 WARNING (hidden)
Found 2 FATAL  

File is INVALID

What do you think ?

Thank you so much again

Jérémie

We have got to the root cause of the problem then—the file you have is not a valid snirf file. That is why we can’t read it in MNE.

Can you report this to the developers of the software that exported this files. Please let us know once it’s resolved.

Cheers,
Rob