1

CBU Matlab untilities for pre-screeining your data.

These tools will provide some basic descriptive stats values for your raw data files. Their purpose is to monitor data quality, detect major artefacts, and to compare different pre-processing strategies (e.g. different parameters in maxfilter).

For example, maximum signal differences within successive time windows of pre-specified length (let's say 5s) can be computed, and visualised for all channels over time as a colour matrix. This will allow you to identify time ranges and channels that show excessively large amplitude variations. Similar measures can be computed in the frequency domain or for signal covariances.

The corresponding Matlab scripts are easy to use. Individual results are output as jpg- and mat-files, and summarised as html-files that can be viewed in web-browsers.

If you want to use these tools, contact olaf.hauk@mrc-cbu.cam.ac.uk


This could be a script to run your data scan. You should add /imaging/olaf/MEG/artefact_scan_tool to your Matlab search path (sorry, no subversion yet). If sucessfull, you can look at the results in "out_dir" using an html-browser (Internet Explorer, Mozilla Firefox etc.).

global fiffs tasks values criteria sensors datapara figs;

ini_check4artefacts; % Initialisation of variables

%%% VALUES TO BE EDITED BELOW %%%

% Directory for graphical OUTPUT (jpg/html/fig)

out_dir = '/whateveryouroutputdir';

epochlength = 5; % data will be analysed in successive epoch of this length

% Max-Min amplitude threshold in femto Tesla for magnetometers

amplitude_threshold_mag = 5000; % only necessary when 'threshold' option is used below

% Max-Min amplitude threshold in pico Tesla/m (?) for gradiometers

amplitude_threshold_gra = 10000; % only necessary when 'threshold' option is used below

% INPUT fiff-files to be processes, plut IDENTIFIER for output file names addfiff('/whateveryourpath/yourfile.fif', 'meg_001_1');

addfiff('/whateveryourpath/yourfile.fif', 'meg_001_2');

addfiff('/whateveryourpath/yourfile.fif', 'meg_001_2');

% Possible TASKS to be applied to data:

addtask('FFT'); % log Fourier amplitude spectra

addtask('maxminamp'); % max-min amplitudes

addtask('crosscorr'); % cross-correlation matrices

% addtask('threshold'); % number of epochs with max-min amplitudes above specified threshold

% addtask('maxmingrad'); % number of epochs with temporal gradients above specified threshold

% addtask('trendamp'); % linear trend in amplitudes

% addtask('trendgrad'); % linear trend in temporal gradients

%%%%%%%%%%%%%%% VALUES TO BE EDITED ABOVE %%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

check4artefacts; % This starts the analysis