from_ipc#

pymovements.gaze.from_ipc(file: str | Path, experiment: Experiment | None = None, *, trial_columns: str | list[str] | None = None, column_map: dict[str, str] | None = None, add_columns: dict[str, str] | None = None, column_schema_overrides: dict[str, type] | None = None, **read_ipc_kwargs: Any) Gaze[source]#

Initialize a Gaze.

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

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

  • trial_columns (str | list[str] | None) – The name of the trial columns in the input data frame. If the list is empty or None, the input data frame is assumed to contain only one trial. If the list is not empty, the input data frame is assumed to contain multiple trials and the transformation methods will be applied to each trial separately. (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_schema_overrides (dict[str, type] | 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 initialized gaze object read from the ipc file.

Return type:

Gaze

Examples

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

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