API Reference

eegwatch

class eegwatch.devices.EEGDevice(device: str)
abstract push_sample(marker: List[int], timestamp: float)

Push a marker and its timestamp to store alongside the EEG data.

Parameters:

marker (int): marker number for the stimuli being presented. timestamp (float): timestamp of stimulus onset from time.time() function.

abstract start(filename: str = None, duration=None, extras: dict = None)

Starts the EEG device based on the defined backend.

Parameters:

filename (str): name of the file to save the sessions data to.

class eegwatch.devices.MuseDevice(device_name: str)
push_sample(marker: List[int], timestamp: float)

Push a marker and its timestamp to store alongside the EEG data.

Parameters:

marker (int): marker number for the stimuli being presented. timestamp (float): timestamp of stimulus onset from time.time() function.

record(sources: List[str], duration, filename)

Start a background process that will stream data from the first available Muse.

If multiple sources are used, such as PPG or GYRO, it will save those to seperate files ending in, for example: ‘.PPG.csv’

start(filename: str = None, duration=None, extras: dict = None)

Starts the EEG device.

Parameters:

filename (str): name of the file to save the sessions data to.

class eegwatch.devices.BrainflowDevice(device_name: str, serial_num=None, serial_port=None, mac_addr=None, other=None, ip_addr=None)
push_sample(marker: List[int], timestamp: float)

Push a marker and its timestamp to store alongside the EEG data.

Parameters:

marker (int): marker number for the stimuli being presented. timestamp (float): timestamp of stimulus onset from time.time() function.

start(filename: str = None, duration=None, extras: dict = None) → None

Starts the EEG device based on the defined backend.

Parameters:

filename (str): name of the file to save the sessions data to.

eegclassify

eegclassify.load.load_labeled_eeg(files=None) → pandas.core.frame.DataFrame

Returns a dataframe with columns: timestamp,*channels,class

eegclassify.load.load_labeled_eeg2(files=None, since: datetime.datetime = None) → pandas.core.frame.DataFrame

Similar to load_labeled_eeg, but gives one row per task-epoch, with EEG data as cell-vector.

This is similarly structured to datasets like the Berkeley Synchronized Brainwave Dataset.

eegclassify.clean.filter(X: numpy.ndarray, sfreq: float, n_chans: int = 4, low: float = 3, high: float = 40, verbose: bool = True) → numpy.ndarray

Inspired by viewer_v2.py in muse-lsl

eegclassify.features.bandpower(df: pandas.core.frame.DataFrame, ratios=False) → pandas.core.frame.DataFrame

Computes bandpower features using the bands in BAND_NAMES, and optionally computes all permutations of ratios between the bands.

class eegclassify.plot.Bar(title: str, events: List[Tuple[int, int, Union[str, Tuple[float, float, float]], str]], show_label: bool)
eegclassify.preprocess.split_rows(df: pandas.core.frame.DataFrame, min_duration: int) → pandas.core.frame.DataFrame

Splits variable-duration rows (epochs) into shorter segments (windows) no shorter than min_duration.

Note that this might not be suitable for all types of analysis, especially not those with a distinct start of stimuli (as opposed to continuous stimuli), like controlled experiments.

eegclassify.transform.signal_ndarray(df: pandas.core.frame.DataFrame) → Tuple[numpy.ndarray, numpy.ndarray]

Converts the raw data to a matrix of shape (n_trials, n_channels, n_samples), which is the format required by pyriemann Covariances etc.