@jspsych/plugin-tobii-calibration 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,137 @@
1
+ # @jspsych/plugin-tobii-calibration
2
+
3
+ jsPsych plugin for Tobii eye tracker calibration. Provides a visual calibration procedure with animated points, multiple grid sizes, and real-time feedback.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @jspsych/plugin-tobii-calibration
9
+ ```
10
+
11
+ ## Compatibility
12
+
13
+ This plugin requires jsPsych v8.0.0 or later and the `@jspsych/extension-tobii` extension.
14
+
15
+ ## Usage
16
+
17
+ ```javascript
18
+ import TobiiCalibrationPlugin from '@jspsych/plugin-tobii-calibration';
19
+
20
+ const trial = {
21
+ type: TobiiCalibrationPlugin,
22
+ calibration_points: 9,
23
+ calibration_mode: 'view',
24
+ };
25
+ ```
26
+
27
+ The Tobii extension must be loaded and connected before this plugin runs. See the [extension documentation](../extension-tobii/README.md) for setup instructions.
28
+
29
+ ## Parameters
30
+
31
+ | Parameter | Type | Default | Description |
32
+ |-----------|------|---------|-------------|
33
+ | calibration_points | int | `9` | Number of calibration points. Supported values: `5`, `9`, `13`, `15`, `19`, `25`. |
34
+ | calibration_mode | string | `'view'` | Calibration mode. `'view'`: participant looks at each point for a fixed duration. `'click'`: participant clicks when ready at each point. |
35
+ | point_size | int | `20` | Size of calibration points in pixels. |
36
+ | point_color | string | `'#ff0000'` | Color of calibration points (CSS color value). |
37
+ | point_duration | int | `500` | Duration to show each point before data collection begins (ms). Allows the participant to fixate. |
38
+ | show_progress | boolean | `true` | Show a progress indicator (e.g., "Point 3 of 9"). |
39
+ | custom_points | array | `null` | Array of custom calibration points. Each point is an object with `x` and `y` properties (normalized 0-1). Overrides `calibration_points` when provided. |
40
+ | instructions | string | `'Look at each point as it appears on the screen. Keep your gaze fixed on each point until it disappears.'` | Instructions text shown before calibration begins. |
41
+ | button_text | string | `'Start Calibration'` | Button text shown on the instructions screen before calibration begins. |
42
+ | background_color | string | `'#808080'` | Background color of the calibration container. |
43
+ | button_color | string | `'#007bff'` | Primary button color. |
44
+ | button_hover_color | string | `'#0056b3'` | Primary button hover color. |
45
+ | retry_button_color | string | `'#dc3545'` | Retry button color. |
46
+ | retry_button_hover_color | string | `'#c82333'` | Retry button hover color. |
47
+ | success_color | string | `'#28a745'` | Success message heading color. |
48
+ | error_color | string | `'#dc3545'` | Error message heading color. |
49
+ | max_retries | int | `1` | Maximum number of retry attempts allowed if calibration fails. The participant is shown a retry button on failure. Set to `0` to disable retries. |
50
+ | zoom_duration | int | `300` | Duration of zoom in/out point animations in ms. |
51
+ | explosion_duration | int | `400` | Duration of the explosion animation after each point is collected in ms. |
52
+ | success_display_duration | int | `2000` | Duration to show the success result before auto-advancing in ms. |
53
+ | instruction_display_duration | int | `3000` | Duration to show instructions before auto-advancing in view mode in ms. Has no effect in click mode. |
54
+
55
+ ## Data Generated
56
+
57
+ In addition to the [default data collected by jsPsych plugins](https://www.jspsych.org/latest/overview/plugins/#data-collected-by-all-plugins), this plugin collects the following data for each trial.
58
+
59
+ | Name | Type | Description |
60
+ |------|------|-------------|
61
+ | calibration_success | boolean | Whether the calibration was successful. |
62
+ | num_points | int | Number of calibration points used. |
63
+ | mode | string | Calibration mode used (`'view'` or `'click'`). |
64
+ | calibration_data | object | Full calibration result data returned by the server, including any quality metrics. |
65
+ | num_attempts | int | Number of calibration attempts made (including retries). |
66
+
67
+ ## Calibration Point Grids
68
+
69
+ The `calibration_points` parameter supports these grid sizes:
70
+
71
+ - **5**: Four corners + center
72
+ - **9**: 3x3 grid (recommended default)
73
+ - **13**: 3x3 outer grid + 4 diagonal midpoints
74
+ - **15**: 5 rows x 3 columns
75
+ - **19**: Symmetric 3-5-3-5-3 pattern
76
+ - **25**: 5x5 full grid
77
+
78
+ All standard grids use points spanning from 0.1 to 0.9 in normalized coordinates, keeping a 10% margin from screen edges.
79
+
80
+ ## Examples
81
+
82
+ ### Basic 9-Point Calibration
83
+
84
+ ```javascript
85
+ const trial = {
86
+ type: TobiiCalibrationPlugin,
87
+ calibration_points: 9,
88
+ calibration_mode: 'view',
89
+ };
90
+ ```
91
+
92
+ ### Click Mode with Custom Styling
93
+
94
+ ```javascript
95
+ const trial = {
96
+ type: TobiiCalibrationPlugin,
97
+ calibration_points: 9,
98
+ calibration_mode: 'click',
99
+ point_color: '#0000ff',
100
+ point_size: 25,
101
+ background_color: '#333333',
102
+ button_text: 'Begin Calibration',
103
+ };
104
+ ```
105
+
106
+ ### Custom Points
107
+
108
+ ```javascript
109
+ const trial = {
110
+ type: TobiiCalibrationPlugin,
111
+ custom_points: [
112
+ { x: 0.15, y: 0.15 },
113
+ { x: 0.5, y: 0.15 },
114
+ { x: 0.85, y: 0.15 },
115
+ { x: 0.15, y: 0.5 },
116
+ { x: 0.5, y: 0.5 },
117
+ { x: 0.85, y: 0.5 },
118
+ { x: 0.15, y: 0.85 },
119
+ { x: 0.5, y: 0.85 },
120
+ { x: 0.85, y: 0.85 },
121
+ ],
122
+ };
123
+ ```
124
+
125
+ ### With Retries Disabled
126
+
127
+ ```javascript
128
+ const trial = {
129
+ type: TobiiCalibrationPlugin,
130
+ calibration_points: 9,
131
+ max_retries: 0,
132
+ };
133
+ ```
134
+
135
+ ## Citation
136
+
137
+ If you use this plugin in your research, please cite it. See [CITATION.cff](CITATION.cff).