Skip to content

Commit

Permalink
Same changes as for RELAX_Wrapper_beta
Browse files Browse the repository at this point in the history
Adjusted to provide warning to user if electrode rejections meet or exceed the user set threshold.
  • Loading branch information
NeilwBailey authored Nov 22, 2022
1 parent 597533b commit 68880fe
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions RELAX_Wrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
% avoid adding temporal dependencies to the data, unlike filtering
% approaches).

% de Cheveigné, A., & Arzounian, D. (2018). Robust detrending, rereferencing, outlier detection, and inpainting for multichannel data. NeuroImage, 172, 903-912.
% de Cheveigné, A., & Arzounian, D. (2018). Robust detrending, rereferencing, outlier detection, and inpainting for multichannel data. NeuroImage, 172, 903-912.

% Use TESA to apply butterworth filter:
EEG = RELAX_filtbutter( EEG, RELAX_cfg.LineNoiseFrequency-3, RELAX_cfg.LineNoiseFrequency+3, 2, 'bandstop' );
Expand Down Expand Up @@ -399,7 +399,7 @@
if isfield(EEG.RELAX, 'eyeblinkmask') % if eyeblinkmask has been created, do the following (thanks to Jane Tan for the suggested bug fix when eyeblinkmask is not created)
EEG.RELAX=rmfield(EEG.RELAX,'eyeblinkmask'); % remove variables that are no longer necessary
end
EEG.RELAX=rmfield(EEG.RELAX,'ExtremeEpochsToIgnoreInMuscleDetectionStep'); % remove variables that are no longer necessary

EEG.RELAXProcessingRoundThree=EEG.RELAXProcessing; % Record MWF cleaning details from round 3 in EEG file
RELAXProcessingRoundThree=EEG.RELAXProcessing; % Record MWF cleaning details from round 3 into file for all participants

Expand Down Expand Up @@ -518,14 +518,14 @@
end
if (EEG.RELAXProcessingExtremeRejections.NumberOfMuscleContaminatedChannelsRecomendedToDelete...
+EEG.RELAXProcessingExtremeRejections.NumberOfExtremeNoiseChannelsRecomendedToDelete...
+size(EEG.RELAXProcessingExtremeRejections.PREPBasedChannelToReject,2))...
>RELAX_cfg.MaxProportionOfElectrodesThatCanBeDeleted*size(EEG.allchan,2)
EEG.RELAX_issues_to_check.ElectrodeRejectionRecommendationsExceededThreshold=...
+size(EEG.RELAXProcessingExtremeRejections.PREPBasedChannelToReject,1))...
>=RELAX_cfg.MaxProportionOfElectrodesThatCanBeDeleted*size(EEG.allchan,2)
EEG.RELAX_issues_to_check.ElectrodeRejectionRecommendationsMetOrExceededThreshold=...
(EEG.RELAXProcessingExtremeRejections.NumberOfMuscleContaminatedChannelsRecomendedToDelete...
+EEG.RELAXProcessingExtremeRejections.NumberOfExtremeNoiseChannelsRecomendedToDelete...
+size(EEG.RELAXProcessingExtremeRejections.PREPBasedChannelToReject,2));
+size(EEG.RELAXProcessingExtremeRejections.PREPBasedChannelToReject,1));
else
EEG.RELAX_issues_to_check.ElectrodeRejectionRecommendationsExceededThreshold=0;
EEG.RELAX_issues_to_check.ElectrodeRejectionRecommendationsMetOrExceededThreshold=0;
end
if EEG.RELAXProcessingExtremeRejections.ProportionExcludedForExtremeOutlier>0.20
EEG.RELAX_issues_to_check.HighProportionExcludedAsExtremeOutlier=EEG.RELAXProcessingExtremeRejections.ProportionExcludedForExtremeOutlier;
Expand Down Expand Up @@ -633,7 +633,7 @@
end

set(groot, 'defaultAxesTickLabelInterpreter','none');
if exist('CleanedMetrics','var')
if RELAX_cfg.computecleanedmetrics==1
try
figure('Name','BlinkAmplitudeRatio','units','normalized','outerposition',[0.05 0.05 0.95 0.95]);
boxplot(CleanedMetrics.BlinkAmplitudeRatio);
Expand Down Expand Up @@ -667,6 +667,15 @@
warning('You instructed RELAX to clean more files than were in your data folder. Check all your expected files were there?');
end

if find(RELAX_issues_to_check.ElectrodeRejectionRecommendationsMetOrExceededThreshold>0)>0
f = msgbox('Some files met or exceeded the electrode rejection threshold. We recommend visually inspecting the raw and cleaned files where this is the case. Open the "RELAX_issues_to_check" struct in the workspace, and check the third column. Files that exceeded the threshold will show a value above 0. Exclude files where raw data seems irretrievably noisy, or cleaned data still contains excessive noise.'...
,'Some files met or exceeded the electrode rejection threshold');
set(f,'Position',[300,300,450,150]);
ah = get( f, 'CurrentAxes' );
ch = get( ah, 'Children' );
set( ch, 'FontSize', 12 ); %makes text bigger
end

toc
%% POTENTIAL IMPROVEMENTS THAT COULD BE MADE:
% 1) work out a way to threshold horizontal eye movements so the script
Expand Down

0 comments on commit 68880fe

Please sign in to comment.