rename_eye#

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

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

Rename an eye (all its variables or only variables).

Values, mask layers and the parameters of scale() move to the new eye; so do the limits of an uncertainty band (<old>_<var>_lower and _upper). Typical use: a recording in which the eye tracker labelled the eye wrongly.

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

  • new (str) – its new name (e.g., "right"; 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 renamed eye (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

copy_eye

keep the eye and add a copy

rename_variable

rename a variable within the eyes

Examples

>>> import pypillometry as pp
>>> d = pp.get_example_data("rlmw_002_short")
>>> d = d.drop_data(eyes="right", inplace=False).rename_eye("left", "right")
>>> d.eyes
['right']