Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question related to ICA fit #172

Open
imogenweigall opened this issue Jul 10, 2023 · 1 comment
Open

Question related to ICA fit #172

imogenweigall opened this issue Jul 10, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@imogenweigall
Copy link

Hi HyPyP team, thank you for your efforts in creating this great package. I have a question regarding your ICA_fit function. I am interested in why this function fits the ICA twice, first excluding bad channels and then a second time including bad channels. The typical recommendation is that bad channels are marked prior to ICA (https://mne.tools/stable/auto_tutorials/preprocessing/15_handling_bad_channels.html). If you could please provide me with further information / help me understand the rationale behind this it would be greatly appreciated.

icas = []
    for epoch in epochs:
        # per subj
        # applying AR to find global rejection threshold
        reject = get_rejection_threshold(epoch, ch_types='eeg')
        # if very long, can change decim value
        print('The rejection dictionary is %s' % reject)
        # fitting ICA on filt_raw after AR
        ica = ICA(n_components=n_components,
                  method=method,
                  fit_params= fit_params,
                  random_state=random_state).fit(epoch)
        # take bad channels into account in ICA fit
        epoch_all_ch = mne.Epochs.copy(epoch)
        epoch_all_ch.info['bads'] = []
        epoch_all_ch.drop_bad(reject=reject, flat=None)
        icas.append(ica.fit(epoch_all_ch)) 
@etherealsunshine
Copy link

etherealsunshine commented Jul 17, 2023

Hey there!
(Disclaimer: Not a member of the initial team)

I think it's done to ensure robustness to the presence of bad channels, especially where bad channels may only become apparent after running ICA

(Note: After reviewing, we've noted it to be a bug and it will be fixed in the upcoming versions)

@deep-introspection deep-introspection added the bug Something isn't working label Aug 10, 2023
@deep-introspection deep-introspection self-assigned this Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants