Cannot pickle mne.preprocessing.ica.ICA anymore
See original GitHub issueWith the current master (installed via pip install git+https://github.com/mne-tools/mne-python.git#egg=mne
), I get an error when pickling an mne.preprocessing.ica.ICA
object:
import pickle
import mne
print(mne.__version__)
ica = mne.preprocessing.ICA()
raw = mne.io.read_raw_edf("/Users/clemens/Downloads/testfiles/S001R04.edf", preload=True)
ica.fit(raw)
pickle.loads(pickle.dumps(ica))
# Traceback (most recent call last):
# File "/Users/clemens/Repositories/mnelab/.venv/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3296, in run_code
# exec(code_obj, self.user_global_ns, self.user_ns)
# File "<ipython-input-8-a056623ee708>", line 1, in <module>
# pickle.loads(pickle.dumps(ica))
# TypeError: __new__() missing 1 required positional argument: 'val'
The same code works with the latest released version 0.17.2. I didn’t see any change to the ICA
object that might be causing this (but maybe I’m missing something). If indeed nothing changed, could this behavior be due to how pip installs stuff from GitHub (vs. “proper” packages from PyPI)? If so, how can I fix this (I need to pickle because I want to use the multiprocessing
module)?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
mne.preprocessing.ICA — MNE 1.2.2 documentation
Data decomposition using Independent Component Analysis (ICA). ... the baseline period of the cleaned data may not be of zero mean anymore.
Read more >How to set up and fit the ICA? - MNE Forum - Discourse
In the preprocessing section, the tutorial says: # set up and fit the ICA ica = mne.preprocessing.ICA(n_components=20, random_state=97, ...
Read more >A Toolbox and Crowdsourcing Platform for Automatic Labeling ...
The ALICE toolbox aims to build a sustainable algorithm to remove artifacts and find specific patterns in EEG signals using ICA decomposition ...
Read more >A Toolbox and Crowdsourcing Platform for Automatic ... - NCBI
Independent Component Analysis (ICA) is a conventional approach to exclude non-brain signals such as eye movements and muscle artifacts from ...
Read more >(PDF) A Toolbox and Crowdsourcing Platform for Automatic ...
PDF | Independent Component Analysis (ICA) is a conventional approach to exclude non-brain signals such as eye movements and muscle ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is expected behavior when defining custom __new__-methods.
You could add something like this to utils/_bunch.py 's NamedInt:
def __getnewargs__(obj): return obj._name, int(obj)
Thanks @Teekuningas, this solves the problem!