Back to the main page.

Bug 3414 - tutorial on ECoG analysis not working, issue with ft_timelockbaseline

Status CLOSED FIXED
Reported 2018-02-26 15:46:00 +0100
Modified 2018-03-02 14:56:30 +0100
Product: FieldTrip
Component: documentation
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

- 2018-02-26 15:46:53 +0100

When running the tutorial for ECoG data processing (or when analyzing my own data), running the line ft_timelockbaseline removes several fields that are crucial for easy plotting using ft_singleplotER later on. I'm fairly certain this used to work in October. % load trial info load('NY394_trl.mat'); % load and segment data cfg = []; cfg.dataset = 'NY394_VisualLoc_R1.edf'; cfg.trl = trl; % from NY394_trl.mat cfg.continuous = 'yes'; epoch_data = ft_preprocessing(cfg); % skipped trial selection, not useful here, but got the bug when I ran it for % safety cfg = []; cfg.channel = 'EEG*'; % select 'EEG' channles epoch_data_clean = ft_selectdata(cfg,epoch_data); % calculate ERPs cfg = []; cfg.keeptrials = 'yes'; % keep trials for statistics cfg.preproc.lpfilter = 'yes'; cfg.preproc.lpfreq = 30; % smooth ERP with low-pass filter cfg.preproc.hpfilter = 'yes'; cfg.preproc.hpfreq = 1; % reduce slow drifts cfg.preproc.detrend = 'yes'; cfg.trials = find(epoch_data_clean.trialinfo == 3); % select only 'object' trials (event code 3) ERP_object = ft_timelockanalysis(cfg, epoch_data_clean); cfg.trials = find(epoch_data_clean.trialinfo == 7); % select only 'face' trials (event code 7) ERP_face = ft_timelockanalysis(cfg, epoch_data_clean); % baseline correction cfg = []; cfg.baseline = [-.3 -.05]; ERP_object_bl = ft_timelockbaseline(cfg,ERP_object); ERP_face_bl = ft_timelockbaseline(cfg,ERP_face); cfg = []; cfg.parameter = 'avg'; cfg.xlim = [-.3 .6]; cfg.channel = 'EEG IO_03-REF'; % other responsive channels: 'EEG PT_04-REF', 'EEG IO_02-REF', 'EEG IO_04-REF', 'EEG SO_01-REF', 'EEG SO_02-REF''EEG SO_03-REF' figure, ft_singleplotER(cfg,ERP_object_bl,ERP_face_bl) % this bugs. Best, Daphné Rimsky-Robert


Jan-Mathijs Schoffelen - 2018-02-28 09:27:22 +0100

This now fails, because the data structures that contain the single trial ERP (constructed as per cfg.keeptrials = 'yes' when calling ft_timelockanalysis) now only still contains a 'trial'-field, and no 'avg'-field anymore. This is intended, because it makes the data representation more internally consistent. doing something like this should solve it: cfg = []; cfg.avgoverrpt = 'yes'; ERP_object_bl_avg = ft_selectdata(cfg, ERP_object_bl); etc. and use cfg.parameter = 'trial' when calling ft_singleplotER


Jan-Mathijs Schoffelen - 2018-02-28 09:35:08 +0100

I have updated the tutorial.


Jan-Mathijs Schoffelen - 2018-03-02 14:56:30 +0100

.