@testing.requires_testing_data
def test_metrics():
    """Test simulation metrics"""
    src = read_source_spaces(src_fname)
    times = 1000. / np.arange(600)
    rng = np.random.RandomState(42)
    stc1 = simulate_sparse_stc(src, n_dipoles=2, times=times, random_state=rng)
    stc2 = simulate_sparse_stc(src, n_dipoles=2, times=times, random_state=rng)
    E1_rms = source_estimate_quantification(stc1, stc1, metric='rms')
    E2_rms = source_estimate_quantification(stc2, stc2, metric='rms')
    E1_cos = source_estimate_quantification(stc1, stc1, metric='cosine')
    E2_cos = source_estimate_quantification(stc2, stc2, metric='cosine')

    # ### Tests to add
    assert_true(E1_rms == 0.)
    assert_true(E2_rms == 0.)
    assert_almost_equal(E1_cos, 0.)
    assert_almost_equal(E2_cos, 0.)
    stc_bad = stc2.copy().crop(0, 0.5)
    assert_raises(ValueError, source_estimate_quantification, stc1, stc_bad)
    stc_bad = stc2.copy()
    stc_bad.times -= 0.1
    assert_raises(ValueError, source_estimate_quantification, stc1, stc_bad)
    assert_raises(ValueError, source_estimate_quantification, stc1, stc2,
                  metric='foo')
dataset/ETHPy150Open mne-tools/mne-python/mne/simulation/tests/test_metrics.py/test_metrics/swapped operands of `/`