|
|
[[_TOC_]]
|
|
|
|
|
|
# Diagnostics
|
|
|
Throughout the pipeline the scripts make many decisions that result in marks on both channels and time segments. The criteria for these decisions is laid out in the configuration files, and the results and the intermediate stages are saved in the EEG structure. These matrices can be easily access and plotted to get a visual representation of what is happening.
|
|
|
Throughout the pipeline the scripts make many decisions that result in marks on both channels and time segments. The criteria for these decisions are laid out in the configuration files, and the results and the intermediate stages are saved in the EEG structure. These matrices can be easily access and plotted to get a visual representation of what is happening.
|
|
|
|
|
|
To visualise some of the choices that were made in the pipeline either create your own plotting functions, or try running the diagnotics script.
|
|
|
|
|
|
# Using the Diagnostics Script
|
|
|
Open up a EEG dataset that has complete the dipfit stage of the pipeline. Most typically these will have the ending *_dip.set.*
|
|
|
Make sure that the diagnostics.m file is on the MATLAB path.
|
|
|
In the matlab editor call the diagnostics function in the MATLAB editor:
|
|
|
Open up a EEG dataset that has complete the dipfit stage of the pipeline to get all of the available figures. Most typically these will have the ending *_dip.set.* Make sure that the diagnostics.m file is on the MATLAB path. In the matlab editor call the diagnostics function in the MATLAB editor:
|
|
|
```
|
|
|
diagnostics
|
|
|
```
|
|
|
By typing the function name you are calling the diagnostics script. This function does not contain any input values but directly starts accessing your loaded dataset. Figures will be generated and you can browse them as you would like. The figures contain some visual representations of the calculations that are being preformed, and on the quality of the data file. Follow along below for a more in depth view of some of the figures
|
|
|
By typing the function name you are calling the diagnostics script. This function does not contain any input values but directly starts accessing your loaded dataset. Figures will be generated and you can browse them as you would like. The figures contain some visual representations of the calculations that are being preformed based on the quality of the data file. Follow along below for a more in depth view of some of the figures.
|
|
|
|
|
|
**Data Quality**
|
|
|
The first plot is a general overview of how much good data has been found in your data set. If the % of time and the % of channels of your data is very high you might want to reconsider your experiment modality. From the figure below:
|
|
|
|
|
|

|
|
|
|
|
|
Looking into this further you can see from the editor printout that their is:
|
|
|
Looking into this example further you can see from the editor printout that there is:
|
|
|
* 41 bad channels out of 135
|
|
|
* ~21% of data time flagged as bad
|
|
|
|
|
|
The designation of *Bad* is based off a few simple calculations which parameters are controlled by the configuration files. We will look at these calculations in more detail below.
|
|
|
The designation of *Bad* is based off a few simple calculations which parameters are controlled by the configuration files. We will look at these calculations in more detail below, and go through which configs parameters change each of the criteria.
|
|
|
|
|
|

|
|
|
|
|
|
*As a side Note is is possible but not likely for a channel to be flagged for more than one of these classifications. This would mean diagnostics will find high numbers of bad channels but a lower number of removals.*
|
|
|
*As a side Note is is possible but not likely for a channel to be flagged for more than one of these classifications. This would mean diagnostics will find high numbers of bad channels but a lower number of removals. Make sure you look at the printout in the editor.*
|
|
|
|
|
|
*Channel Flags*
|
|
|
Channel flags are the way that channels are identified and staged for removal. A few examples of cahnnel flag calculations are:
|
|
|
**Channel Flags**
|
|
|
Channel flags are the way that channels are identified and staged for removal. A few examples of channel flag calculations are:
|
|
|
* Standard Deviation (Comicaly Bad)
|
|
|
* High correlation (Bridging)
|
|
|
* Low Correlation
|
|
|
|
|
|
Diagnostics will present the data for the Standard Deviation and the Low correlation. At the moment the Bridging analysis is not saved to the EEG structure.
|
|
|

