import numpy as np
def read_binary_eeg(fname):
with open(fname, 'rb') as f:
= np.fromfile(f, dtype='<f8')
data return data
EEG Study
1 Introduction
You have conducted an experiment to test the hypothesis that learning a new motor skill involves learning-related changes in somatosensory cortical processing.
You are given a set of raw data files:
1.1 The experimental task
In your experiment, human participants learned a novel finger sequence task using their right hand. The task was not unlike learning to play a melody on a piano. Participants practiced a set of finger sequences (10 sequences total) over and over again for 30 minutes. Before the learning session they produced each of the 10 sequences 3 times (30 sequences total). Participants came back the following day and were re-tested on each of the 10 sequences 3 times each (30 sequences total).
1.2 Probing somatosensory cortical excitability
As a measure of somatosensory cortical processing, you focused on cortical excitability in primary somatosensory cortex. To probe somatosensory cortical excitability you applied electrical stimulation to the median nerve at the wrist (right hand) and measured evoked potentials using EEG. The relevant EEG electrode is electrode CP3 in the standard 10-20 system of placing EEG electrodes on the scalp. Electrode CP3 sits above left somatosensory cortex.
Electrical stimulation was applied to the median nerve using a series of 2 ms pulses applied at a rate of 3 Hz, for about 120 seconds. There is a known evoked response in somatosensory cortex called the N20 potential, because it arises about 20 ms after median nerve stimulation. Because of the position of electrode CP3 and the 20 ms latency of the evoked potential one can be certain that the evoked potential originates in left somatosensory cortex. The evoked potential looks like a sinusoid with an initial negative peak at about 20 ms and a subsequent positive peak a few milliseconds later. The peak-to-peak amplitude of the N20 is used as a measure of cortical excitability.
The evoked response arising from a single pulse of median nerve stimulation is not observable because of its small magnitude relative to the very noisy EEG signal. That’s why you recorded 120 seconds of 3 Hz stimulation (more than 300 pulses), so you could slice out each bout of stimulation, time-align the CP3 reponse to the onset of each stimulation pulse, and then take an average over the 300+ individual stimulations to obtain a mean evoked response.
You measured evoked responses both before (“pre”) and then again after (“post”) learning. You recruited N=15 participants in this learning group.
1.3 SNAP control
To control for the possibility that a change in the efficacy of the stimulating electrode at the wrist could account for a difference in N20 amplitude post vs pre learning (for example due to the electrode shifting over time, or due to changes in galvanic skin response due to sweat), you also placed a recording electrode over the median nerve, halfway up the right arm, around the elbow. This is known as a SNAP recording (Sensory Nerve Action Potential). You can observe the SNAP as a sinusoidal potential arising at the SNAP electrode about 3-5 ms after stimulation. The peak-to-peak amplitude of the SNAP potential can be taken as an index of the efficacy of the stimulating electrode at the wrist. The logic goes: if the SNAP potential didn’t change amplitude post vs pre learning but the N20 did change amplitude then you can rule out that the N20 (cortical) change was due to some kind of peripheral change in the efficacy of the stimulating electrode at the wrist.
1.4 Control Group
To rule out that any post vs pre change in somatosensory cortical excitability may be due to motor output and not due to learning per se, you ran a second control group (N=15). Everything was the same except instead of practicing the same set of 5 finger sequences for 30 min, the control participants produced random finger movements for 30 min.
2 The Raw Data
There are 8 files per participant. For example for participant 0 the files are:
P0_sequence_times_pre.csv
P0_sequence_times_post.csv
P0_stim_pre.bin
P0_cp3_pre.bin
P0_snap_pre.bin
P0_stim_post.bin
P0_cp3_post.bin
P0_snap_post.bin
Each of the two .csv
files contains behavioural measures of the finger sequence task. The measure is time to complete each sequence (in seconds).
Each .bin
file contains the roughly 120 second recording of the signal indicated in the filename (each recording may be a different length). Signals were digitized at a rate of 5000 Hz.
The files called stim
contain a TTL (binary) signal which is 0 when there is no median nerve stimulation, and is 1 when the stimulator is delivering current.
The files called cp3
contain the EEG recording from electrode CP3, over left somatosensory cortex.
The files called snap
contain the recording from the SNAP electrode located above the median nerve near the right elbow.
The data are in binary format, encoded as 64-bit floating point values (little-endian encoding).
Here is a Python function to read in one of these data files and store the data in a Numpy array: