(self, X, y=None)
| 84 | self._do_scaling = do_scaling |
| 85 | |
| 86 | def fit(self, X, y=None): |
| 87 | scalings = _check_scalings_user(self._scalings) |
| 88 | picks_by_type = _picks_by_type( |
| 89 | pick_info(self._info, _pick_data_channels(self._info, exclude=())) |
| 90 | ) |
| 91 | std = np.ones(sum(len(p[1]) for p in picks_by_type)) |
| 92 | if X.shape[1] != len(std): |
| 93 | raise ValueError( |
| 94 | f"info had {len(std)} data channels but X has {len(X)} channels" |
| 95 | ) |
| 96 | if self._do_scaling: # this is silly, but necessary for completeness |
| 97 | for kind, picks in picks_by_type: |
| 98 | std[picks] = 1.0 / scalings[kind] |
| 99 | self.std_ = std |
| 100 | self.mean_ = np.zeros_like(std) |
| 101 | return self |
| 102 | |
| 103 | def transform(self, X): |
| 104 | return X / self.std_ |
no test coverage detected