BrainAccess Connect Overview

SSVEP classifier

This section describes functions available for accessing the SSVEP classifier algorithm.

The steady-state visual evoked potential (SSVEP) is a repetitive evoked potential that is produces when viewing flashing stimuli. Activity at the same frequency as the visual stimulation can be detected in the occipital areas of the brain.

SSVEP classifier can recognize steady-state visual evoked potentials (SSVEP). Meaning that given a visual stimulus flickering at a constant frequency, SSVEP classifier can determine if the user is currently looking at it. This can be used as motionless control, where the user chooses an option by looking at the corresponding visual stimulus.

The workflow of using SSVEP classifier is as follows:

  1. Acquisition Setup. We recommend using 2-6 electrodes in the ocipital region (O1, O2, P3, P4, Oz, Pz) with reference at Fp1 and bias at Fp2.

  2. Initialize classifier with desired frequency combinations, prediction time interval and EEG sampling rate.

  3. Get predictions on input data

  4. Detailed implementation of 4 target SSVEP classifier is shown in examples\bci\bci_ssvep_4_target.py

  5. Detailed implementation of 40 target SSVEP classifier is shown in examples\bci\bci_ssvep_keyboard.py

To run examples install brainaccess package in environment with python 3.10 by executing pip install .[bci] and change device name according to your device.

See all function descriptions for more information.

class brainaccess.connect.SSVEP.SSVEP(frequencies: list = [], sample_rate: float = 250)[source]

Bases: object

SSVEP BCI library

Initialize SSVEP model

Parameters:
  • frequencies (list) – list of stimulation frequencies

  • sample_rate (float) – data sampling rate

predict(x: ndarray, frequencies: list = None, sample_rate: float = None) tuple[source]

Classify EEG SSVEP (steady state visually evoked potentials) given a set of class frequencies

Parameters:
  • x (np.ndarray) – EEG data (channels x samples) for classifier

  • frequencies (list) – list of stimulation frequencies

  • sample_rate (float) – data sampling rate

Returns:

  • float – target frequency

  • float – target threshold value

Raises:

Exception – An error is raised if prediction failed

Warning

Data must have these properties:

  • filtered with 1-90 Hz filter

  • selected channels must be from ocipital region

Visual P300 classifier

This section describes functions available for accessing the Visual P300 classifier algorithm.

The P300 (P3) wave is an event-related potential (ERP) component elicited in the process of decision making. The P300 is thought to reflect processes involved in stimulus evaluation or categorization. It is usually elicited using the oddball paradigm, in which low-probability target items are mixed with high-probability non-target (or “standard”) items. When recorded by electroencephalography (EEG), it surfaces as a positive deflection in voltage with a latency (delay between stimulus and response) of roughly 250 to 500 ms. The signal is typically measured most strongly by the electrodes covering the parietal lobe [1] . This can be used as lie detector [2], speller [3] etc.

Our P300 classifier comes in four variations depending on the number of repetitions channel count and stimulus inter trial interval (ITI). A repetition is the number of times a particular stimuli is shown to the user and signal is collected. A stimuli can be shown either once, and the corresponding signal can be sent to classifier to check the P300 score, or it can be done three times at distant time instances and the concatenated signals can be checked for the same. The classifier accepts data of shape [chan_number,176*repetitions] where chan_number represents number of channels (8 or 2) and 176*repetitions represents number of signal time steps multiplied by number of repetitions selected. The number of repetitions can be set to 1 and 3, with 1 repetition the response can be calculated quicker while with 3 repetitions the classifier gets to have a higher certainty on the prediction.

The workflow of using Visual P300 classifier is as follows:

  1. Acquisition Setup. 8 electrode setup (F3, F4, C3, C4, P3, P4, O1, O2) or 2 electrode setup (O1, O2) with reference at Fp1 and bias at Fp2 is required.

  2. Initialize classifier with model number (0-3).

    • 0 - 8 electrode Standard Kit setup, 1 repetitions

    • 1 - 8 electrode Standard Kit setup, 3 repetition

    • 2 - 8 electrode Standard Kit setup, 3 repetitions, “fast” - inter trial interval is 215ms

    • 3 - O1 and O2 electrodes only, 3 repetitions, “fast” - inter trial interval is 215ms

  3. Get predictions on input data.

  4. Detailed implementation of 40 target speller is shown in examples\bci\keyboard_p300.py

To run example install brainaccess package in environment with python 3.10 by executing pip install .[bci] and change device name according to your device.

See all function descriptions for more information.

class brainaccess.connect.P300.P300(model_number: int)[source]

Bases: object

P300 BCI library

Initialize P300 model.

Parameters:

model_number (int) – Model type to load, currently available: 0 - 8 electrode Standard Kit setup, 1 repetitions 1 - 8 electrode Standard Kit setup, 3 repetition 2 - 8 electrode Standard Kit setup, 3 repetitions, “fast” - inter trial interval is 215ms 3 - O1 and O2 electrodes only, 3 repetitions, “fast” - inter trial interval is 215ms

Raises:

Exception – An error is raised if initializing failed

destroy() None[source]
predict(x: ndarray) float[source]

Predict P300

Parameters:

x (np.ndarray) – data for classifier

Returns:

probability that data was P300 event

Return type:

float

Raises:

Exception – An error is raised if prediction failed

Warning

Data sampled at 250 Hz must have these properties:

  • standardized with ewma and filtered with 1-40 Hz filter

  • (8, 176 * repetitions) shape (channels x samples),

  • each repetition 200 ms prior to stimulus onset up to 500 ms after stimulus onset

  • Channels must be in exactly this order: F3, F4, C3, C4, P3, P4, O1, O2 (8 channels) or O1, O2 (2 channels)

References

  1. Polich, J. (2007). Updating P300: an integrative theory of P3a and P3b. Clinical neurophysiology, 118(10), 2128-2148.

  1. Farwell, L. A., & Smith, S. S. (2001). Using brain MERMER testing to detect knowledge despite efforts to conceal. Journal of Forensic Science, 46(1), 135-143.

  1. Krusienski, D. J., Sellers, E. W., McFarland, D. J., Vaughan, T. M., & Wolpaw, J. R. (2008). Toward enhanced P300 speller performance. Journal of neuroscience methods, 167(1), 15-21.