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>_lowerand_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, seemerge_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:
- 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_eyerename the eye instead
merge_eyesmerge two eyes
copy_variablecopy 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']