EEG signal processing from raw .edf file of EGI

:question: If you have a question or issue with MNE-Python, please include the following info:

  • MNE version: 1.3.0
  • operating system: Windows 10

I have .edf files for each subject from EGI. There are 30 trials for each subject or each edf file. I want ERS and ERD analysis. How to do it?

Hello, you could use MNELAB for this:
https://mnelab.readthedocs.io/en/stable/examples/erds_maps.html

Best wishes,
Richard

1 Like

Alternatively, this is also possible with MNE directly: Compute and visualize ERDS maps — MNE 1.3.0 documentation

2 Likes

Thank you Richard. But I could not install MNELAB through pip install.

Thank you for helping me. As I am very new to handling python, I could not load my dataset through your process. There was a problem of loading or importing dataset.

Please post your code so you that we can see what you tried.

Can you also share more details of the error message you received when pip installing MNELAB?

Microsoft Windows [Version 10.0.19045.2486]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Pijush>pip install mnelab
Requirement already satisfied: mnelab in c:\users\pijush\appdata\local\programs\python\python38-32\lib\site-packages (0.8.5)
Collecting mnelab
Using cached mnelab-0.8.4-py3-none-any.whl (90 kB)
Using cached mnelab-0.8.3-py3-none-any.whl (90 kB)
Using cached mnelab-0.8.2-py3-none-any.whl (90 kB)
Using cached mnelab-0.8.1-py3-none-any.whl (90 kB)
Using cached mnelab-0.8.0-py3-none-any.whl (64 kB)
Using cached mnelab-0.7.0-py3-none-any.whl (71 kB)
Using cached mnelab-0.6.6-py3-none-any.whl (69 kB)
Collecting QtPy>=1.9.0
Using cached QtPy-2.3.0-py3-none-any.whl (83 kB)
Collecting mne>=0.22.0
Using cached mne-1.3.0-py3-none-any.whl (7.6 MB)
Collecting numpy>=1.14.0
Using cached numpy-1.24.1-cp38-cp38-win32.whl (12.4 MB)
Collecting scipy>=1.0.0
Using cached scipy-1.10.0.tar.gz (42.4 MB)
Installing build dependencies … done
Getting requirements to build wheel … done
Installing backend dependencies … done
Preparing metadata (pyproject.toml) … error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [79 lines of output]
+ meson setup --prefix=c:\users\pijush\appdata\local\programs\python\python38-32 C:\Users\Pijush\AppData\Local\Temp\pip-install-ewoti_ci\scipy_6ef74d47b7b24a2296ff412a26cda3d9 C:\Users\Pijush\AppData\Local\Temp\pip-install-ewoti_ci\scipy_6ef74d47b7b24a2296ff412a26cda3d9.mesonpy-hyck2pwg\build --native-file=C:\Users\Pijush\AppData\Local\Temp\pip-install-ewoti_ci\scipy_6ef74d47b7b24a2296ff412a26cda3d9.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
The Meson build system
Version: 1.0.0
Source dir: C:\Users\Pijush\AppData\Local\Temp\pip-install-ewoti_ci\scipy_6ef74d47b7b24a2296ff412a26cda3d9
Build dir: C:\Users\Pijush\AppData\Local\Temp\pip-install-ewoti_ci\scipy_6ef74d47b7b24a2296ff412a26cda3d9.mesonpy-hyck2pwg\build
Build type: native build
Project name: SciPy
Project version: 1.10.0
C compiler for the host machine: gcc (gcc 8.3.0 “gcc (i686-posix-dwarf, Built by strawberryperl.com project) 8.3.0”)
C linker for the host machine: gcc ld.bfd 2.32
C++ compiler for the host machine: c++ (gcc 8.3.0 “c++ (i686-posix-dwarf, Built by strawberryperl.com project) 8.3.0”)
C++ linker for the host machine: c++ ld.bfd 2.32
Host machine cpu family: x86
Host machine cpu: x86
Compiler for C supports arguments -Wno-unused-but-set-variable: YES
Compiler for C supports arguments -Wno-unused-function: YES
Compiler for C supports arguments -Wno-conversion: YES
Compiler for C supports arguments -Wno-misleading-indentation: YES
Compiler for C supports arguments -Wno-incompatible-pointer-types: YES
Library m found: YES
Fortran compiler for the host machine: gfortran (gcc 8.3.0 “GNU Fortran (i686-posix-dwarf, Built by strawberryperl.com project) 8.3.0”)
Fortran linker for the host machine: gfortran ld.bfd 2.32
Compiler for Fortran supports arguments -Wno-conversion: YES
Checking if “-Wl,–version-script” : links: YES
Program cython found: YES (C:\Users\Pijush\AppData\Local\Temp\pip-build-env-jn37dgt_\overlay\Scripts\cython.EXE)
Program python found: YES (c:\users\pijush\appdata\local\programs\python\python38-32\python.exe)
Program pythran found: YES (C:\Users\Pijush\AppData\Local\Temp\pip-build-env-jn37dgt_\overlay\Scripts\pythran.EXE)
WARNING: You should add the boolean check kwarg to the run_command call.
It currently defaults to false,
but it will default to true in future releases of meson.
See also: https://github.com/mesonbuild/meson/issues/9300
Run-time dependency threads found: YES
Library npymath found: YES
Library npyrandom found: YES
found pkg-config ‘C:\Strawberry\perl\bin\pkg-config.BAT’ but it is Strawberry Perl and thus broken. Ignoring…
Found Pkg-config: NO
Did not find CMake ‘cmake’
Found CMake: NO
Run-time dependency openblas found: NO (tried pkgconfig and cmake)
Run-time dependency openblas found: NO

  ..\..\scipy\meson.build:134:0: ERROR: Dependency lookup for OpenBLAS with method 'pkgconfig' failed: Pkg-config binary for machine 1 not found. Giving up.

  A full log can be found at C:\Users\Pijush\AppData\Local\Temp\pip-install-ewoti_ci\scipy_6ef74d47b7b24a2296ff412a26cda3d9\.mesonpy-hyck2pwg\build\meson-logs\meson-log.txt
  Traceback (most recent call last):
    File "c:\users\pijush\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 144, in prepare_metadata_for_build_wheel
      hook = backend.prepare_metadata_for_build_wheel
  AttributeError: module 'mesonpy' has no attribute 'prepare_metadata_for_build_wheel'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "c:\users\pijush\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
      main()
    File "c:\users\pijush\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "c:\users\pijush\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 148, in prepare_metadata_for_build_wheel
      whl_basename = backend.build_wheel(metadata_directory, config_settings)
    File "C:\Users\Pijush\AppData\Local\Temp\pip-build-env-jn37dgt_\overlay\Lib\site-packages\mesonpy\__init__.py", line 1060, in build_wheel
      with _project(config_settings) as project:
    File "c:\users\pijush\appdata\local\programs\python\python38-32\lib\contextlib.py", line 113, in __enter__
      return next(self.gen)
    File "C:\Users\Pijush\AppData\Local\Temp\pip-build-env-jn37dgt_\overlay\Lib\site-packages\mesonpy\__init__.py", line 975, in _project
      with Project.with_temp_working_dir(
    File "c:\users\pijush\appdata\local\programs\python\python38-32\lib\contextlib.py", line 113, in __enter__
      return next(self.gen)
    File "C:\Users\Pijush\AppData\Local\Temp\pip-build-env-jn37dgt_\overlay\Lib\site-packages\mesonpy\__init__.py", line 750, in with_temp_working_dir
      yield cls(source_dir, tmpdir, build_dir, meson_args)
    File "C:\Users\Pijush\AppData\Local\Temp\pip-build-env-jn37dgt_\overlay\Lib\site-packages\mesonpy\__init__.py", line 632, in __init__
      self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
    File "C:\Users\Pijush\AppData\Local\Temp\pip-build-env-jn37dgt_\overlay\Lib\site-packages\mesonpy\__init__.py", line 680, in _configure
      self._meson('setup', *setup_args)
    File "C:\Users\Pijush\AppData\Local\Temp\pip-build-env-jn37dgt_\overlay\Lib\site-packages\mesonpy\__init__.py", line 657, in _meson
      return self._proc('meson', *args)
    File "C:\Users\Pijush\AppData\Local\Temp\pip-build-env-jn37dgt_\overlay\Lib\site-packages\mesonpy\__init__.py", line 652, in _proc
      subprocess.check_call(list(args), env=self._env)
    File "c:\users\pijush\appdata\local\programs\python\python38-32\lib\subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['meson', 'setup', '--prefix=c:\\users\\pijush\\appdata\\local\\programs\\python\\python38-32', 'C:\\Users\\Pijush\\AppData\\Local\\Temp\\pip-install-ewoti_ci\\scipy_6ef74d47b7b24a2296ff412a26cda3d9', 'C:\\Users\\Pijush\\AppData\\Local\\Temp\\pip-install-ewoti_ci\\scipy_6ef74d47b7b24a2296ff412a26cda3d9\\.mesonpy-hyck2pwg\\build', '--native-file=C:\\Users\\Pijush\\AppData\\Local\\Temp\\pip-install-ewoti_ci\\scipy_6ef74d47b7b24a2296ff412a26cda3d9\\.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2']' returned non-zero exit status 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

While I am using MNE directly, and trying to load my data from Gdrive - it is showing the error given below:

NameError Traceback (most recent call last)
in
----> 1 fnames = eegegi.load_data()
2 raw = concatenate_raws([read_raw_edf(f, preload=True) for f in fnames])
3
4 raw.rename_channels(lambda x: x.strip(‘.’)) # remove dots from channel names
5

NameError: name ‘eegegi’ is not defined

Re the MNELAB install error, it seems like it is trying to compile SciPy from source. Do you know why? Can you post more info on your system?

According to the path, they’re running a 32-bit version of Python. I assume that is the problem.

1 Like

It was the problem of loading the dependencies. But now I solved the problem. MNELAB is installed. Thank you so much.

1 Like