{ "cells": [ { "cell_type": "markdown", "id": "5e46b7a9", "metadata": {}, "source": [ "# Example datasets included in `pypillometry`\n", "\n", "`pypillometry` comes with a set of example datasets so that you can start trying out the package right away.\n", "\n", "Small datasets are included in the package itself; larger ones are downloaded from OSF the first time they are requested and stored in a cache directory (`~/.cache/pypillometry` by default), so later calls do not download them again." ] }, { "cell_type": "code", "execution_count": 1, "id": "696960c2", "metadata": { "execution": { "iopub.execute_input": "2026-10-28T11:28:58.679525Z", "iopub.status.busy": "2026-10-28T11:28:58.679368Z", "iopub.status.idle": "2026-10-28T11:29:00.463447Z", "shell.execute_reply": "2026-10-28T11:29:00.462180Z" } }, "outputs": [], "source": [ "import pypillometry as pp" ] }, { "cell_type": "markdown", "id": "ca0ce5b9", "metadata": {}, "source": [ "You can get an overview of all available datasets with `get_available_datasets()`:" ] }, { "cell_type": "code", "execution_count": 2, "id": "7845ac19", "metadata": { "execution": { "iopub.execute_input": "2026-10-28T11:29:00.466385Z", "iopub.status.busy": "2026-10-28T11:29:00.465710Z", "iopub.status.idle": "2026-10-28T11:29:00.488989Z", "shell.execute_reply": "2026-10-28T11:29:00.487844Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DatasetTypeDescription
0rlmw_002ASC (OSF)Binocular data from a 20-minute reinforcement ...
1rlmw_002_shortASC (local)Short version (first 40 sec) of a 20-minute re...
2rlmw_010_edfEDFBinocular data from a 20-minute reinforcement ...
\n", "
" ], "text/plain": [ "{'rlmw_002': {'samples_asc': 'https://osf.io/download/67cec1a4fb24855200fd6db7/',\n", " 'events_asc': 'https://osf.io/download/67cec1a183c337a5effd6fb6/',\n", " 'description': 'Binocular data from a 20-minute reinforcement learning task. Data from a single participant, features strong horizontal eye-movements between the two stimuli presented on the left and right.'},\n", " 'rlmw_002_short': {'sample_asc': PosixPath('/home/mmi041/Nextcloud/work/projects/pupil/pypillometry/pypillometry/data/002_rlmw_samples_short.asc'),\n", " 'events_asc': PosixPath('/home/mmi041/Nextcloud/work/projects/pupil/pypillometry/pypillometry/data/002_rlmw_events_short.asc'),\n", " 'description': 'Short version (first 40 sec) of a 20-minute reinforcement learning task. Data from a single participant, features strong horizontal eye-movements between the two stimuli presented on the left and right.'},\n", " 'rlmw_010_edf': {'edf': 'https://osf.io/trsuq/download',\n", " 'description': 'Binocular data from a 20-minute reinforcement learning task in EDF (Eyelink) format. Data from a single participant, features strong horizontal eye-movements between the two stimuli presented on the left and right.'}}" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pp.get_available_datasets()" ] }, { "cell_type": "markdown", "id": "a2955156", "metadata": {}, "source": [ "Using the identifier in the first column, you can load a dataset with `get_example_data()`. The result is a regular `EyeData` object:" ] }, { "cell_type": "code", "execution_count": 3, "id": "28c674cd", "metadata": { "execution": { "iopub.execute_input": "2026-10-28T11:29:00.491228Z", "iopub.status.busy": "2026-10-28T11:29:00.490917Z", "iopub.status.idle": "2026-10-28T11:29:00.887701Z", "shell.execute_reply": "2026-10-28T11:29:00.886892Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "

EyeData — rlmw_002_short

\n", "\n", "
\n", " \n", "
\n", "
Samples
\n", "
20,465
\n", "
\n", " \n", "
\n", "
Sampling rate
\n", "
500.0 Hz
\n", "
\n", " \n", "
\n", "
Duration
\n", "
0.68 min (start 0.00, end 0.68)
\n", "
\n", " \n", "
\n", "
Eyes
\n", "
left, right
\n", "
\n", " \n", "
\n", "
Variables
\n", "
left_x, left_y, left_pupil, right_x, right_y, right_pupil
\n", "
\n", " \n", "
\n", "
Events
\n", "
40
\n", "
\n", " \n", "
\n", "
Size
\n", "
1.4MiB
\n", "
\n", " \n", "
\n", "\n", " \n", "
\n", " Signal overview\n", "
\n", " \n", "
\n", "
left_pupil
\n", " \"left_pupil\n", "
\n", " \n", "
\n", "
left_x
\n", " \"left_x\n", "
\n", " \n", "
\n", "
left_y
\n", " \"left_y\n", "
\n", " \n", "
\n", "
right_pupil
\n", " \"right_pupil\n", "
\n", " \n", "
\n", "
right_x
\n", " \"right_x\n", "
\n", " \n", "
\n", "
right_y
\n", " \"right_y\n", "
\n", " \n", "
\n", "
\n", " \n", "\n", " \n", "\n", " \n", "
\n", " Data glimpse\n", "
EyeDataDict(vars=6,n=20465,shape=(20465,)): \n",
       "  left_x (float64): 655.6, 655.7, 655.0, 654.5, 655.0...\n",
       "  left_y (float64): 599.9, 598.9, 597.6, 597.8, 597.8...\n",
       "  left_pupil (float64): 1121.0, 1122.0, 1124.0, 1126.0, 1126.0...\n",
       "  right_x (float64): 773.1, 773.8, 774.8, 776.3, 776.7...\n",
       "  right_y (float64): 594.2, 593.9, 596.5, 597.4, 597.3...\n",
       "  right_pupil (float64): 949.0, 951.0, 956.0, 959.0, 960.0...\n",
       "
\n", "
\n", " \n", "\n", " \n", "
\n", " Recent history\n", "
    \n", " \n", "
  1. reset_time()
  2. \n", " \n", "
\n", "
\n", " \n", "
\n" ], "text/plain": [ "EyeData(rlmw_002_short, 1.4MiB):\n", " n : 20465\n", " sampling_rate : 500.0\n", " eyes : ['left', 'right']\n", " data : ['left_x', 'left_y', 'left_pupil', 'right_x', 'right_y', 'right_pupil']\n", " nevents : 40\n", " experimental_setup: {'screen_resolution': (1280, 1024), 'physical_screen_size_mm': (300.0, 200.0), 'eye_to_screen_distance_mm': 600.0, 'camera_position': 'not set'}\n", " calibration : not available\n", " duration_minutes : 0.6822\n", " start_min : 0.0\n", " end_min : 0.6821\n", " params : {}\n", " nblinks : {}\n", " blinks : {}\n", " glimpse : EyeDataDict(vars=6,n=20465,shape=(20465,)): \n", " left_x (float64): 655.6, 655.7, 655.0, 654.5, 655.0...\n", " left_y (float64): 599.9, 598.9, 597.6, 597.8, 597.8...\n", " left_pupil (float64): 1121.0, 1122.0, 1124.0, 1126.0, 1126.0...\n", " right_x (float64): 773.1, 773.8, 774.8, 776.3, 776.7...\n", " right_y (float64): 594.2, 593.9, 596.5, 597.4, 597.3...\n", " right_pupil (float64): 949.0, 951.0, 956.0, 959.0, 960.0...\n", "\n", " History:\n", " *\n", " └ reset_time()" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d = pp.get_example_data(\"rlmw_002_short\")\n", "d" ] }, { "cell_type": "markdown", "id": "26a7f7fe", "metadata": {}, "source": [ "The full-length version (`\"rlmw_002\"`, about 20 minutes) is downloaded from OSF on first use. If you want to store downloads somewhere else than in the default cache directory, use the `cache_dir=` argument:\n", "\n", "```python\n", "d = pp.get_example_data(\"rlmw_002\", cache_dir=\"example_data\")\n", "```" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.15.2" } }, "nbformat": 4, "nbformat_minor": 5 }