Git Product home page Git Product logo

mne-lsl's People

Contributors

charlesvilajooce avatar dbdq avatar dependabot[bot] avatar dnastar avatar dnastars avatar github-actions[bot] avatar larsoner avatar mscheltienne avatar pre-commit-ci[bot] avatar quentinuhl avatar sherdim avatar valedeseta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mne-lsl's Issues

Add Stream.filter to filter signals from the stream

Stream filter API should allow:

stream = StreamLSL(...).connect()
stream.filter(1., 100., picks="eeg")
stream.filter(1., 15., picks="ecg")
stream.notch_filter(np.arange(50, 150, 50), picks="all")

In practice, we have:

  • a ringbuffer of shape (n_samples, n_channels), already processed (re-referenced, filter, ..)
  • a new chunk of data of shape (n_samples, n_channels), raw

The API should support:

  • different filters applied to different channels -> how do we handle the delay introduced by the different filters?
  • more than one filter applied to a given channel -> does the order matter?

Real-time annotation on the stream viewer.

MNE annotation offers a great way to visualize events, expected or not, that occurred during a paradigm.
A system to annotate in real-time on the recorder of a StreamViewer would be beneficial. Proposal: left click + hold initiate annotation and detect beginning on the timeline. Release detect ending on the timeline. The display should not freeze.

LPT Triggers should use PsychoPy

PsychoPy should be used for the LPT triggers: https://psychopy.org/api/parallel.html
LPT triggers should be re-organized around the keyword ParallelPort to match PsychoPy.

from bsl.triggers import ParallelPortTrigger
trigger = ParallelPortTrigger(portaddr=None, arduino=True, delay=50)
# -> If Arduino is set to True, then use Arduino2LPT converter
# -> If Arduino is set to False, then portaddr must be provided with the address of the parallel port

from bsl.triggers import SoftwareTrigger
trigger = SoftwareTrigger(recorder)

from bsl.triggers import MockTrigger
trigger = MockTrigger()

Bundle pylsl and liblsl with BSL

Aside from clear installation notes; pylsl and liblsl could be bundled with BSL.
New versions of both should be included as they are released.

Maybe in a module .externals?

Add examples.

Add simple and complex examples in folder examples.

  • BSL only scripts
  • Integration with MNE
  • Integration with PsychoPy

Overhaul of the StreamViewer

The StreamViewer API needs an overhaul. It will be rename as Viewer to match the new Stream and Player API. The new Viewer API will interface with one or more Stream and will use methods from Stream to edit the stream properties:

  • Possibility to change the channel names
  • Possibility to change the channel types (will automatically adapt the trace colors, the trace y-range)
  • Possibility to change the channel units (will automatically adapt the trace y-range)
  • Possibility to set a filter per channel
  • Possibility to set the EEG reference

Moreover, the Viewer should be able to connect to multiple streams. Streams with a regular sampling rate should be displayed as channels (/!\ identical channel names between streams must be covered) while streams with an irregular sampling rate should be displayed as vertical lines.

For the filter, some thinking is required to compensate or ignore the causal delay introduced on one or all channels (and between a regular sampling rate stream and the vertical lines from an irregular one).

The backend should be pyqtgraph with OpenGL for better display.

Rearrange datasets and add short dataset for testing.

events should be renamed into trigger_def for consistency.
A short dataset with a test where the StreamPlayer would loop at least once would increase coverage.
A short dataset with a trigger channel and some events should be added to tests the logging of events from a StreamPlayer with a defined TriggerDef.

Add tests for LSL triggers

The LSL triggers are not covered by unit tests.
This change depends on the refactoring of the receiver and recorder API.

Depends on:

Improve structure of API Reference in the documentation

Proposed structure for triggers:

  • Triggers
    • bsl.triggers.trigger_def
    • bsl.triggers.mock
    • bsl.triggers.software
    • bsl.triggers.lpt.TriggerLPT
    • bsl.triggers.lpt.TriggerUSB2LPT
    • bsl.triggers.lpt.Arduino2LPT

Add page placeholder for the arduino 2 lpt converter design.

Implement vispy backend with high-level functions.

The current vispy backend for the StreamViewer is incomplete and implemented with the low-level gloo interface. The gloo interface is set to be deprecated in a couple of years. A backend designed around the higher-level vispy function should be implemented.

