mne-tools / mne-tools/mne-python
Store the scores alongside the components chosen by find_bads_eXg methods.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.5k
- Forks
- 1.6k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 100
Description
Following a discussion on the forum with @hoechenberger I could not find a way to recover the information I was looking for.
Following an ICA, I saved to disk both the ICA instance and the raw instance on which the ICA is applied.
ica = mne.preprocessing.ICA(method='picard', max_iter='auto', random_state=101)
ica.fit(raw, picks='eeg')
eog_idx, eog_scores = ica.find_bads_eog(raw)
ecg_idx, ecg_scores = ica.find_bads_ecg(raw)
ica.exclude = eog_idx + ecg_idx
ica.apply(raw)
ica.save()
raw.save()
I wanted to check how well the adaptative Z-score threshold worked (I like smart algo, but I don't trust them blindly). After posting on the forum, and looking for a while, I could retrieve the separation between excluded components corresponding to EOG-related activity and ECG-related activity. This information is stored in ica.labels_. However, I could not recover the scores that lead to this component selection.
I ended up rerunning part of my pipeline and saving the scores separately, but it was very surprising for me that I could not recover this information from the ICA instance. After looking a bit into the code, it was clear to me that the scores were not saved anywhere. I propose to add an additional attribute similar to labels_ but for the scores.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the ICA find_bads_eog and find_bads_ecg entry points, along with the existing labels_ handling and ICA save behavior. Determine where the selected components and their scores are produced and persisted. Done means scores from these methods remain recoverable from the saved ICA instance alongside the selected components.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100