[Eeglablist] Excluding channels in clean_artifacts

Beach, Paul paul.anthony.beach at emory.edu
Wed Jan 12 16:59:41 PST 2022


Thanks for the suggested code, Cedric. Had to tweak a few things as I have two ECG channels, but overall it works great!

Cheers

On Jan 12, 2022, at 1:47 PM, Cedric Cannard <ccannard at protonmail.com<mailto:ccannard at protonmail.com>> wrote:

Hi Paul,

You do Scott's suggesiton like this for example:

ECGchannel = 5;     %input ECG channel number here

ecg = EEG.data(ECGchannel,:);  %save a copy of ECG data
EEG = pop_select(EEG, 'nochannel',{EEG.chanlocs(ECGchannel).labels}); %remove ECG channel
EEG = pop_clean_rawdata(EEG, 'FlatlineCriterion','off','ChannelCriterion','off','LineNoiseCriterion','off','Highpass','off' ,'BurstCriterion',20,'WindowCriterion',0.25,'BurstRejection','on','Distance','Euclidian','WindowCriterionTolerances',[-Inf 7] );
EEG.data(end+1,:) = ecg; %put ECG data back after cleaning
EEG.chanlocs(end+1).labels = 'ECG';     %Put ECG channel name back
EEG = eeg_checkset(EEG); %check EEGLAB structure is correct
pop_eegplot(EEG,1,1,1)  %plot to check (Display>remove DC offset)

Don't forget to change the parameters of pop_clean_rawdata with what you want.

Cedric


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, January 11, 2022 5:14 PM, Beach, Paul via eeglablist <eeglablist at sccn.ucsd.edu<mailto:eeglablist at sccn.ucsd.edu>> wrote:

I’m anxiously awaiting the new functionality for clean_artifacts! And thanks for the suggestion, Scott. At first glance that may be a bit above my ability (namely the “copy the results back into the original dataset” bit). Is there a way to more simply save the ECG channel as a separate variable, remove it, run clean_artifacts, then append it back to the EEG structure? A simple way like this could also be applied to other functions that don’t have ‘exclude’ options (such as the fmrib plugin, which I use for pulse artifact removal).

Cheers
Paul

On Jan 8, 2022, at 3:42 PM, Scott Makeig <smakeig at gmail.commailto<mailto:smakeig at gmail.commailto>:smakeig at gmail.com<mailto:smakeig at gmail.com>> wrote:

Paul -

While waiting for Arno to add the 'exclude channels' option, you could remove the ECG channels from the data and save to a new dataset, run the clean_artifacts function on the remaining data, then copy the results back into the original dataset. This seems a kludgy solution, but not unlike what the new option will likely do, internally...

Scott

On Fri, Jan 7, 2022 at 1:10 PM Beach, Paul via eeglablist <eeglablist at sccn.ucsd.edumailto<mailto:eeglablist at sccn.ucsd.edumailto>:eeglablist at sccn.ucsd.edu<mailto:eeglablist at sccn.ucsd.edu>> wrote:

Hi EEGLAB’ers,

I’m curious whether there’s an easy way in which one might be able to exclude particular channels from clean_artifacts?

I’m interested in not applying it to ECG channels as it looks like it’s occasionally causing issues with their morphology. It doesn’t look like there’s an explicit ‘exclude’ option, such as in re-referencing or other commands.

Thanks!

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Paul Beach DO, PhD
PGY6, Movement Disorder Fellow
Department of Neurology
Emory University School of Medicine

