read_gazepoint#

pypillometry.read_gazepoint(fname, keep_initial_label=False)[source]#

Read a recording of a GazePoint eye tracker (e.g., GP3).

The file is a table (tab- or comma-separated) with one row per sample and the columns of the GazePoint Open Gaze API, as written by programs that record the data stream of the eye tracker: CNT, TIME (s), LPOGX, …, LPD, LPV, LEYEZ, LPUPILD, LPUPILV, …, USER.

The column USER holds the last label that the experiment sent to the eye tracker (e.g., "TRIAL 3"). It is repeated on every sample until the next label; each change of the label is an event at that sample.

The time of the samples is taken from the sample counter CNT of the eye tracker: TIME is the time at which the recording program received the sample, which jitters by several ms (and is rounded to steps of 7.8 ms on some computers), so that it looks as if samples were missing. The time is the straight line in CNT that fits TIME best; samples that are really missing are gaps in CNT. Files without CNT (or with repeated values of it) use TIME.

Parameters:
  • fname (str) – filename of the recording

  • keep_initial_label (bool) – if False (default), the label of the first sample is not an event: it was sent before the recording started (often left over from an earlier recording)

Return type:

dict[str, Any]

Returns:

  • "samples": pandas.DataFrame with time (ms) and the columns of the file under their original names, sorted by CNT (or by time; then samples with the time of an earlier sample are dropped)

  • "events": DataFrame with time (ms) and label

  • "info": dict with "format", "source", "time_base" ("CNT" or "TIME"), "sampling_rate" (Hz, from the time of the samples), "lost_samples" (gaps in CNT) and "duplicate_times" (number of dropped samples)

See also

pypillometry.EyeData.from_gazepoint

create an eyedata object from the file