Skip to content

Commit

Permalink
Update whats new
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmainak committed Nov 8, 2018
1 parent 8ab45de commit cc4bd33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
15 changes: 6 additions & 9 deletions autoreject/autoreject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -859,23 +862,17 @@ 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)

if hasattr(self, 'local_reject_'):
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
Expand All @@ -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_
Expand Down
3 changes: 3 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/autoreject/autoreject/pull/120>`_

Bug
~~~

Expand Down

0 comments on commit cc4bd33

Please sign in to comment.