meeg_utils.epochs.combine#

meeg_utils.epochs.combine(epochs_list, *, bads='union', max_head_shift_mm=2.0, origin=(0.0, 0.0, 0.04))[source]#

Concatenate the epochs of several runs of one session.

The runs must have the same channels (names and order), sampling rate and epoch times. Events are matched by name: if runs gave a condition different codes (MNE numbers the annotations of each run), the codes of the first run that has it are used.

Parameters:
  • epochs_list (sequence of Epochs) – The runs. They are not modified.

  • bads ({"union", "interpolate"}) – "union": every channel bad in any run is marked bad in the result. "interpolate": those channels are interpolated in every run (needs sensor positions) and no channel is marked bad.

  • max_head_shift_mm (float) – For MEG, the largest head displacement relative to the sensors allowed between runs. Larger differences raise: map the runs to a common head position first with HeadAlign and meeg_utils.io.average_dev_head_t(). Within the limit, the first run’s head position is kept.

  • origin (tuple of float) – Point (head frame, m) whose displacement is measured.

Returns:

The concatenated epochs. The runs’ annotations are not kept (MNE cannot concatenate them); events and metadata are.

Return type:

Epochs

Raises:

ValueError – If the runs are not compatible.