A library to handle Micromed data
Project description
Micromed library
Library to handle Micromed data. It also provides some useful scripts.
Install
pip install micromed-io
Convert a Micromed (.trc) file to MNE (.fif) format
from micromed_io.to_mne import create_mne_from_micromed_recording
mne_raw = create_mne_from_micromed_recording("path/to/file.TRC")
Emulate Micromed TCP from .trc file
CLI tool
Use the following command:
mmio_tcp_emulator --file=../data/sample.TRC --address=localhost --port=5123
mmio_tcp_emulator --help
More details in the script emulate_trc_tcpip.py
in the gihub repo
Read TCP and push to LSL Stream
Use the following command:
mmio_to_lsl --address=localhost --port=5123 --lsl-name=whatever --lsl-type=whatever --lsl-source-id=whatever
mmio_to_lsl --help
More details in the script read_tcp_to_lsl.py
int the gihub repo
Read and parse Micromed TCP live data
Download read_tcp_data.py
from the gihub repo in scripts/
python read_tcp_data.py --address=localhost --port=5123
Note: Micromed TCP behaves as a client. If you want to try the emulate/read TCP script, launch the reader first that acts as server, then the emulator.
Read Micromed TCP in a sliding window buffer
If you plan to use the Micromed data as input of a decoder, you probably want epochs of format (n_channels, n_samples)
. Then the MicromedBuffer
class is for you. The script read_tcp_to_epoch.py
show you how to use it (see the PROCESS HERE
comment). It uses a buffer that mimics the sliding window and triggers each time it is filled.
from micromed_io.buffer import MicromedBuffer
micromed_buffer = MicromedBuffer(epoch_duration=5, epoch_overlap=2.5)
Read TRC file
from micromed_io.trc import MicromedTRC
mmtrc = MicromedTRC("sample.TRC")
Then you have access to the trc data:
mmtrc.get_header()
mmtrc.get_markers()
mmtrc.get_data()
mmtrc.get_notes()
Note:
get_data()
might take times because it loads the brain data
Local install
Download the repo and:
conda env create -f environment.yml
conda activate mmio
poetry install
TODO
- Include serial markers parsing
- Parse all info from Micromed header
- Emulate serial markers + notes
- Add tests
Please feel free to reach me if you want to contribute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for micromed_io-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93a457ef02431e5506c433b2573085806c0693f51da6d7b7ac8420d97ac98488 |
|
MD5 | dd4385f3f01882188e1faa9fecd680d3 |
|
BLAKE2b-256 | 625b99d5997a92925640201fe4e11d8aa032d7ca4dce5a5c4217dda8823b4164 |