Eeglablist page: https://urldefense.proofpoint.com/v2/url?u=https-3A__nam11.safelinks.protection.outlook.com_-3Furl-3Dhttp-253A-252F-252Fsccn.ucsd.edu-252Feeglab-252Feeglabmail.html-26amp-3Bdata-3D04-257C01-257Cpaul.anthony.beach-2540emory.edu-257C72d618f8a1f74f43666d08d9d5fbfe9f-257Ce004fb9cb0a4424fbcd0322606d5df38-257C0-257C0-257C637776100570872222-257CUnknown-257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0-253D-257C3000-26amp-3Bsdata-3DNh-252BGAwOv71ZrSFLO2mg-252BWaTPWpMmxZ57XVOKGeOUoFE-253D-26amp-3Breserved-3D0&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=2HUgH4ZMDbs8AETB7WJnb6_JcYwZWAvO2eaeV71oVu8k8qdIvNgxwx1Dg41aOrUB&s=i1271bfPeBPpjZlHsPiV411F2z9pWUXPfOUkitAUx4U&e= <https://urldefense.proofpoint.com/v2/url?u=https-3A__nam11.safelinks.protection.outlook.com_-3Furl-3Dhttps-253A-252F-252Furldefense.proofpoint.com-252Fv2-252Furl-253Fu-253Dhttps-2D3A-5F-5Fnam11.safelinks.protection.outlook.com-5F-2D3Furl-2D3Dhttp-2D253A-2D252F-2D252Fsccn.ucsd.edu-2D252Feeglab-2D252Feeglabmail.html-2D26data-2D3D04-2D257C01-2D257Cpaul.anthony.beach-2D2540emory.edu-2D257Ca7a4b15d6507450bb17608d9d2e76b5c-2D257Ce004fb9cb0a4424fbcd0322606d5df38-2D257C0-2D257C0-2D257C637772713656973096-2D257CUnknown-2D257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0-2D253D-2D257C3000-2D26sdata-2D3DZc9x7zGfPkLWMVykQNmlHb5O7tPOD6EKKwmFwruoNrA-2D253D-2D26reserved-2D3D0-2526d-253DDwIGaQ-2526c-253D-2D35OiAkTchMrZOngvJPOeA-2526r-253DkB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE-2526m-253D39s-2DTv5nrl7-2DimmF-2DxNMQzvVnUBmdCYeSGeb-2DUkm3zFf-5FrK1B-2D-5FmjjNGDQ9dvPVN-2526s-253Dsd4uzWqLfR9vN015cBU0NIdsAGoUM1OU-2D2IdhG-2DZwWs-2526e-253D-26amp-3Bdata-3D04-257C01-257Cpaul.anthony.beach-2540emory.edu-257C72d618f8a1f74f43666d08d9d5fbfe9f-257Ce004fb9cb0a4424fbcd0322606d5df38-257C0-257C0-257C637776100570872222-257CUnknown-257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0-253D-257C3000-26amp-3Bsdata-3D9hfw59D4F8YE1eQP0xfp8ez5T0T3KZuAId54x0gAmKk-253D-26amp-3Breserved-3D0&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=2HUgH4ZMDbs8AETB7WJnb6_JcYwZWAvO2eaeV71oVu8k8qdIvNgxwx1Dg41aOrUB&s=xyre6lEevp4zpTHhaorYwr6nQnnX21FpH2r_rNNFmo0&e=  >
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edumailto<mailto:eeglablist-unsubscribe at sccn.ucsd.edumailto>:eeglablist-unsubscribe at sccn.ucsd.edu<mailto:eeglablist-unsubscribe at sccn.ucsd.edu>
For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edumailto<mailto:eeglablist-request at sccn.ucsd.edumailto>:eeglablist-request at sccn.ucsd.edu<mailto:eeglablist-request at sccn.ucsd.edu>

--

