meeg_utils.steps.Maxwell#
- class meeg_utils.steps.Maxwell(*, st_duration=None, st_correlation=0.98, origin='auto', int_order=8, ext_order=3, cross_talk='auto', calibration='auto', head_pos=None, destination=None, coord_frame='head', regularize='in', remove_chpi=True, bad_condition='error', skip_by_annotation=('edge', 'bad_acq_skip'))[source]#
Signal space separation (SSS) and its temporal extension (tSSS).
Wraps
mne.preprocessing.maxwell_filter()(Taulu & Kajola, 2005, J Appl Phys 97:124905; Taulu & Simola, 2006, Phys Med Biol 51:1759) for Neuromag/MEGIN systems:external interference is removed and bad MEG channels are reconstructed, so mark them first (
BadChannelswithmethod="maxwell"): an unmarked noisy channel spreads its noise to every channel;with
st_duration, tSSS also removes interference from sources close to the sensors (e.g. dental work, stimulators);with
head_pos, the data are corrected for head movement;with
destination, the data are transformed to another head position, e.g. the average over runs (meeg_utils.io.average_dev_head_t()).
- Parameters:
st_duration (float | None) – tSSS buffer length in seconds;
None(default) applies SSS only. MaxFilter’s default is 10 s. The buffer must hold an even number of samples (MNE’s overlapping windows); the step says which duration to use otherwise.st_correlation (float) – tSSS subspace correlation limit (MaxFilter default 0.98).
origin ("auto" | tuple of float) – Expansion origin (m) in
coord_frame;"auto"fits a sphere to the head digitization (or uses (0, 0, 0.04) with a warning when there are no head-shape points).int_order (int) – Orders of the internal and external expansions (defaults 8 and 3, as MaxFilter).
ext_order (int) – Orders of the internal and external expansions (defaults 8 and 3, as MaxFilter).
cross_talk ("auto" | str | path-like | None) – Cross-talk compensation and fine-calibration files.
"auto"(default) finds them in the BIDS dataset of the recording and raises if they are missing;Nonefilters without them, which leaves more residual interference.calibration ("auto" | str | path-like | None) – Cross-talk compensation and fine-calibration files.
"auto"(default) finds them in the BIDS dataset of the recording and raises if they are missing;Nonefilters without them, which leaves more residual interference.head_pos ("chpi" | str | path-like | ndarray | None) – Head positions for movement compensation:
"chpi"estimates them from the cHPI coils (asmeeg_utils.qc.HeadMovementdoes), a string or path reads a head-position file (MaxFilter.pos), an array of shape (n, 10) is used as is;None(default) applies no movement compensation.destination (str | path-like | array, shape (4, 4) | Transform | None) – Head position to transform the data to (a device-to-head transform, or a recording whose
dev_head_tis used).Nonekeeps the recording’sdev_head_t(withhead_pos: the initial position).coord_frame ({"head", "meg"}) – Frame of the expansion.
"meg"is for data without head digitization (e.g. empty-room recordings);head_posanddestinationthen cannot be used.regularize ("in" | None) – Regularize the internal basis by information content (MaxFilter’s default) or not.
remove_chpi (bool) – If cHPI was on, subtract the coil signals (
mne.chpi.filter_chpi()) after estimating head positions and before filtering. SSS does not remove them (the coils are inside the sensor array).bad_condition ({"error", "warning", "info", "ignore"}) – What to do when the basis is ill conditioned.
skip_by_annotation (list of str) – Annotations whose segments are filtered separately (e.g. acquisition skips).
- cross_talk_, calibration_
Files used.
- Type:
str | None
- head_pos_#
Head positions used for movement compensation in the last transform (MNE’s format, see
mne.chpi.read_head_pos(); save them withmne.chpi.write_head_pos()). MNE adds them to the data asCHPIchannels; this step drops those, so the channels are unchanged.- Type:
ndarray | None
- qc_#
reconstructed(bad MEG channels rebuilt),n_basis(number of internal components kept),tsss,chpi_removed,projs_removed(MEG projectors dropped, as they no longer apply), per channel typepower_change_db(broadband power after relative to before; strongly negative values mean much interference was removed), withhead_posthe head movement (max_displacement_mm, …) and withdestinationthedestination_shift_mmanddestination_rotation_deg.- Type:
Notes
Maxwell filtering lowers the rank of the MEG data to
n_basis(typically 60-80);ICAlowers an integern_componentsto the rank. Run it before filtering and resampling, as MaxFilter does.Figures (
plot()):"psd"(before and after) and, withhead_pos,"head_positions"and"displacement".- __init__(*, st_duration=None, st_correlation=0.98, origin='auto', int_order=8, ext_order=3, cross_talk='auto', calibration='auto', head_pos=None, destination=None, coord_frame='head', regularize='in', remove_chpi=True, bad_condition='error', skip_by_annotation=('edge', 'bad_acq_skip'))[source]#
Methods
__init__(*[, st_duration, st_correlation, ...])fit(inst[, y, system])Learn the step's state from the data.
fit_transform(inst[, y, system, copy])Fit the step on the data and transform the same data.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
plot([kind, inst])Draw quality-control figures.
set_fit_request(*[, inst, system])Configure whether metadata should be requested to be passed to the
fitmethod.set_params(**params)Set the parameters of this estimator.
set_transform_request(*[, copy, inst])Configure whether metadata should be requested to be passed to the
transformmethod.transform(inst, *[, copy])Apply the fitted step to the data.
Attributes
Data types the step accepts.
adds_annotationsWhether the step may add
BAD_annotations (existing ones are kept).changes_channelsWhether the step may add, drop or reorder channels.
changes_timesWhether the step may change the time axis (e.g. resampling, cropping).
drops_epochsWhether the step may drop epochs (e.g. artifact rejection).
kind -> whether it needs data (
inst).returnsData type the step returns;
Nonemeans the same type as its input.Acquisition systems the step applies to;
Nonemeans all systems.- accepts: ClassVar[tuple[type, ...]] = (<class 'mne.io.base.BaseRaw'>,)#
Data types the step accepts.