Menu

Home

Alois Schloegl

BioSig is a software library for processing of biomedical signals (EEG, ECG, etc.) with Matlab, Octave, C/C++ and Python. A standalone signal viewer supporting more than 30 different data formats is also provided.

  1. Installation
  2. Usage
  3. FAQ


Project Admins:


Related

Wiki: FAQ
Wiki: Installation
Wiki: Usage

Discussion

  • Nahuel

    Nahuel - 2020-10-06

    I am trying to install Biosig for python3 but I have the following error:

    nahuel@nahuel-Notebook:~/Documents/TESIS/biosig-2.0.6$ python3 -c "import biosig"
    Segmentation fault (core dumped)
    

    I have Linux Mint 19 Tara and Python 3.7.5

    I installed it with:

    nahuel@nahuel-Notebook:~$ python3 -m pip install --no-cache-dir https://pub.ist.ac.at/~schloegl/biosig/prereleases/Biosig-2.0.6.tar.gz
    Defaulting to user installation because normal site-packages is not writeable
    Collecting https://pub.ist.ac.at/~schloegl/biosig/prereleases/Biosig-2.0.6.tar.gz
      Downloading https://pub.ist.ac.at/~schloegl/biosig/prereleases/Biosig-2.0.6.tar.gz (5.4 kB)
    Requirement already satisfied (use --upgrade to upgrade): Biosig==2.0.6 from https://pub.ist.ac.at/~schloegl/biosig/prereleases/Biosig-2.0.6.tar.gz in ./.local/lib/python3.7/site-packages
    Requirement already satisfied: numpy in ./.local/lib/python3.7/site-packages (from Biosig==2.0.6) (1.19.0)
    Requirement already satisfied: setuptools>=6.0 in ./.local/lib/python3.7/site-packages (from Biosig==2.0.6) (50.3.0)
    Building wheels for collected packages: Biosig
      Building wheel for Biosig (setup.py) ... done
      Created wheel for Biosig: filename=Biosig-2.0.6-cp37-cp37m-linux_x86_64.whl size=20899 sha256=a544649cda0a37de134b7dd6ed8dc1b801343589fbfef38d8cebab119e8e7c64
      Stored in directory: /tmp/pip-ephem-wheel-cache-n7_nrhbm/wheels/09/43/21/972277ad502204398daed7cc76fbdecacbc3a66afeee8f8a94
    Successfully built Biosig
    nahuel@nahuel-Notebook:~$ python3 -c "import biosig"
    Segmentation fault (core dumped)
    

    and also compiling the source code:

    make python
    make -C biosig4c++/python build
    make -C biosig4c++/python release
    
    pip3 install biosig4c++/python/dist/Biosig-2.0.5.tar.gz
    

    both the same error:

    nahuel@nahuel-Notebook:~/Documents/TESIS/biosig-2.0.6$ python3 -v -c "import biosig"
    import _frozen_importlib # frozen
    import _imp # builtin
    import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
    import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
    import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
    # installing zipimport hook
    import 'zipimport' # <class '_frozen_importlib.BuiltinImporter'>
    # installed zipimport hook
    import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>
    import '_io' # <class '_frozen_importlib.BuiltinImporter'>
    import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
    import 'posix' # <class '_frozen_importlib.BuiltinImporter'>
    import _thread # previously loaded ('_thread')
    import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
    import _weakref # previously loaded ('_weakref')
    import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
    ...
    ...
    ...
    import 'fcntl' # <class '_frozen_importlib.BuiltinImporter'>
    import 'apt.progress.base' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa99f098dd0>
    import 'apt.progress.text' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa99f08bc10>
    import 'apt.package' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa99f320b50>
    # /usr/lib/python3/dist-packages/apt/__pycache__/cache.cpython-37.pyc matches /usr/lib/python3/dist-packages/apt/cache.py
    # code object from '/usr/lib/python3/dist-packages/apt/__pycache__/cache.cpython-37.pyc'
    import 'apt.cache' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa99f328550>
    # /usr/lib/python3/dist-packages/apt/__pycache__/cdrom.cpython-37.pyc matches /usr/lib/python3/dist-packages/apt/cdrom.py
    # code object from '/usr/lib/python3/dist-packages/apt/__pycache__/cdrom.cpython-37.pyc'
    import 'apt.cdrom' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa99f098bd0>
    Segmentation fault (core dumped)
    

    I try debug:

    nahuel@nahuel-Notebook:~/Documents/TESIS/bcitp$ python -Xfaulthandler -c "import biosig"
    Fatal Python error: Segmentation fault
    
    Current thread 0x00007f20bce4e740 (most recent call first):
      File "/usr/lib/python3/dist-packages/apt/__init__.py", line 34 in <module>
      File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
      File "<frozen importlib._bootstrap_external>", line 728 in exec_module
      File "<frozen importlib._bootstrap>", line 677 in _load_unlocked
      File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 983 in _find_and_load
      File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24 in <module>
      File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
      File "<frozen importlib._bootstrap_external>", line 728 in exec_module
      File "<frozen importlib._bootstrap>", line 677 in _load_unlocked
      File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 983 in _find_and_load
      File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23 in <module>
      File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
      File "<frozen importlib._bootstrap_external>", line 728 in exec_module
      File "<frozen importlib._bootstrap>", line 677 in _load_unlocked
      File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 983 in _find_and_load
      File "/usr/lib/python3/dist-packages/apport/report.py", line 30 in <module>
      File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
      File "<frozen importlib._bootstrap_external>", line 728 in exec_module
      File "<frozen importlib._bootstrap>", line 677 in _load_unlocked
      File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 983 in _find_and_load
      File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5 in <module>
      File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
      File "<frozen importlib._bootstrap_external>", line 728 in exec_module
      File "<frozen importlib._bootstrap>", line 677 in _load_unlocked
      File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 983 in _find_and_load
      File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 953 in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 983 in _find_and_load
      File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72 in apport_excepthook
    Segmentation fault (core dumped)
    

    I install the recommended packages:

    --- Recommended packages at runtime ---

    sudo apt-get install libb64 tinyxml python-numpy python3-numpy R openjdk-11-jre octave octave-tsa octave-nan

    E: Unable to locate package libb64 #but install libb64-dev
    E: Unable to locate package tinyxml #but install libtinyxml-dev
    E: Unable to locate package R #not installed
    I also installed libbiosig-dev

    something strange is that biosig works in python2

     
  • Alois Schloegl

    Alois Schloegl - 2020-10-06

    To install biosig - including python3 binding - from source, you need to use the compile time prerequisites, If you are interested only in the python bindings (not Octave, Java, R, python2), these should be sufficient.

    apt-get install \
        gawk \
        libb64-dev tinyxml-dev \
        python3-numpy \
        libpython3-dev 
    

    After downloading and decompression of
    http://sourceforge.net/projects/biosig/files/BioSig%20for%20C_C%2B%2B/src/biosig-2.0.6.src.tar.gz

    you need to run:

    ./configure && make && sudo make install 
    

    That should do it. ( I did not test this on Mint, but on Debian).

     

    Last edit: Alois Schloegl 2020-10-06
  • Freya

    Freya - 2024-11-05

    Hello, Alois!We are currently engaged in the process of designing a neurofeedback training protocol. We would like to process the 5 channels of the central area online, and we think that it would be better to use linear regression to remove eye movement artefacts. We found your article published in 2007 demonstrated in detail the computational process and advantages of this method (Schlögl et al., 2007)
    and its use in biosig (Vidaurre et al., 2011).
    Our questions now are:
    1, we added the biosig plugin in EEGLAB→Manage EEGLAB extensions, but it does not appear in the GUI page, are we right? How can we use the online processing method rstBCI you mentioned in biosig.
    2, We have only 1 EOG channel, as well as several related application articles (Scherer et al., 2008; Supp et al., 2007) that use three channels. Is it possible for us to use this linear regression for EOG correction?

    Looking forward to your reply!

     

    Last edit: Freya 2024-11-05
  • Alois Schloegl

    Alois Schloegl - 2024-11-06

    Hello Freya,

    Concering 1):
    I'm not using EEGLAB so I can not comment on this.
    do you mean "rtsBCI" [2] (no rstBCI) which is the Matlab/Simulink-based recording from Reinhard Scherer.? It that case, you might need to add simulink block that multiplies the sampling vector with a suitable, sparse, re-referencing matrix.

    Concering 2). Technically, you can. The question is about the resulting signal quality.
    (i), you will capture and reduce only 1 spatial EOG components.
    (ii), which reference electrode are you using for EOG. Is it a bipolar EOG channel (e.g. 2 electrodes near the eyes, and the potential differences between these are recorded in the EOG channel.)
    or do you use the common ground electrode (e.g. the mastoid, behind an ear). In the later case, you will most likely also remove some common EEG activity. I stŕongly reommend to use only bipolar EOG channels (can be computed online as well).
    I recommend to check visually (Fig 3 [1]) and quantitatively (Fig4, [1]. )

    [1] A. Schlögl, C. Keinrath, D. Zimmermann, R. Scherer, R. Leeb, G. Pfurtscheller.
    A fully automated correction method of EOG artifacts in EEG recordings.
    Clin.Neurophys. 2007 Jan;118(1):98-104. Epub 2006 Nov 7 Paper(pdf)

    [2] https://sourceforge.net/projects/biosig/files/rtsBCI/

     

    Last edit: Alois Schloegl 2024-11-06
    • Freya

      Freya - 2024-11-17

      Thanks so much for your suggestion – it's really helpful! We're currently using the Brain Products system to collect EEG data, and gathering EOG data through a ground electrode (AFz) and a subocular channel.

      Our main goal is to analyze aperiodic neural activity through real-time signal processing. However, as you anticipated, in the process of removing the ocular artifacts, we also ended up removing some of the aperiodic neural activity (the 1/f fit gave us negative values, which is unusual). We tried adjusting the coefficient (for example, 0.5 * b), but that doesn’t seem like a very convincing solution. Do we have to check visually (Fig 3 [1]) and quantitatively (Fig 4, [1]) as you mentioned by about 20 people offline before we can proceed with the online study?

      Since you’re clearly an expert in signal processing, I was wondering if you have any additional suggestions for real-time ocular artifact removal?Perhaps ways to optimize our current method, or a more mature approach for removing eye movement artifacts in real time?

       

      Last edit: Freya 2024-11-17
  • Alois Schloegl

    Alois Schloegl - 2024-11-17

    For most pratical purposes, the method described in [1] as good as you can get. Make sure that the EOG channel are close to the eyes so that it does not pick up to much EEG activity. If you want to improve on that, you might try some subspace methods (ICA, PCA, etc.) but you need a large number of electrodes (at least 20, probably more) in order to identify a 3rd spatial EOG component.

    Concering the 1/f analysis, you should take into account that this might be conflated by other artifact sources, like amplifier noise, quantization noise, and impedance noise. These will increase when applying regression analysis or any other component-based (ICA, PCA, subspace) method. You might want to check until which frequency the EEG activity is larger than these noise sources. Often, high frequency components of EEG might be smaller than these artifacts, and you should omit those in your 1/f analysis. Some more details are available here [3].

    [3] https://pub.ista.ac.at/~schloegl/qc/

     

    Last edit: Alois Schloegl 2024-11-17
    • Freya

      Freya - 2024-11-17

      Thanks again for your reply! Our neurofeedback training protocol only collected EEG signals from the central zone (Fz/FC1/FC2/FCz/Cz). For this aspect, regression analysis may be more suitable for us.
      As you said, any method has the potential to increase noise when removing EOG artefacts. If we still use the regression approach, we report (Fig 3 [1]) and (Fig 4, [1]. ) via a pre-experiment , is this convincing enough? I meant to report only how many EOG artifacts were removed from the EEG data, not for more accurate EOG removal

       

      Last edit: Freya 2024-11-17
  • Alois Schloegl

    Alois Schloegl - 2024-11-19

    Dear Freya,
    I believe I provided a fair and balanced assessment what the method can and can not provide. Whether this is "convincing", or in other words good enough for your purpose, is not up to me to decide.

     
    • Freya

      Freya - 2024-11-22

      Thanks for your reply! it has really cleared things up for me!!!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.