In datasets, move path outside the function.

Move the path as a global variable; as the MD5 hash and the URL.

from pathlib import Path

from ._fetching import fetch_file, _hashfunc
from .. import logger
from ..utils.io._file_dir import make_dirs


MD5 = '8925f81af22390fd17bb3341d553430f'
URL = 'https://github.com/bsl-tools/bsl-datasets/raw/main/eeg/resting-state-sample-raw.fif'


def data_path():
    """
    Return the path to the sample dataset.
    If the dataset is not locally present, it is downloaded in the user home
    directory in the folder bsl-datasets.
    """
    path = Path('~/bsl_data/eeg/resting-state-sample-raw.fif').expanduser()
    make_dirs(path.parent)

    logger.debug('URL:   %s' % (URL,))
    logger.debug('Hash:  %s' % (MD5,))
    logger.debug('Path:  %s' % (path,))

    if path.exists() and _hashfunc(path) == MD5:
        download = False
    elif path.exists() and not _hashfunc(path) == MD5:
        logger.warning(
            'Dataset existing but with different hash. Re-downloading.')
        download = True
    else:
        logger.info('Fetching dataset..')
        download = True

    if download:
        fetch_file(URL, path, hash_=MD5, hash_type='md5', timeout=10.)

    return path

Add test suites.

Add a test suite to test the code automatically.
Check the code coverage by the test suite.

Add support for additional devices/stream types.

LSL supports additional devices besides EEG amplifiers. c.f. here.

Each new device need:

  • Stream class in bsl.stream_receiver._stream
  • Scope class in bsl.stream_viewer.scope
  • Control GUI in bsl.stream_viewer.control_gui

Possible future additions:

  • fNIRS devices
  • Accelerometers / Gyroscopes

Pip Install 3.10 Failure

Hello!
Hope all is well thanks for the library. Im attempting to do a pip install on python 3.10 and it keeps hanging on the getting meta process. Any ideas? I also tried pip install with verbose and it looks like theres a license agreement that needs to be accepted but after typing yes nothing happens

Overhaul for the StreamReceiver

The StreamReceiver should not assumes information from the connected streams. The current API should be replaced with a Stream API that enables to:

  • set channel types for individual channels
  • set channel names
  • set processing steps, such as scaling factors, filters, .. for individual channels
  • store an MNE-like info determined from the StreamInfo and any subsequent user-modification
  • use numpy array all along instead of converting from list to array and vice-versa buffers and data
  • support EEG, Markers, and other type of streams. The main difference is the sampling rate.
  • apply post-processing flags to the timestamps

Support for marker stream using string datatype should not be added. It is inherently slower than using string-to-number mapping. If a user wants to use string, then it is still possible via the low-level bsl.lsl API.

Depends on:

Overhaul of the StreamRecorder

The StreamRecorder API was removed in favor of LabRecorder.
A Recorder API should complement the Stream, Player and Viewer API. The recorder API must be able to control a LabRecorder instance to record to XDF. Additionaly, other file formats could be supported, e.g. a real-time writing to a FIFF file, segment per segment.

Improve the documentation website

The documentation build is not up-to-date. After the rework of the different API, the website needs to be improved:

  • Switch to Furo and rework the configuration

Add unit tests for parallel port triggers

Parallel port triggers are not covered by tests, not even locally.
The test will require a @require_pport decorator to prevent execution on system which do not have an LPT port.
On CIs, it might be possible to create a virtual parallel port card.

Overhaul the StreamPlayer

The player should support both:

  • recordings from brain data types
  • recordings from XDF files

The API should be rework and concatenated in a single object.

Real-time FFT in the stream viewer.

Add real-time FFT capabilities to the stream viewer. The user should be able to select a (limited?) number of channels from which the spectral content will be displayed in an additional plot handler.

Details on pylsl improvements?

Just stumbled upon this repo, and this line caught my interest: "improved python-binding for the Lab Streaming Layer C++ library, bsl.lsl, replacing pylsl"

I am currently using pylsl to stream mostly some EEG and bodily signals data that I then record & save using the LabRecorder app.

And I was wondering if I should consider swapping pylsl in favour bsl? Any details on the existing/planned improvements or features?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.