MCPcopy
hub / github.com/mne-tools/mne-python / compute_proj_hfc

Function compute_proj_hfc

mne/preprocessing/hfc.py:14–96  ·  view source on GitHub ↗

Generate projectors to perform homogeneous/harmonic correction to data. Remove environmental fields from magnetometer data by assuming it is explained as a homogeneous :footcite:`TierneyEtAl2021` or harmonic field :footcite:`TierneyEtAl2022`. Useful for arrays of OPMs. Parameters

(
    info, order=1, picks="meg", exclude="bads", *, accuracy="accurate", verbose=None
)

Source from the content-addressed store, hash-verified

12
13@verbose
14def compute_proj_hfc(
15 info, order=1, picks="meg", exclude="bads", *, accuracy="accurate", verbose=None
16):
17 """Generate projectors to perform homogeneous/harmonic correction to data.
18
19 Remove environmental fields from magnetometer data by assuming it is
20 explained as a homogeneous :footcite:`TierneyEtAl2021` or harmonic field
21 :footcite:`TierneyEtAl2022`. Useful for arrays of OPMs.
22
23 Parameters
24 ----------
25 %(info)s
26 order : int
27 The order of the spherical harmonic basis set to use. Set to 1 to use
28 only the homogeneous field component (default), 2 to add gradients, 3
29 to add quadrature terms, etc.
30 picks : str | array_like | slice | None
31 Channels to include. Default of ``'meg'`` (same as None) will select
32 all non-reference MEG channels. Use ``('meg', 'ref_meg')`` to include
33 reference sensors as well.
34 exclude : list | 'bads'
35 List of channels to exclude from HFC, only used when picking
36 based on types (e.g., exclude="bads" when picks="meg").
37 Specify ``'bads'`` (the default) to exclude all channels marked as bad.
38 accuracy : str
39 Can be ``"point"``, ``"normal"`` or ``"accurate"`` (default), defines
40 which level of coil definition accuracy is used to generate model.
41 %(verbose)s
42
43 Returns
44 -------
45 %(projs)s
46
47 See Also
48 --------
49 mne.io.Raw.add_proj
50 mne.io.Raw.apply_proj
51
52 Notes
53 -----
54 To apply the projectors to a dataset, use
55 ``inst.add_proj(projs).apply_proj()``.
56
57 .. versionadded:: 1.4
58
59 References
60 ----------
61 .. footbibliography::
62 """
63 picks = _picks_to_idx(info, picks, none="meg", exclude=exclude, with_ref_meg=False)
64 info = pick_info(info, picks)
65 del picks
66 exp = dict(origin=(0.0, 0.0, 0.0), int_order=0, ext_order=order)
67 coils = _prep_mf_coils(info, ignore_ref=False, accuracy=accuracy)
68 n_chs = len(coils[5])
69 if n_chs != info["nchan"]:
70 raise ValueError(
71 f"Only {n_chs}/{info['nchan']} picks could be interpreted as MEG channels."

Callers 3

test_correctionFunction · 0.90
test_ref_degenerateFunction · 0.90

Calls 8

_picks_to_idxFunction · 0.85
pick_infoFunction · 0.85
_prep_mf_coilsFunction · 0.85
_sss_basisFunction · 0.85
_label_basisFunction · 0.85
ProjectionClass · 0.85
normMethod · 0.80
appendMethod · 0.45

Tested by 3

test_correctionFunction · 0.72
test_ref_degenerateFunction · 0.72