Scott Makeig, Research Scientist and Director, Swartz Center for Computational Neuroscience, Institute for Neural Computation, University of California San Diego, La Jolla CA 92093-0559, https://urldefense.proofpoint.com/v2/url?u=https-3A__nam11.safelinks.protection.outlook.com_-3Furl-3Dhttp-253A-252F-252Fsccn.ucsd.edu-252F-7Escott-26amp-3Bdata-3D04-257C01-257Cpaul.anthony.beach-2540emory.edu-257C72d618f8a1f74f43666d08d9d5fbfe9f-257Ce004fb9cb0a4424fbcd0322606d5df38-257C0-257C0-257C637776100570872222-257CUnknown-257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0-253D-257C3000-26amp-3Bsdata-3DDbI0FMwsI3E1QzLthQgH3E14JPz-252BXhOT-252FQ5gtdMbxFw-253D-26amp-3Breserved-3D0&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=2HUgH4ZMDbs8AETB7WJnb6_JcYwZWAvO2eaeV71oVu8k8qdIvNgxwx1Dg41aOrUB&s=_IYSDX6LINw0_N165a9amNIC6So1zZZz5NmXXkWMZTs&e= <https://urldefense.proofpoint.com/v2/url?u=https-3A__nam11.safelinks.protection.outlook.com_-3Furl-3Dhttps-253A-252F-252Furldefense.proofpoint.com-252Fv2-252Furl-253Fu-253Dhttps-2D3A-5F-5Fnam11.safelinks.protection.outlook.com-5F-2D3Furl-2D3Dhttp-2D253A-2D252F-2D252Fsccn.ucsd.edu-2D252F-2D7Escott-2D26data-2D3D04-2D257C01-2D257Cpaul.anthony.beach-2D2540emory.edu-2D257Ca7a4b15d6507450bb17608d9d2e76b5c-2D257Ce004fb9cb0a4424fbcd0322606d5df38-2D257C0-2D257C0-2D257C637772713656973096-2D257CUnknown-2D257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0-2D253D-2D257C3000-2D26sdata-2D3DWVlQjMEAxD17WbKf3rO7pRZJib8JQd0CavtvyW2rvvw-2D253D-2D26reserved-2D3D0-2526d-253DDwIGaQ-2526c-253D-2D35OiAkTchMrZOngvJPOeA-2526r-253DkB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE-2526m-253D39s-2DTv5nrl7-2DimmF-2DxNMQzvVnUBmdCYeSGeb-2DUkm3zFf-5FrK1B-2D-5FmjjNGDQ9dvPVN-2526s-253DrQuadPh65u3nIuKeFi4gSf9goJfAmQR0RIgwoPhVwmA-2526e-253D-26amp-3Bdata-3D04-257C01-257Cpaul.anthony.beach-2540emory.edu-257C72d618f8a1f74f43666d08d9d5fbfe9f-257Ce004fb9cb0a4424fbcd0322606d5df38-257C0-257C0-257C637776100570872222-257CUnknown-257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0-253D-257C3000-26amp-3Bsdata-3DNX0QVNxgZDpygxc99El-252BnAlFGxzDlWrCBXQrlqK4QUQ-253D-26amp-3Breserved-3D0&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=2HUgH4ZMDbs8AETB7WJnb6_JcYwZWAvO2eaeV71oVu8k8qdIvNgxwx1Dg41aOrUB&s=3My6ZMH9pdCsvAUejG1uUU2589fIuMLrzsTaLzE04s4&e=  >

Eeglablist page: https://urldefense.proofpoint.com/v2/url?u=https-3A__nam11.safelinks.protection.outlook.com_-3Furl-3Dhttp-253A-252F-252Fsccn.ucsd.edu-252Feeglab-252Feeglabmail.html-26amp-3Bdata-3D04-257C01-257Cpaul.anthony.beach-2540emory.edu-257C72d618f8a1f74f43666d08d9d5fbfe9f-257Ce004fb9cb0a4424fbcd0322606d5df38-257C0-257C0-257C637776100570872222-257CUnknown-257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0-253D-257C3000-26amp-3Bsdata-3DNh-252BGAwOv71ZrSFLO2mg-252BWaTPWpMmxZ57XVOKGeOUoFE-253D-26amp-3Breserved-3D0&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=2HUgH4ZMDbs8AETB7WJnb6_JcYwZWAvO2eaeV71oVu8k8qdIvNgxwx1Dg41aOrUB&s=i1271bfPeBPpjZlHsPiV411F2z9pWUXPfOUkitAUx4U&e= 
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu<mailto:eeglablist-unsubscribe at sccn.ucsd.edu>
For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu<mailto:eeglablist-request at sccn.ucsd.edu>




More information about the eeglablist mailing list