A library to read, emulate, and forward Micromed data in standard formats. See online doc.
Main features:
- simulate online data from a trc file
- push online tcp data to LSL server
- convert trc to mne format
- rename trc files to include the recording datetime
$ pip install micromed-iofrom micromed_io.to_mne import create_mne_from_micromed_recording
mne_raw = create_mne_from_micromed_recording("path/to/file.TRC")See details in next sections
$ mmio_emulate_trc --file=../data/sample.TRC --address=localhost --port=5123Emulate the online data stream of Micromed to test your real-time platform. See all the arguments and adapt them:
$ mmio_emulate_trc --help # to see all argumentsNote
New: not only data, but also markers and notes are send through TCP, exactly as Micromed does
$ mmio_tcp_to_lsl --address=localhost --port=5123While receiving online data throug tcp, this command forward the data to 3 LSL stream outlets:
- Micromed_EEG: the eeg data in
float32format[n_channels, n_samples] - Micromed_Markers: markers if any in
int32format[sample, marker](2 channels) - Micromed_Notes: notes if any in
stringformat[sample, note](2 channels)
You can easily change the LSL parameters:
$ mmio_tcp_to_lsl --help # to see all argumentsfrom 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
Note: get_data() might take times because it loads the brain
data
Download tcp_to_lsl.py from the github
repo in
scripts/
$ python tcp_to_lsl.py --address=localhost --port=5123Note: 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.
$ mmio_rename_trc --dirpath=./ --format=%Y%m%d-%H%M%SRename the TRC files of the given folder to include the recording date
in the filename. Output is : <filename>__<recording_date>.TRC. The
format must be compliant with python strftime format
codes
mmio_rename_trc --help # to see helpDownload the repo and:
$ conda env create -f environment.yml
$ conda activate mmio
$ poetry installPlease feel free to reach me if you want to contribute.
This work has been supported by the Wyss Center.


