-
Notifications
You must be signed in to change notification settings - Fork 73
EEG and ERP Channel Operations
The Channel Operations tool allows you to compute new channels that are combinations of the channels in the current EEGset or ERPset. This is very much like the Bin Operations tool, which allows you to create new bins by recombining existing bins.
In ERPLAB Studio, this tool is accessed from the Channel Operations panel in the EEG tab or the ERP tab. In ERPLAB Classic, you will use ERPLAB > EEG Channel Operations or ERPLAB > ERP Operations > ERP Channel Operations. In ERPLAB Studio, some of the options are accessed using the Advanced button.
This tool is typically used to re-reference the data or to create a "virtual cluster" channel that is the average of a set of real channels. For example, you can use Channel Operations to compute bipolar vertical and horizontal EOG channels from the original monopolar EOG channels (which can improve artifact detection). Alternatively, you might want to re-reference each channel to the average of all the channels (excluding the artifact channels). Or you might want to create a channel that is the average of the Cz, CPz, and Pz electrode sites so that you can measure the N400 or P3b from this averaged channel.
Simple equations are used to define how a channel should be computed from the current dataset or ERPset. Imagine, for example, that channel 31 is an electrode above the right eye and channel 32 is an electrode below the right eye (both with the same reference). You could create a new bipolar VEOG channel by computing channel 32 minus channel 31 with the equation ch33 = ch32 - ch31 label VEOG. Similarly, if you had channels 10, 13, and 15 corresponding to Cz, CPz, and Pz, you could create a new channel 34 that is the average of these channels with the equation ch34 = (ch10 + ch13 + ch15) / 3 label VEOG (or the equation ch34 = .33333ch10 + .33333ch13 + .33333*ch15 label Centroparietal Cluster).
As in Bin Operations, you can save the equations in a text file and load them again later. This is accomplished in ERPLAB Studio with the SaveEQ and LoadEQ buttons, and it is accomplished in ERPLAB Classic using Save list, Save list as, and Load list.
Note for scripting: Ordinarily, the equations are sent to the Matlab function as a set of strings (a cell array). With a long list of equations, this will lead to a very complicated function call in your history. If you select the option for Send file rather than individual equations, the file will be sent instead of the equations, making the history simpler (which is convenient if you plan to turn the history into a script). But the same bin operations will be performed either way.
Channel Operations has two modes of operation. In Modify Existing ERPset or Modify Existing EEGset mode, the equations modify existing bins and/or add new bins within the current ERPset/EEGset. This mode is great for simple operations, like adding a new channel containing a difference between existing channels. However, it can lead to unexpected results if you are modifying an existing channel (because it operates "recursively"). Also, although you can add new channels with this mode, you cannot delete channels.
When you use this mode, the bin on the left side of each equation should be listed as "ch1 =" or "channel1 =" (as in the examples given above).
In Create New ERPset or Create New EEGset mode, the current ERPset/EEGset serves as the input to equations, and a new set of channels is created in a new ERPset/EEGset. This mode requires you to provide equations for all the channels you are creating, even if some of them are simply copies of the input bins. This mode is particularly useful for re-referencing most or all of your channels.
When you are creating a new ERPset/EEGset, each equation must begin with with "nch " or "newchan =" as a reminder that you are creating a new channel in a new ERPset or EEGset.
Channels must always be defined in ascending order, starting with Channel 1. For example, if you are creating a new ERPset, your first equation will begin with newchan1 =, your second equation will begin with newchan2 =, and so on.
When you are modifying an existing ERPset/EEGset, your list of equations does not need to re-define the existing channels. However, any new channels that are defined must occur in ascending order, and the result cannot have any missing channels. For example, if the current ERPset contains channels 1-10, you could have a list of equations like this:
- ch3 = ch1 – ch2 label Redefining channel 3 as a difference between ch1 and ch2
- ch11 = .5ch9 + .5ch10 label Create new channel 11 as the average of channels 9 and 10
- ch12 = ch10^2 label Create new channel 12 that is channel 10 squared
However, you could not have a list of equations that began with channel 12 (because channel 11 must be defined before channel 12) or a list in which channel 12 came before channel 11.
One of the main uses of Channel Operations is to re-reference EEG or ERP data (or to reference data that were recorded without a reference). Detailed examples are given in the section of the Studio Tutorial on re-referencing. That example involves re-referencing an ERPset, but the same principles apply to re-referencing an EEGset.
Re-referencing your electrodes will require you to create an equation for each channel being re-referenced. This could be a lot of equations. To make life easier (and reduce typos), Channel Operations contains a Reference assistant button that can create the equations for you. You simply specify what you want subtracted away from each channel, and which channels should be re-referenced, and it will fill in the appropriate equations. For details, see the section of the Studio Tutorial on re-referencing.
In ERPLAB Studio, you can delete channels using the Edit/Delete Channels & Locations panel (in either the EEG tab or the ERP tab).
In ERPLAB Classic, you can delete channels by clicking the Remove Channel(s) button in the Channel Operations GUI.
- Rectifying EMG
- Computing Global Field Power
- Computing Mahalanobis Distance
- Deleting Channels
- Adding Simulated Noise
If you have EMG data in channel 16, you could create a rectified version (absolute value) of the data in channel 17 as follows:
ch17 = abs(ch16) label Rect_EMG
To create a channel with the mean global field power of channels 1-13, you would use this equation (which works on ERPsets but not EEGsets):
ch14 = mgfperp(1:13) label MGFP
To create a channel with the mahalanobis distance between channels 1 and 2, you would use an equation like this:
ch17 = mahaleeg(ch1, ch2) label MAHAL
Users can add simulated white noise or pink noise to their EEG or ERP data using equations like these:
nch1 = ch1 + 2*whitenoise(1) label F3 plus white noise
nch2 = ch1 + 3*pinknoise(4) label F3 plus white noise
The whitenoise and pinknoise functions produce noise with a standard deviation of amplitude 1 µV. These can be multiplied by any value to change the amplitude of the noise. In the examples above, the white noise was multiplied by 2 to double the standard deviation of the noise to 2 µV, and the pink noise was tripled to a standard deviation of 3 µV. The value inside the parentheses is a “seed” for the random number generator (Click this link to see our explanation for how seeds work. ). By specifying a seed, you can get the same noise each time you run the equation. If you omit the seed (e.g., nch1 = ch1 + 2*whitenoise), a random seed will be used and you will get different noise each time you run the equation.
For adding simulated line noise (or any other kind of oscillation, such as alpha-band activity):
nch3 = ch1 + 2*linenoise(60, ‘random’, 1) label F3 plus random 60 Hz line noise
nch4 = ch1 + 2*linenoise(60, ‘fixed’, 30) label F3 plus fixed 60 Hz line noise
nch5 = ch1 + 2*linenoise(10) label F3 plus 10 Hz alpha activity
The linenoise function creates a sinusoidal waveform with peak voltages of ±1 µV (and therefore a peak-to-peak amplitude of 2 µV). The multiplier of 2 in the above example equations changes this to ±2 µV. The first value within the parentheses specifies the frequency in Hz (e.g., “60” for 60 Hz line noise). Users can then determine the phase shift of the frequency across trials or bins. In the first example, the phase shift across trials or bins will be ‘random’ using a seed of 1. You can omit the seed to use a random seed.
In the second example, there will be a ‘fixed’ phase shift on every trial or bin. The following number now represents the amount of phase shift in degrees (e.g.,the 30 in this example indicates a phase shift of 30 degrees). The third example shows that the linenoise equation can be used to simulate alpha waves at 10 Hz. When neither ‘fixed’ nor ‘random’ is specified, there will be a random phase shift between trials or bins using a random seed.
Equations can be added together to combine noise, like in this example:
nch1 = ch1 + 2*whitenoise(1) + 2*linenoise(60, ‘random’, 1) label F3 plus white noise and line noise