Skip to content

[fNIRS] use .nosatflags_wlX in case they exist #7926

@swy7ch

Description

@swy7ch

Describe the bug

The NIRStar software sometimes puts NaN values in the .wlX files when it estimates the probes saturated. It is not clear how (or even why) it does so, but it changes the data without the approval of the researcher, which is a bad thing. The software does provide the "true" values in a separate file name .nosatflags_wlX, which is a copy of the corresponding .wlX file with the true values.

Currently, the library checks for any file in the working directory that ends with 'wl1'. When the nosatflags_wlX files exist, the glob.glob() function returns a list of two paths, one for .wlX and another for .nosatflags_wlX, and then an error is raised saying :

'Expect one wl1 file, got 2'

Steps to reproduce

  • Get a "saturated" sample of data
  • Read the data from said sample

Expected results

Warn the user that we don't use the .wlX file but the corresponding .nosatflags_wlX one instead, and use it.

Actual results

An error is raised saying there is too much .wlX files.

Additional information

Platform: Windows-10-10.0.18362-SP0
Python: 3.8.3 (default, May 19 2020, 06:50:17) [MSC v.1916 64 bit (AMD64)]
Executable: C:\Users\juliend\Anaconda3\envs\mne_dev\python.exe
CPU: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel: 8 cores
Memory: 15.6 GB

mne: 0.21.dev0
numpy: 1.18.1 {blas=mkl_rt, lapack=mkl_rt}
scipy: 1.4.1
matplotlib: 3.1.3 {backend=Qt5Agg}

sklearn: 0.22.1
numba: 0.49.1
nibabel: 3.1.0
cupy: Not found
pandas: 1.0.3
dipy: 1.1.1
mayavi: 4.7.2.dev0
pyvista: 0.25.3
vtk: 9.0.0
PyQt5: 5.9.2

--

I have a patch that warns the user of the switch in used files, and also use the right one, that you can find here (I will PR it, just wanted to open an issue before as I didn't know the right worflow)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions