merge_eyes#

pypillometry.merge_eyes(eyes=[], variables=[], method='mean', keep_eyes=True, policy='default', name='mean')#

Pipeline step for merge_eyes() (d | pp.merge_eyes(...)).

Merge data from both eyes into a single variable.

The merged data is stored under the eye name name (default “mean”, e.g., obj["mean", "pupil"]). Each sample is the mean over the eyes in which it is usable under the mask policy (see mask()), where recorded samples come first: an interpolated sample is used only if no eye has a recorded one there. A sample is masked in the merged data only if it is unusable in all merged eyes (it then holds the mean of the stored values; NaN only if they are NaN). The merged data get the layers that are set in all eyes that went into a sample (e.g., "interpolated" where all of them were interpolated, or "blink" where all eyes are masked by a blink); masked samples without such a common layer get the "user" layer. Each variable is merged over the selected eyes that have data for it.

Parameters:
  • eyes (str or list of str, optional) – eye(s) to merge; if empty, all available eyes

  • variables (str or list of str, optional) – variable(s) to merge; if empty, all available variables

  • method (str, optional) – which method to use for merging; currently only “mean” is implemented, by default “mean”

  • keep_eyes (bool, optional) – keep original eye data (True, default) or drop it together with its stored blinks (False)

  • policy (str, MaskPolicy or list of str) – mask policy that decides which samples are usable (see mask()); default "default"

  • name (str, optional) – name of the new eye; default "mean" (as in d.pupil.merge_eyes())

  • inplace (bool or None, optional) – if True, make change in-place and return the object; if False, make and return copy before making changes; if None, use the object-level setting (specified in the constructor)

Return type:

EyeData

Returns:

the object with merged data (self or a copy, depending on inplace)