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

SNIRF loader not working with the official samples #9265

Closed
HanBnrd opened this issue Apr 8, 2021 · 6 comments
Closed

SNIRF loader not working with the official samples #9265

HanBnrd opened this issue Apr 8, 2021 · 6 comments
Labels

Comments

@HanBnrd
Copy link
Contributor

HanBnrd commented Apr 8, 2021

Describe the bug

The function read_raw_snirf returns errors with the official samples from https://github.com/fNIRS/snirf-samples/.

Steps to reproduce

With Simple_Probe.snirf:

from mne.io import read_raw_snirf

snirf_intensity = read_raw_snirf('Simple_Probe.snirf')

With minimum_example.snirf:

from mne.io import read_raw_snirf

snirf_intensity = read_raw_snirf('minimum_example.snirf')

Expected results

Loading Simple_Probe.snirf

and

Loading minimum_example.snirf

respectively.

Actual results

Loading Simple_Probe.snirf
...\snirf.py:3: RuntimeWarning: Non uniform sampled data not supported.
  snirf_intensity = read_raw_snirf('Simple_Probe.snirf')
...\snirf.py:3: RuntimeWarning: Unable to extract sample rate from SNIRF file.
  snirf_intensity = read_raw_snirf('Simple_Probe.snirf')
Traceback (most recent call last):
  File "...\snirf.py", line 3, in <module>
    snirf_intensity = read_raw_snirf('Simple_Probe.snirf')
  File "...\mne-python\mne\io\snirf\_snirf.py", line 43, in read_raw_snirf
    return RawSNIRF(fname, preload, verbose)
  File "<decorator-gen-248>", line 24, in __init__
  File "...\mne-python\mne\io\snirf\_snirf.py", line 112, in __init__
    sources = [s.decode('UTF-8') for s in sources]
  File "...\mne-python\mne\io\snirf\_snirf.py", line 112, in <listcomp>
    sources = [s.decode('UTF-8') for s in sources]
AttributeError: 'numpy.ndarray' object has no attribute 'decode'

and

Loading minimum_example.snirf
...\snirf.py:3: RuntimeWarning: Non uniform sampled data not supported.
  snirf_intensity = read_raw_snirf('minimum_example.snirf')
...\snirf.py:3: RuntimeWarning: Unable to extract sample rate from SNIRF file.
  snirf_intensity = read_raw_snirf('minimum_example.snirf')
Traceback (most recent call last):
  File "...\snirf.py", line 3, in <module>
    snirf_intensity = read_raw_snirf('minimum_example.snirf')
  File "...\mne-python\mne\io\snirf\_snirf.py", line 43, in read_raw_snirf
    return RawSNIRF(fname, preload, verbose)
  File "<decorator-gen-248>", line 24, in __init__
  File "...\mne-python\mne\io\snirf\_snirf.py", line 112, in __init__
    sources = [s.decode('UTF-8') for s in sources]
TypeError: iteration over a 0-d array

respectively.

Additional information

This tutorial from MNE-NIRS works fine on my machine.

@HanBnrd HanBnrd added the BUG label Apr 8, 2021
@HanBnrd HanBnrd changed the title SNIRF loader not working with the official samples SNIRF loader not working with the official samples and without sourcePos3D Apr 8, 2021
@HanBnrd HanBnrd changed the title SNIRF loader not working with the official samples and without sourcePos3D SNIRF loader not working with the official samples or without sourcePos3D Apr 8, 2021
@HanBnrd
Copy link
Contributor Author

HanBnrd commented Apr 16, 2021

Hi, just pinging @rob-luke.
I will try to have a look at it ASAP.

@HanBnrd HanBnrd changed the title SNIRF loader not working with the official samples or without sourcePos3D SNIRF loader not working with the official samples Apr 16, 2021
@HanBnrd
Copy link
Contributor Author

HanBnrd commented Apr 16, 2021

I created a separate issue for the sourcePos3D problem: #9308

@rob-luke
Copy link
Member

We should ensure we follow the SNIRF standard. However, from memory not all files in the examples repo do. What specific part of our reader is diverging from the standard?

@HanBnrd
Copy link
Contributor Author

HanBnrd commented Apr 17, 2021

Thanks @rob-luke, you are right, my bad. Both files do not pass the snirf_validator.py.

Some modifications of the samples are planned according to fNIRS/snirf#44, so maybe better to close this issue. Sorry about that.

@rob-luke
Copy link
Member

That's good to know. Thanks for checking this. I probably wouldn't trust that validator either. Just the spec is valid

@HanBnrd HanBnrd closed this as completed Apr 17, 2021
@rob-luke
Copy link
Member

I just received some SNIRF files from NIRx. So I will test and ensure these load in to our reader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants