Skip to content

Writing NIRS files to FIF is surprisingly slow #7744

@rob-luke

Description

@rob-luke

Describe the bug

I am reading NIRX NIRS files and writing them to fif files. This process takes longer than I expected.

It may be that this is how long writing takes. But I want to make sure there is nothing wrong with how we have written the read_raw_nirx function that is causing a slowdown.

Or perhaps fif is not the correct format I should be using? I selected fif as I know that it should work as its being tested here (called here).

Steps to reproduce

import os
import time
import mne

fnirs_data_folder = mne.datasets.fnirs_motor.data_path()
fnirs_raw_dir = os.path.join(fnirs_data_folder, 'Participant-1')
raw_intensity = mne.io.read_raw_nirx(fnirs_raw_dir, verbose=True, preload=False)

t = time.time()
raw_intensity.save("test_raw.fif")
print(time.time() - t)

On my PC this takes almost 2 minutes.

Expected results

I don't have an exact time I would expect this to take, but two minutes to process a 5 MB file seemed slow.

Actual results

About 2 mins.

Additional information

Platform:      Darwin-19.3.0-x86_64-i386-64bit
Python:        3.7.3 (default, Dec 13 2019, 19:58:14)  [Clang 11.0.0 (clang-1100.0.33.17)]
Executable:    /Library/Developer/CommandLineTools/usr/bin/python3
CPU:           i386: 16 cores
Memory:        32.0 GB
mne:           0.21.dev0
numpy:         1.18.2 {blas=openblas, lapack=openblas}
scipy:         1.4.1
matplotlib:    3.2.1 {backend=module://backend_interagg}
sklearn:       0.22.2.post1
numba:         0.48.0
nibabel:       3.0.2
cupy:          Not found
pandas:        1.0.3
dipy:          1.1.1
mayavi:        4.7.1
pyvista:       0.24.1
vtk:           8.1.2
PyQt5:         5.14.1

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