Skip to content

Commit

Permalink
Merge pull request #110 from fahrenfort/bugfixes
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
fahrenfort authored Jan 23, 2019
2 parents 285299f + 9fe999f commit a278429
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 24 deletions.
6 changes: 0 additions & 6 deletions eeg_mvpa/classify_RAW_eeglab_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ function classify_RAW_eeglab_data(filepath,filenames,outpath,nFolds,channelset,m
basis_sigma = 1; % default width of basis set if not a delta, if this is empty, do a simple basis set (delta function)
unbalance_events = false;
unbalance_classes = false;
detrend_eeg = false;
whiten = false;
whiten_test_using_train = false;
for c=1:numel(methods)
Expand Down Expand Up @@ -264,9 +263,6 @@ function classify_RAW_eeglab_data(filepath,filenames,outpath,nFolds,channelset,m
if any(strcmpi(methods{c},{'oversample'}))
unbalance_classes = false;
end
if any(strcmpi(methods{c},{'detrend','detrend_eeg'}))
detrend_eeg = true;
end
if any(strcmpi(methods{c},{'whiten'}))
whiten = true;
end
Expand Down Expand Up @@ -362,7 +358,6 @@ function classify_RAW_eeglab_data(filepath,filenames,outpath,nFolds,channelset,m
msettings.clean_data = clean_muscle;
msettings.clean_window = clean_window;
msettings.shuffle_trials = true;
msettings.detrend_eeg= detrend_eeg;
[FT_EEG(cFile), filenames{cFile}, chanlocs{cFile}] = read_raw_data(filepath,filenames{cFile},outpath,msettings);
% randomize labels for first level random permutation testing. NOTE: permuting all observations/labels regardless of the conditions in the experiment
if randomize_labels
Expand Down Expand Up @@ -622,7 +617,6 @@ function classify_RAW_eeglab_data(filepath,filenames,outpath,nFolds,channelset,m
settings.crossclass = crossclass;
settings.erp_baseline = erp_baseline;
settings.clean_window = clean_window;
settings.detrend_eeg = detrend_eeg;
settings.BDM = do_BDM;
settings.FEM = do_FEM;
settings.basis_set_sigma = basis_sigma;
Expand Down
6 changes: 0 additions & 6 deletions eeg_mvpa/classify_TFR_from_eeglab_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ function classify_TFR_from_eeglab_data(filepath,filenames,outpath,nFolds,channel
basis_sigma = 1; % default width of basis set if not a delta, if this is empty, do a simple basis set (delta function)
unbalance_events = false;
unbalance_classes = false;
detrend_eeg = false;
whiten = false;
whiten_test_using_train = false;
for c=1:numel(methods)
Expand Down Expand Up @@ -261,9 +260,6 @@ function classify_TFR_from_eeglab_data(filepath,filenames,outpath,nFolds,channel
if any(strcmpi(methods{c},{'oversample'}))
unbalance_classes = false;
end
if any(strcmpi(methods{c},{'detrend','detrend_eeg'}))
detrend_eeg = true;
end
if any(strcmpi(methods{c},{'whiten'}))
whiten = true;
end
Expand Down Expand Up @@ -350,7 +346,6 @@ function classify_TFR_from_eeglab_data(filepath,filenames,outpath,nFolds,channel
msettings.clean_data = clean_muscle;
msettings.clean_window = clean_window;
msettings.shuffle_trials = true;
msettings.detrend_eeg= detrend_eeg;
[FT_EEG(cFile), filenames{cFile}, chanlocs{cFile}] = read_raw_data(filepath,filenames{cFile},outpath,msettings);
% randomize labels for first level random permutation testing. NOTE: permuting all observations/labels regardless of the conditions in the experiment
if randomize_labels
Expand Down Expand Up @@ -660,7 +655,6 @@ function classify_TFR_from_eeglab_data(filepath,filenames,outpath,nFolds,channel
settings.erp_baseline = erp_baseline;
settings.tf_baseline = tf_baseline;
settings.clean_window = clean_window;
settings.detrend_eeg = detrend_eeg;
settings.BDM = do_BDM;
settings.FEM = do_FEM;
settings.basis_set_sigma = basis_sigma;
Expand Down
6 changes: 0 additions & 6 deletions eeg_mvpa/read_raw_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
% Johannes Fahrenfort, VU 2016, 2017, 2018

% set some defaults
detrend_eeg = false;
shuffle_trials = false;
clean_window = [];
clean_data = false;
Expand Down Expand Up @@ -74,11 +73,6 @@
error(['The following required fields are missing from your data: ' cell2csv(absentfields,true)]);
end

% detrend eeg
if detrend_eeg
FT_EEG = detrend_FT_EEG(FT_EEG);
end

% keep track of index numbers
origindex = 1:numel(FT_EEG.trialinfo);
% muscle artifact detection
Expand Down
4 changes: 1 addition & 3 deletions eeg_preprocessing/adam_detrend_and_epoch.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ function adam_detrend_and_epoch(cfg)
% and writes out as EPOCHED (!) EEGLAB file. Note that the data are high-pass filtered early on to
% identify faulty electrodes, but that the highpass filtered data is discarded after identifying
% these electrodes. Polynomial detrending is applied to remove drifts in raw data. Faulty
% electrodes are interpolated back in after detrending. filenames: names of files either in a cell
% array or as comma separated string. Wildcards * and ? can be used, e.g. filenames = '*' will take
% all the .set files in the input filepath as sources. The output of this function can serve as
% electrodes are interpolated back in after detrending. The output of this function can serve as
% input for ADAM_MVPA_FIRSTLEVEL.
%
% cfg.datadir = string specifiying the directory where the input files are
Expand Down
5 changes: 3 additions & 2 deletions eeg_preprocessing/detrend_and_epoch.m
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ function detrend_and_epoch(datadir,filename,outputdir, start_epoch, end_epoch, p
end

%% save
% save([outputdir filesep fname '.mat'],'DETRENDED_FT_EEG');
% as EEGLAB file
% can also save as FT_EEG if that is preferred:
% save([outputdir filesep fname '.mat'],'DETRENDED_FT_EEG');
% OR as EEGLAB file
pop_saveset(EEG, 'filename',[fname '.set'],'filepath',outputdir);
2 changes: 1 addition & 1 deletion eeg_preprocessing/pop_exportepoch.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
events(cEvents,1) = event;
pointlatency = EEG.event(cEvents).latency; % expressed in samples (!!!!)
% eventlatency = round(pointlatency/EEG.srate*1000);
eventlatency = round(EEG.times(round(pointlatency))); % expressed in ms. :-)
eventlatency = EEG.times(round(pointlatency)); % expressed in ms. :-)
events(cEvents,2) = eventlatency;
end
else % extracting only epoched events that occur at time zero of each epoch, without time stamp
Expand Down

0 comments on commit a278429

Please sign in to comment.