From cc4bd336db043260cac574117e995154a33cb305 Mon Sep 17 00:00:00 2001 From: Mainak Jas Date: Thu, 8 Nov 2018 15:48:59 -0500 Subject: [PATCH] Update whats new --- autoreject/autoreject.py | 15 ++++++--------- doc/whats_new.rst | 3 +++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autoreject/autoreject.py b/autoreject/autoreject.py index cb3863f8..86c74aec 100644 --- a/autoreject/autoreject.py +++ b/autoreject/autoreject.py @@ -34,6 +34,9 @@ 'verbose', 'n_jobs', 'cv', 'random_state', 'thresh_method') +FIT_PARAMS = ('threshes_', 'n_interpolate_', 'consensus_', 'picks_', + 'loss_') + def _slicemean(obj, this_slice, axis): mean = np.nan @@ -859,14 +862,9 @@ def __getstate__(self): """Get the state of autoreject as a dictionary.""" state = dict() - fit_params_cv = ( - 'n_interpolate_', 'consensus_', 'picks_', - 'threshes_', 'loss_' - ) - for param in INIT_PARAMS: state[param] = getattr(self, param) - for param in fit_params_cv: + for param in FIT_PARAMS: if hasattr(self, param): state[param] = getattr(self, param) @@ -874,8 +872,7 @@ def __getstate__(self): state['local_reject_'] = dict() for ch_type in self.local_reject_: state['local_reject_'][ch_type] = dict() - for param in INIT_PARAMS[:4] + \ - ('threshes_', 'n_interpolate_', 'consensus_'): + for param in INIT_PARAMS[:4] + FIT_PARAMS[:3]: state['local_reject_'][ch_type][param] = \ getattr(self.local_reject_[ch_type], param) return state @@ -891,7 +888,7 @@ def __setstate__(self, state): for key in INIT_PARAMS[:4] } local_reject_[ch_type] = _AutoReject(**init_kwargs) - for key in ('threshes_', 'n_interpolate_', 'consensus_'): + for key in FIT_PARAMS[:3]: setattr(local_reject_[ch_type], key, state['local_reject_'][ch_type][key]) self.local_reject_ = local_reject_ diff --git a/doc/whats_new.rst b/doc/whats_new.rst index 312357e3..d5a1ea57 100644 --- a/doc/whats_new.rst +++ b/doc/whats_new.rst @@ -15,6 +15,9 @@ Current Changelog ~~~~~~~~~ +- Introduced a new method :meth:`autoreject.AutoReject.save` and function :func:`autoreject.read_autoreject` + for IO of autoreject objects, by `Mainak Jas`_ in `#120 `_ + Bug ~~~