def _setup_args(info):
    """Helper to test_as_meg_type_evoked."""
    coils = _create_coils(info["chs"], FIFF.FWD_COIL_ACCURACY_NORMAL, info["dev_head_t"], "meg")
    my_origin, int_rad, noise, lut_fun, n_fact = _setup_dots("fast", coils, "meg")
    args_dict = dict(
        intrad=int_rad, volume=False, coils1=coils, r0=my_origin, ch_type="meg", lut=lut_fun, n_fact=n_fact
    )
    return args_dict
Ejemplo n.º 2
0
def _setup_args(info):
    """Helper to test_as_meg_type_evoked."""
    coils = _create_coils(info['chs'], FIFF.FWD_COIL_ACCURACY_NORMAL,
                          info['dev_head_t'], 'meg')
    my_origin, int_rad, noise, lut_fun, n_fact = _setup_dots(
        'fast', coils, 'meg')
    args_dict = dict(intrad=int_rad,
                     volume=False,
                     coils1=coils,
                     r0=my_origin,
                     ch_type='meg',
                     lut=lut_fun,
                     n_fact=n_fact)
    return args_dict
Ejemplo n.º 3
0
def test_magnetic_dipole():
    """Test basic magnetic dipole forward calculation
    """
    trans = Transform('mri', 'head', np.eye(4))
    info = read_info(fname_raw)
    picks = pick_types(info, meg=True, eeg=False, exclude=[])
    info = pick_info(info, picks[:12])
    coils = _create_coils(info['chs'], FIFF.FWD_COIL_ACCURACY_NORMAL, trans)
    # magnetic dipole at device origin
    r0 = np.array([0., 13., -6.])
    for ch, coil in zip(info['chs'], coils):
        rr = (ch['coil_trans'][:3, 3] + r0) / 2.
        far_fwd = _magnetic_dipole_field_vec(r0[np.newaxis, :], [coil])
        near_fwd = _magnetic_dipole_field_vec(rr[np.newaxis, :], [coil])
        ratio = 8. if ch['ch_name'][-1] == '1' else 16.  # grad vs mag
        assert_allclose(np.median(near_fwd / far_fwd), ratio, atol=1e-1)
Ejemplo n.º 4
0
def test_magnetic_dipole():
    """Test basic magnetic dipole forward calculation
    """
    trans = {'to': FIFF.FIFFV_COORD_HEAD, 'from': FIFF.FIFFV_COORD_MRI,
             'trans': np.eye(4)}
    info = read_info(fname_raw)
    picks = pick_types(info, meg=True, eeg=False, exclude=[])
    info = pick_info(info, picks[:12])
    coils = _create_coils(info['chs'], FIFF.FWD_COIL_ACCURACY_NORMAL, trans)
    # magnetic dipole at device origin
    r0 = np.array([0., 13., -6.])
    for ch, coil in zip(info['chs'], coils):
        rr = (ch['coil_trans'][:3, 3] + r0) / 2.
        far_fwd = _magnetic_dipole_field_vec(r0[np.newaxis, :], [coil])
        near_fwd = _magnetic_dipole_field_vec(rr[np.newaxis, :], [coil])
        ratio = 8. if ch['ch_name'][-1] == '1' else 16.  # grad vs mag
        assert_allclose(np.median(near_fwd / far_fwd), ratio, atol=1e-1)