micromed_io.trc.MicromedTRC#

class micromed_io.trc.MicromedTRC(filename: str | Path)#

Bases: MicromedIO

Micromed TRC class

This class deals with Micromed TRC file

Parameters:
filename: str or Path

The TRC filename.

Attributes:
filename: str or Path

The TRC filename.

Methods

decode_data_eeg_packet

Decode eeg data packet.

decode_data_header_packet

Decode all (but histories) of the micromed header data packet.

get_data

Get channels data in format (n_channels, n_sample)

get_header

Get the header

get_markers

Get the markers

get_notes

Get the notes

get_sfreq

Get the sampling frequency

decode_data_eeg_packet(packet: bytearray, picks: List | None = None, keep_raw: bool = False, use_volt: bool = False, check_data: bool = True) bool#

Decode eeg data packet. Conversion is made to get physiological value of eegs.

Parameters:
packetbytearray

The EEGs data packet to decode.

picksList, optional

A list of channel to extract. If None, all channels are extracted. The default is None.

keep_rawbool, optional

If True, the data won’t be converted to voltage. The default is False.

use_voltbool, optional

If True, the data is scaled to Volts. If False, whatever unit is used by Micromed. Note that you may loose resolution by doing that. The default is False.

check_data: bool, optional

Check if MKR channel(s) is close to 50mV. If not, return False. You can disable for speed performances.

Returns:
bool

False if decoding is suspicious/wrong.

Raises:
ValueError

If data is not encoded on 1,2 or 4 bytes. Should not happen.

Notes

EEGs data are stored in this order (per packet): Ch1_t0, Ch2_t0, ... ChN_t0, Ch1_t1, Ch2_t1, ... ChN_t1, ...

self.current_data_eeg is always ordered regarding the order of the channels in self.micromed_header.ch_names

If a marker is sent through serial port, MKR channel(s) is not close to 50mV. The warning should then be ignored.

decode_data_header_packet(packet: bytearray) None#

Decode all (but histories) of the micromed header data packet.

Parameters:
packetbytearray

The header packet to decode.

get_data(picks: List | None = None, start: int = 0, stop: int | None = None, keep_raw: bool = False, use_volt: bool = False)#

Get channels data in format (n_channels, n_sample)

Parameters:
picksList, optional

A list of channel to extract. If None, all channels are extracted. The default is None.

startint, optional

The starting index of the data to extract. The default is 0.

stopint, optional

The ending index of the data to extract. If None, extract until the end of the data. The default is None.

keep_rawbool, optional

If True, the data won’t be converted to voltage. The default is False.

use_voltbool, optional

If True, the data is scaled to Volts. If False, whatever unit is used by Micromed. Note that you may lose resolution by doing that. The default is False.

get_header()#

Get the header

get_markers()#

Get the markers

get_notes()#

Get the notes

get_sfreq()#

Get the sampling frequency