ppsp-team / HyPyP

The Hyperscanning Python Pipeline
BSD 3-Clause "New" or "Revised" License
75 stars 42 forks source link

cleaned_epochs_AR #21

Closed aayrolles closed 4 years ago

aayrolles commented 4 years ago

cleaned_epochs_AR = http://prep.AR_local(cleaned_epochs_ICA, verbose=True), verbose does not instead use: cleaned_epochs_AR = http://prep.AR_local(cleaned_epochs_ICA), and then it works

deep-introspection commented 4 years ago

@phoebsc or @aayrolles Can you please post the error message?

phoebsc commented 4 years ago

on my side it doesn't give an error anymore :)

deep-introspection commented 4 years ago

@aayrolles And for you? Shall we close the issue?

aayrolles commented 4 years ago

The verbose argument has been remove from notebook but it still doesn't work in the getting_started.py, and we also have an error with the new strategy=unionargument

aayrolles commented 4 years ago

cleaned_epochs_AR, dic_AR = prep.AR_local(cleaned_epochs_ICA, verbose=True) Running autoreject on ch_type=eeg

TqdmKeyError Traceback (most recent call last) ~/DEV/HyPyP/tutorial/getting_started.py in ----> 1 cleaned_epochs_AR, dic_AR = prep.AR_local(cleaned_epochs_ICA, verbose=True)

~/DEV/HyPyP/hypyp/prep.py in AR_local(cleaned_epochs_ICA, strategy, threshold, verbose) 250 251 # fitting AR to get bad epochs --> 252 ar.fit(clean_epochs) 253 reject_log = ar.get_reject_log(clean_epochs, picks=picks) 254 bad_epochs_AR.append(reject_log)

~/Library/Caches/pypoetry/virtualenvs/hypyp-LcIr35qi-py3.7/lib/python3.7/site-packages/autoreject/autoreject.py in fit(self, epochs) 1004 self.ninterpolate, self.cv, 1005 self.consensus, self.dots, -> 1006 self.verbose) 1007 self.threshes_.update(this_localreject.threshes) 1008

~/Library/Caches/pypoetry/virtualenvs/hypyp-LcIr35qi-py3.7/lib/python3.7/site-packages/autoreject/autoreject.py in _run_local_reject_cv(epochs, threshfunc, picks, ninterpolate, cv, consensus, dots, verbose) 761 verbose=verbose, picks=picks, 762 dots=dots) --> 763 local_reject.fit(epochs) 764 765 assert len(localreject.consensus) == 1 # works with one ch_type

~/Library/Caches/pypoetry/virtualenvs/hypyp-LcIr35qi-py3.7/lib/python3.7/site-packages/autoreject/autoreject.py in fit(self, epochs) 677 self.threshes_ = self.threshfunc( 678 epochs.copy(), dots=self.dots, picks=self.picks, --> 679 verbose=self.verbose) 680 681 reject_log = self.get_rejectlog(epochs=epochs, picks=self.picks)

~/Library/Caches/pypoetry/virtualenvs/hypyp-LcIr35qi-py3.7/lib/python3.7/site-packages/autoreject/autoreject.py in _compute_thresholds(epochs, method, random_state, picks, augment, dots, verbose, n_jobs) 442 if augment: 443 epochs_interp = _clean_by_interp(epochs, picks=picks, --> 444 dots=dots, verbose=verbose) 445 # non-data channels will be duplicate 446 data = np.concatenate((epochs.get_data(),

~/Library/Caches/pypoetry/virtualenvs/hypyp-LcIr35qi-py3.7/lib/python3.7/site-packages/autoreject/utils.py in _clean_by_interp(inst, picks, dots, verbose) 237 ch_names = [inst.info['ch_names'][p] for p in picks] 238 for ch_idx, (pick, ch) in enumerate(_pbar(list(zip(picks, ch_names)), --> 239 desc=mesg, verbose=verbose)): 240 inst.info['bads'] = [ch] 241 pick_interp = mne.pick_channels(inst.info['ch_names'], [ch])[0]

~/Library/Caches/pypoetry/virtualenvs/hypyp-LcIr35qi-py3.7/lib/python3.7/site-packages/autoreject/utils.py in _pbar(iterable, desc, leave, position, verbose) 181 if verbose == 'progressbar': 182 from mne.utils import ProgressBar --> 183 pbar = ProgressBar(iterable, mesg=desc, spinner=True) 184 print('') 185 elif verbose == 'tqdm':

~/Library/Caches/pypoetry/virtualenvs/hypyp-LcIr35qi-py3.7/lib/python3.7/site-packages/mne/utils/progressbar.py in init(self, iterable, initial_value, mesg, max_total_width, max_value, kwargs) 71 iterable=self.iterable, desc=mesg, total=self.max_value, 72 initial=initial_value, ncols=max_total_width, ---> 73 disable=disable, kwargs) 74 75 def update(self, cur_value):

~/Library/Caches/pypoetry/virtualenvs/hypyp-LcIr35qi-py3.7/lib/python3.7/site-packages/tqdm/std.py in init(self, iterable, desc, total, leave, file, ncols, mininterval, maxinterval, miniters, ascii, disable, unit, unit_scale, dynamic_ncols, smoothing, bar_format, initial, position, postfix, unit_divisor, write_bytes, lock_args, nrows, gui, **kwargs) 961 fp_write=getattr(file, 'write', sys.stderr.write)) 962 if "nested" in kwargs else --> 963 TqdmKeyError("Unknown argument(s): " + str(kwargs))) 964 965 # Preprocess the arguments

TqdmKeyError: "Unknown argument(s): {'spinner': True}"

aayrolles commented 4 years ago

In fact this bug is related to the last mne 0.20 release (https://github.com/mne-tools/mne-python/pull/7155) they remove the spinner argument It should have been fixed in last autoreject version in april 2020 (https://github.com/autoreject/autoreject/issues/173). I checked which version we use in poetry requirement, it's the last stable autoreject 0.2.1 version from November 2019. So either we should use an older mne version (0.19), or we should use the latest autoreject development version. Third option we remove the verbose argument from cleaned_epochs_ARin hypyp

deep-introspection commented 4 years ago

@aayrolles Did autoreject is now working?

aayrolles commented 4 years ago

Yes it's working, so I close the issue!