mne.chpi.refit_hpi#
- mne.chpi.refit_hpi(info, *, amplitudes=True, locs=True, order=True, ext_order=1, gof_limit=0.98, dist_limit=0.005, use=None, colinearity_limit=0, verbose=None)[source]#
Refit HPI coil order.
This operates inplace on
info, and will typically be called viarefit_hpi(raw.info)before further processing.- Parameters:
- infoinstance of
Info The measurement info.
- amplitudesbool
Whether to recompute the HPI amplitudes (slopes) from the raw data obtained during the original fit using
compute_chpi_amplitudes(), or used the already-computed ones stored ininfo['hpi_meas']. If this is True,locsandordermust also be True.- locsbool
Whether to recompute the HPI coil locations using
compute_chpi_locs(), or use the already-computed ones stored ininfo['hpi_results']. If this is True,ordermust also be True.- orderbool
Whether to refit the coil order by testing all permutations for the best goodness of fit between digitized coil locations and (rigid-transformed) fitted coil locations.
- ext_order
int The external order for SSS-like interfence suppression. The SSS bases are used as projection vectors during fitting.
Changed in version 0.20: Added
ext_order=1by default, which should improve detection of true HPI signals.- gof_limit
float The goodness-of-fit limit to use when choosing which coils to use for refitting.
- dist_limit
float The distance limit (in meters) to use when choosing which coils to use for refitting.
- use
int|None The maximum number of coils to use when testing different coil orderings. The default for
hpifitin MEGIN software is 3. Default (None) means to use all coils abovegof_limit. Can also be an ndarray of coil indices (0-indexed!) to use, e.g.,[1, 2, 4].- colinearity_limit
float The RMS limit (in meters) to use when checking for colinearity of coil locations. If the RMS difference between the used points and a best-fit linear approximation is less than this limit, a warning is emitted. The default (
0) avoids colinearity warnings altogether. The appropriate value here is dataset dependent, but for one problematic dataset the value of 0.03 worked well.- verbosebool |
str|int|None Control verbosity of the logging output. If
None, use the default verbosity level. See the logging documentation andmne.verbose()for details. Should only be passed as a keyword argument.
- infoinstance of
- Returns:
- infoinstance of
Info The modified measurement info (same as input).
- infoinstance of
Notes
This adds additional entries to
info["hpi_meas"]andinfo["hpi_results"], leaving the existing ones intact. It will always modifyinfo["dev_head_t"]inplace.The algorithm is as follows:
Optionally recompute HPI amplitudes (sinusoidal fit for each channel) using
compute_chpi_amplitudes().Optionally use HPI amplitudes to fit HPI coil locations using
compute_chpi_locs().Optionally determine coil digitization order by testing all permutations for the best goodness of fit between digitized coil locations and (rigid-transformed) fitted coil locations.
Subselect coils to use for fitting
dev_head_tbased ongof_limit,dist_limit, anduse.Update info inplace by modifying
info["dev_head_t"]and appending new entries toinfo["hpi_meas"]andinfo["hpi_results"].
New in v1.11.