micromed_io.in_out.MicromedIO#
- class micromed_io.in_out.MicromedIO(picks: List[str] | None = None)#
Bases:
object
Micromed IO class
This class provides the basics for decoding Micromed data. It is common between files and TCP communication.
- Parameters:
- picksList[str], default=None
Channels to pick from EEGs data (all channels are stored). Channel names must follow the same format as in SystemPLUS Evolution (see EEG Setup Montage). WARNING: see Note 3. Example : [“Fp1-G2”, “Fpz-G2”, “MKR+-MKR-“] If None, all channels are included. The default is None.
See also
- Attributes:
- micromed_header: MicromedHeader
The corresponding micromed header of this connection.
- current_data_eeg: np.ndarray
The current eeg data of shape (nb_of_channels, nb_of_samples).
- picksList[str]
Channels to pick from EEGs data (all channels are sent via TCP). Channel names follow the same format as in SystemPLUS Evolution (see EEG Setup Montage). WARNING: This impact the channels order. Example : [“Fp1-G2”, “Fpz-G2”, “MKR+-MKR-“]
- picks_idnp.array
Indexes of the channels to pick.
- sfreqfloat
The sampling frequency
Methods
Decode eeg data packet.
Decode all (but histories) of the micromed header data packet.
- 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_namesIf 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.