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.

SNIRF loader not working with the official samples

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rob-lukecommented, Apr 22, 2021

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

1reaction
rob-lukecommented, Apr 17, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

fNIRS/snirf-samples: Sample SNIRF datasets - GitHub
SNIRF Sample Data Files · SNIRF files · JSNIRF/JSON files · Binary JSNIRF files · How to access individual data records in Python....
Read more >
Importing Data From fNIRS Devices - MNE-Python
fNIRS measurements may be stored in a non-standardised format that is not supported by MNE-Python and cannot be converted easily into SNIRF. This...
Read more >
Issues with read_raw_snirf imported from NIRTOOLBOX
I've been working until now on my nirs data with the Matlab nirs toolbox but it is ... But if the file is...
Read more >
editing .snirf files – Homer3 and AtlasViewer – openfnirs Forum
How do you typically open .snirf files to edit them in matlab not using the ... After loading a snirf file, I'd like...
Read more >
Swagger not loading - Failed to load API definition: Fetch error ...
Very strange requirement. The new path works fine in local debug and on the server. Seems like it would be the default from...
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