biopsykit.io.eeg module

I/O functions for files related to EEG processing.

biopsykit.io.eeg.load_eeg_raw_muse(file_path, tz='Europe/Berlin')[source]

Load a csv file with raw EEG data recorded by the Muse headband.

Parameters
  • file_path (Path or str) – path to file

  • tz (str, optional) – timezone of the recording, if present or None if no timezone is available. Default: “Europe/Berlin”

Returns

  • data (DataFrame) – dataframe with raw EEG data

  • fs (float) – sampling rate

Raises

ValidationError – if file specified by file_path does not contain the required timestamp column as well as the EEG channel columns

Return type

Tuple[pandas.core.frame.DataFrame, float]

class biopsykit.io.eeg.MuseDataset(data, tz=None)[source]

Bases: object

Get new Dataset instance.

Note

Usually you shouldn’t use this init directly. Use the provided from_csv_file constructor to handle loading recorded Muse data from a CSV file.

Parameters
  • data (pandas.DataFrame) – DataFrame containing the raw EEG data.

  • tz (str, optional) – Timezone of the recording, if present or None if no timezone is available.

SAMPLING_RATE_HZ = 250.0
classmethod from_csv_file(file_path, tz=None)[source]

Load Muse data from a CSV file.

Parameters
  • file_path (str or pathlib.Path) – Path to the CSV file.

  • tz (str, optional) – Timezone of the recording, if present or None if no timezone is available.

Returns

Dataset instance containing the loaded data.

Return type

MuseDataset

property sampling_rate_hz

Return the sampling rate of the EEG data in Hz.

property timezone: str

Return the timezone of the recording.

data_as_df(index=None)[source]

Return all data as one combined pandas.DataFrame.

Parameters

index (str, optional) – Specify which index should be used for the dataset. The options are: * “time”: For the time in seconds since the first sample * “utc”: For the utc time stamp of each sample * “utc_datetime”: for a pandas DateTime index in UTC time * “local_datetime”: for a pandas DateTime index in the timezone set for the session * None: For a simple index (0…N)

Returns

DataFrame containing the raw EEG data.

Return type

pandas.DataFrame