pymovements.gaze.from_ipc#

pymovements.gaze.from_ipc(file: str | Path, experiment: Experiment | None = None, column_map: dict[str, str] | None = None, add_columns: dict[str, str] | None = None, column_dtypes: dict[str, Any] | None = None, **read_ipc_kwargs: Any) GazeDataFrame#

Initialize a pymovements.gaze.gaze_dataframe.GazeDataFrame.

Parameters:
  • file (str | Path) – Path of IPC/feather file.

  • experiment (Experiment | None) – The experiment definition. (default: None)

  • column_map (dict[str, str] | None) – The keys are the columns to read, the values are the names to which they should be renamed. (default: None)

  • add_columns (dict[str, str] | None) – Dictionary containing columns to add to loaded data frame. (default: None)

  • column_dtypes (dict[str, Any] | None) – Dictionary containing types for columns. (default: None)

  • **read_ipc_kwargs (Any) – Additional keyword arguments to be passed to polars to read in the ipc file.

Returns:

The gaze data frame read from the ipc file.

Return type:

GazeDataFrame

Examples

Let’s assume we have an IPC file stored at tests/files/monocular_example.feather. We can then load the data into a GazeDataFrame:

>>> from pymovements.gaze.io import from_ipc
>>> gaze = from_ipc(file='tests/files/monocular_example.feather')
>>> gaze.frame
shape: (10, 2)
┌──────┬───────────┐
│ time ┆ pixel     │
│ ---  ┆ ---       │
│ i64  ┆ list[i64] │
╞══════╪═══════════╡
│ 0    ┆ [0, 0]    │
│ 1    ┆ [0, 0]    │
│ 2    ┆ [0, 0]    │
│ 3    ┆ [0, 0]    │
│ …    ┆ …         │
│ 6    ┆ [0, 0]    │
│ 7    ┆ [0, 0]    │
│ 8    ┆ [0, 0]    │
│ 9    ┆ [0, 0]    │
└──────┴───────────┘