GazePoint: source export to BIDS derivatives¶
This notebook runs the complete Pyxations workflow on the bundled GazePoint CSV export. Install the optional detector first with pip install "pyxations[remodnav]".
In [1]:
Copied!
from pathlib import Path
from pyxations import Experiment, compute_derivatives_for_dataset, dataset_to_bids
from pathlib import Path
from pyxations import Experiment, compute_derivatives_for_dataset, dataset_to_bids
Convert the vendor CSV into raw BIDS, then compute REMoDNaV derivatives from that BIDS dataset.
In [2]:
Copied!
repo = next(
path
for path in (Path.cwd(), *Path.cwd().parents)
if (path / "pyproject.toml").is_file()
)
source = repo / "examples" / "gazepoint_sart"
output = repo / "generated"
raw_bids = dataset_to_bids(
output,
source,
"gazepoint-sart",
format_name="gaze",
overwrite=True,
)
derivatives = compute_derivatives_for_dataset(
raw_bids,
"gaze",
detection_algorithm="remodnav",
screen_height=1080,
screen_width=1920,
num_processes=1,
overwrite=True,
)
derivatives
repo = next(
path
for path in (Path.cwd(), *Path.cwd().parents)
if (path / "pyproject.toml").is_file()
)
source = repo / "examples" / "gazepoint_sart"
output = repo / "generated"
raw_bids = dataset_to_bids(
output,
source,
"gazepoint-sart",
format_name="gaze",
overwrite=True,
)
derivatives = compute_derivatives_for_dataset(
raw_bids,
"gaze",
detection_algorithm="remodnav",
screen_height=1080,
screen_width=1920,
num_processes=1,
overwrite=True,
)
derivatives
Out[2]:
PosixPath('/home/runner/work/pyxations/pyxations/generated/gazepoint-sart_derivatives')
GazePoint point-of-gaze values are normalized to the display. Use a unit-sized plotting surface unless you explicitly convert the coordinates to pixels.
In [3]:
Copied!
experiment = Experiment(raw_bids)
experiment.load_data("remodnav")
trial = experiment["0001"]["A"][0]
trial.fixations().head()
experiment = Experiment(raw_bids)
experiment.load_data("remodnav")
trial = experiment["0001"]["A"][0]
trial.fixations().head()
Out[3]:
shape: (5, 20)
| tStart | tEnd | xStart | yStart | xEnd | yEnd | ampDeg | vPeak | med_vel | avg_vel | duration | xAvg | yAvg | pupilAvg | Eyes_recorded | Rate_recorded | eye | trial_number | phase | bad |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | f64 | str | str | f64 | str | i64 | str | bool |
| 972.290039 | 3065.185547 | 0.369775 | 0.139658 | 0.263273 | 0.289748 | 0.003368 | 0.070474 | 0.00663 | 0.012024 | 2092.895508 | 0.321707 | 0.277596 | null | null | 60.681481 | null | 0 | "" | false |
| 3197.021484 | 3576.049805 | 0.409619 | 1.164751 | 0.230547 | 0.864883 | 0.006393 | 0.108054 | 0.01723 | 0.026715 | 379.02832 | 0.296041 | 1.060224 | null | null | 60.681481 | null | 0 | "" | false |
| 3691.40625 | 4828.491211 | 0.236595 | 0.384978 | 0.274866 | 0.418631 | 0.000933 | 0.114981 | 0.016889 | 0.03144 | 1137.084961 | 0.281339 | 0.404314 | null | null | 60.681481 | null | 0 | "" | false |
| 4976.806641 | 5158.081055 | 0.275128 | 1.267556 | 0.2585 | 1.410725 | 0.002638 | 0.101726 | 0.009986 | 0.023133 | 181.274414 | 0.264208 | 1.294421 | null | null | 60.681481 | null | 0 | "" | false |
| 5273.4375 | 6509.399414 | 0.246971 | 2.128598 | 0.134276 | 2.307488 | 0.00387 | 0.031244 | 0.006855 | 0.008767 | 1235.961914 | 0.207385 | 2.2252 | null | null | 60.681481 | null | 0 | "" | false |
In [4]:
Copied!
trial.plot_scanpath(screen_height=1, screen_width=1, display=True)
trial.plot_scanpath(screen_height=1, screen_width=1, display=True)
/home/runner/work/pyxations/pyxations/pyxations/analysis/generic.py:2010: UserWarning: No named trial phase was found, so every fixation is plotted as a single unnamed phase. Pass start_msgs and end_msgs to compute_derivatives_for_dataset to segment the recording into named phases. vis.scanpath(