def test_scaler():
    'Test methods of Scaler\n    '
    raw = io.read_raw_fif(raw_fname, preload=False)
    events = read_events(event_name)
    picks = pick_types(raw.info, meg=True, stim=False, ecg=False, eog=False, exclude='bads')
    picks = picks[1:13:3]
    epochs = Epochs(raw, events, event_id, tmin, tmax, picks=picks, baseline=(None, 0), preload=True)
    epochs_data = epochs.get_data()
    scaler = Scaler(epochs.info)
    y = epochs.events[:, (- 1)]
    with warnings.catch_warnings(record=True):
        X = scaler.fit_transform(epochs_data, y)
        assert_true((X.shape == epochs_data.shape))
        X2 = scaler.fit(epochs_data, y).transform(epochs_data)
    assert_array_equal(X2, X)
    with warnings.catch_warnings(record=True):
        Xi = scaler.inverse_transform(X, y)
    assert_array_equal(epochs_data, Xi)
    assert_raises(ValueError, scaler.fit, epochs, y)
    assert_raises(ValueError, scaler.transform, epochs, y)
Test methods of Scaler
def test_scaler():
    '\n    '
    raw = io.read_raw_fif(raw_fname, preload=False)
    events = read_events(event_name)
    picks = pick_types(raw.info, meg=True, stim=False, ecg=False, eog=False, exclude='bads')
    picks = picks[1:13:3]
    epochs = Epochs(raw, events, event_id, tmin, tmax, picks=picks, baseline=(None, 0), preload=True)
    epochs_data = epochs.get_data()
    scaler = Scaler(epochs.info)
    y = epochs.events[:, (- 1)]
    with warnings.catch_warnings(record=True):
        X = scaler.fit_transform(epochs_data, y)
        assert_true((X.shape == epochs_data.shape))
        X2 = scaler.fit(epochs_data, y).transform(epochs_data)
    assert_array_equal(X2, X)
    with warnings.catch_warnings(record=True):
        Xi = scaler.inverse_transform(X, y)
    assert_array_equal(epochs_data, Xi)
    assert_raises(ValueError, scaler.fit, epochs, y)
    assert_raises(ValueError, scaler.transform, epochs, y)