copy_eye#

pypillometry.copy_eye(old, new, variables=[], overwrite=False)#

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

Copy an eye (all its variables or only variables) to a new eye.

Values, mask layers and the parameters of scale() are copied; so are the limits of an uncertainty band (<old>_<var>_lower and _upper). Typical use: a merged eye "mean" in a recording with only one usable eye, so that all recordings of a study have the same variables (for two eyes, see merge_eyes()).

Parameters:
  • old (str) – the eye (e.g., "left")

  • new (str) – the name of the copy (e.g., "mean"; without _)

  • variables (str | list) – only these variables; default all variables of the eye (including gaze)

  • overwrite (bool) – replace the variables of eye new if they exist (else an error)

  • 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:

Self

Returns:

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

Raises:
  • KeyError – if the eye (or one of variables of it) does not exist

  • ValueError – if a variable of eye new exists (and not overwrite), or new is not a valid eye name

See also

rename_eye

rename the eye instead

merge_eyes

merge two eyes

copy_variable

copy a variable within the eyes

Examples

>>> import pypillometry as pp
>>> d = pp.get_example_data("rlmw_002_short")
>>> d = d.copy_eye("left", "mean", variables="pupil", inplace=False)
>>> d.eyes
['left', 'right', 'mean']