drop_data#
- pypillometry.drop_data(eyes=[], variables=[])#
Pipeline step for
drop_data()(d | pp.drop_data(...)).Drop specified eyes and/or variables from the data.
All data of the given eyes and all data of the given variables are dropped (together with their mask layers). Everything else is kept (events, excluded periods, parameters, history, experimental setup, calibration); the class of the object does not change.
- Parameters:
eyes (
list) – Eyes to drop (e.g., [‘left’] or [‘right’] or [‘left’, ‘right’]); if empty, no eye is droppedvariables (
list) – Variables to drop (e.g., [‘pupil’] or [‘x’, ‘y’]); if empty, no variable is droppedinplace (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 without the specified data (self or a copy, depending on inplace)
- Raises:
KeyError – If an eye or variable does not exist.
ValueError – If dropping would result in no data remaining.
Examples
>>> import pypillometry as pp >>> d = pp.get_example_data("rlmw_002_short") >>> # Drop left eye data >>> right_only = d.drop_data(eyes=["left"], inplace=False) >>> right_only.eyes ['right'] >>> # Drop pupil data, keep only gaze >>> gaze_only = d.drop_data(variables=["pupil"], inplace=False) >>> # Drop right eye and pupil data >>> left_gaze = d.drop_data(eyes=["right"], variables=["pupil"], inplace=False) >>> sorted(left_gaze.data.keys()) ['left_x', 'left_y']