meeg_utils.io.average_dev_head_t#

meeg_utils.io.average_dev_head_t(sources)[source]#

Average device-to-head transform of several MEG recordings.

Each recording’s head position (info["dev_head_t"]) is weighted by its duration outside BAD annotations; rotations are averaged as quaternions (mne.preprocessing.compute_average_dev_head_t()). Use the result as the destination of HeadAlign so that every run is mapped to the same position, the one that needs the least movement on average.

Parameters:

sources (sequence of Raw | path | BIDSPath) – The recordings (typically the runs of one session). Paths are read without loading the data.

Returns:

The average device-to-head transform.

Return type:

Transform

Raises:

ValueError – If there are no recordings or one lacks a head transform.