def fit(self, epochs_data, y):
"""Standardizes data across channels
Parameters
----------
epochs_data : array, shape (n_epochs, n_channels, n_times)
The data to concatenate channels.
y : array, shape (n_epochs,)
The label for each epoch.
Returns
-------
self : instance of Scaler
Returns the modified instance.
"""
if not isinstance(epochs_data, np.ndarray):
raise ValueError("epochs_data should be of type ndarray (got %s)."
% type(epochs_data))
X = np.atleast_3d(epochs_data)
picks_list = dict()
picks_list['mag'] = pick_types(self.info, meg='mag', ref_meg=False,
exclude='bads')
picks_list['grad'] = pick_types(self.info, meg='grad', ref_meg=False,
exclude='bads')
picks_list['eeg'] = pick_types(self.info, eeg=True, ref_meg=False,
meg=False, exclude='bads')
self.picks_list_ = picks_list
for key, this_pick in picks_list.items():
if self.with_mean:
ch_mean = X[:, this_pick, :].mean(axis=1)[:, None, :]
self.ch_mean_[key] = ch_mean # TODO rename attribute
if self.with_std:
ch_std = X[:, this_pick, :].mean(axis=1)[:, None, :]
self.std_[key] = ch_std # TODO rename attribute
return self
transformer.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录