|
|
|
|
|
|
The figures below are separated into 3 sub figures to show how the calculations are done.
|
|
|
For example lets review the Standard deviation plot (Figure: 4) subplots from left to right.
|
|
|
* Sub Figure 1
|
|
|
This figure are the raw standard deviation values for each channels for every epoch of time. The colour represents how much deviation there is at the point. In this particular case the red colour means there is a high deviation and the blue means lower.
|
|
|
This figure is the raw standard deviation values for each channels for every epoch of time. The colour represents the magnitude of the deviation there is at each of these time points. In this particular case the dark red colour means there is a high deviation and the blue means lower, but the exact colouring will depend on your matlab plot settings.
|
|
|
* Sub Figure 2
|
|
|
This plot expands on thevalues from the first subfigure. In this plot only the bvery highest values are slected on ploted as a 0 or 1. In this particular case blue means that the designated epoch was not over the specified criteria for time removal.
|
|
|
This plot expands on the values from the first sub figure. In this plot only the very highest values are selected from plot 1 and plotted as a 0 or 1. In this particular case blue means that the designated epoch was not over the specified criteria. You can adjust the criteria of the flagging by adjusting variables:
|
|
|
* ```[sd_chan_z] ``` for standard deviation. Default is 2.326 deviation, a higher number will produce less marks, lower will flag more.
|
|
|
* ```[r_chan_z]``` for correlations. Default is 2.326, a higher number will produce less marks, lower will flag more.
|
|
|
* Sub Figure 3
|
|
|
The third plot uses the results from the second plot. It adds up the marks for each of the channels and finds the % of teach channel that was flagged. Looking at the example below the red segment had a high deviation, and produced a high % of the channel being covered in flags. This causes the waveform on the right to peak at this channel. This peak crosses the threshold vertical line, meaning the channel has to much time in which it is comically bad. The criteria line can be adjusted left and right to allow for more or less acceptable deviation. You can adjust the criteria of the flagging by adjusting variables like:
|
|
|
* ```[sd_chan_p] ``` for standard deviation. Default is 0.1(10%) of the channel flagged with the ```[sd_chan_z] ``` mark, a higher number will make the % required larger and thus less channels will be flagged.
|
|
|
* ```[r_chan_p]``` for correlations. Default is 0.1(10%)of the channel flagged with the ```[r_chan_z] ``` mark, a higher number will make the % required larger and thus less channels will be flagged.
|
|
|
|
|
|
***
|
|
|
|
|
|
* Example 1:
|
|
|
* ```[sd_chan_p],2.236 ``` to ```[sd_chan_p],2 ```
|
|
|
* ```[sd_chan_z],0.1 ``` to ```[sd_chan_z],0.5 ```
|
|
|
This would lower the criteria for making the flags, and lower the amount that each channel needs to be flagged in order to marked as comically bad. This would flag more channels, and do **more removals** - potentially cleaning the data more.
|
|
|
|
|
|
* Example 2:
|
|
|
* ```[sd_chan_p],2.236 ``` to ```[sd_chan_p],3 ```
|
|
|
* ```[sd_chan_z],0.1 ``` to ```[sd_chan_z],0.2```
|
|
|
This would increase the criteria for making the flags, and increase the amount that each channel needs to be flagged in order to marked as comically bad. This would flag less channels, and do **less removals** - potentially reducing the data quality.
|
|
|
|
|
|

|
|
|
|
|
|
**Red:** High deviation is visible, many flags are made, channels are over the % criteria and are marked for removal.
|
|
|
**Orange:** Some deviation is visible, some flags are made, channel is just over the % criteria and will be marked for removal. An adjustment to the criteria could swing this channel to be kept if needed.
|
|
|
**Yellow:** Little deviation is visible, no flags are made, channels are under the % criteria and not marked.
|
|
|
**Green:** The % criteria threshold. Any channel that peaks past this line will be marked for removal. As indicated this line can be moved based on your goals.
|
|
|
|
|
|
*Time Flags*
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
*Component Classification*
|
|
|
|
|
|

|
|
|
|
|
|
#Creating your own plotting functions
|
|
|
|
|
|
We are currently working on this section of the Wiki.
|
... | ... | |