Skip to content

Commit

Permalink
Visual gating update
Browse files Browse the repository at this point in the history
Merge branch 'main' of https://github.com/DouweHorsthuis/EEG_to_ERP_pipeline_stats_R

# Conflicts:
#	src/B_downs_filter_chaninfo_exclchan.m
  • Loading branch information
DouweHorsthuis committed Oct 21, 2021
2 parents 24e14f3 + 8aa0e68 commit ff3b70b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Douwe John"
given-names: "Horsthuis"
- family-names: "Ana Alves"
given-names: "Francisco"
title: "EEG_to_ERP_pipeline_stats_R"
version: 2.0
doi: 10.5281/zenodo.5584698
date-released: 2021-10-20
url: "https://github.com/DouweHorsthuis/EEG_to_ERP_pipeline_stats_R"
46 changes: 46 additions & 0 deletions src/B_downs_filter_chaninfo_exclchan.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
% Combination of EEGLAB downsample and filter, and reject channel script by Ana on 2017-07-11
% Combined and updated by Douwe Horsthuis last update 6/21/2021
% ------------------------------------------------

% This defines the set of subjects
subject_list = {'some sort of ID' 'a different id for a different particpant'};
eeglab_location = 'C:\Users\wherever\eeglab2019_1\'; %needed if using a 10-5-cap
scripts_location = 'C:\\Scripts\'; %needed if using 160channel data
% Path to the parent folder, which contains the data folders for all subjects
home_path = 'the main folder where you store your data';
% Loop through all subjects
for s=1:length(subject_list)
fprintf('\n******\nProcessing subject %s\n******\n\n', subject_list{s});
data_path = [home_path subject_list{s} '\\'];
% Load original dataset (created by previous script)
fprintf('\n\n\n**** %s: Loading dataset ****\n\n\n', subject_list{s});
EEG = pop_loadset('filename', [subject_list{s} '.set'], 'filepath', data_path);
EEG = eeg_checkset( EEG );
%downsample
EEG = pop_resample( EEG, 256); %downsample to 256hz
EEG = eeg_checkset( EEG );
%filtering
EEG = pop_eegfiltnew(EEG, [],1,1690,1,[],1); % 1hz filter
EEG.filter_1 = [1, 1690]; %add here the same info as above, so it's saved in the EEG structure
EEG = eeg_checkset( EEG );
EEG = pop_eegfiltnew(EEG, [],45,152,0,[],1); %45hz filter
EEG.filter_2 = [45,152]; %add here the same info as above, so it's saved in the EEG structure
EEG = eeg_checkset( EEG );
EEG = pop_saveset( EEG, 'filename',[subject_list{s} '_downft.set'],'filepath', data_path);
%adding channel location
if EEG.nbchan >63 && EEG.nbchan < 95 %64chan cap (can be a lot of externals, this makes sure that it includes a everything that is under 96 channels, which could be an extra ribbon)
EEG=pop_chanedit(EEG, 'lookup',[eeglab_location 'plugins\dipfit\standard_BESA\standard-10-5-cap385.elp']); %make sure you put here the location of this file for your computer
EEG = pop_saveset( EEG, 'filename',[subject_list{s} '_info.set'],'filepath', data_path);
%deleting bad channels
EEG = pop_rejchan(EEG,'elec', [1:64],'threshold',5,'norm','on','measure','kurt');
elseif EEG.nbchan >159 && EEG.nbchan < 191 %160chan cap
EEG=pop_chanedit(EEG, 'lookup',[scripts_location 'BioSemi160.sfp']); %make sure you put here the location of this file for your computer
EEG = pop_saveset( EEG, 'filename',[subject_list{s} '_info.set'],'filepath', data_path);
%deleting bad channels
EEG = pop_rejchan(EEG,'elec', [1:160],'threshold',5,'norm','on','measure','kurt');
end
%adding info to the EEG structure

EEG = pop_saveset( EEG, 'filename',[subject_list{s} '_exchn.set'],'filepath', data_path);
end

0 comments on commit ff3b70b

Please sign in to comment.