cineon-api-format 3.0.0__tar.gz

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.
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+
3
+ # Ensure that script exits on fail
4
+ set -euo pipefail
5
+
6
+ # Check formatting
7
+ ./scripts/format.sh
8
+
9
+ # Check if badges need to be updated
10
+ ./scripts/badges.sh
11
+ if ! git diff --quiet badges/; then
12
+ echo "Error: Badges are out of date. Please run './scripts/badges.sh' and commit the changes."
13
+ exit 1
14
+ fi
@@ -0,0 +1,46 @@
1
+ name: Continuous Integration
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ format:
14
+ name: Formatting
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version-file: ".python-version"
23
+ - name: Install the latest version of uv
24
+ uses: astral-sh/setup-uv@v6
25
+ - name: Set up shfmt
26
+ uses: mfinelli/setup-shfmt@v3
27
+ - name: Check formatting
28
+ run: |
29
+ ./scripts/format.sh
30
+
31
+ tests:
32
+ name: Tests
33
+ runs-on: ubuntu-latest
34
+ needs: format
35
+
36
+ steps:
37
+ - uses: actions/checkout@v4
38
+ - name: Set up Python
39
+ uses: actions/setup-python@v5
40
+ with:
41
+ python-version-file: ".python-version"
42
+ - name: Install the latest version of uv
43
+ uses: astral-sh/setup-uv@v6
44
+ - name: Run tests
45
+ run: |
46
+ scripts/test.sh
@@ -0,0 +1,22 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+ .pytest_cache/
9
+
10
+ # Metrics
11
+ .complexity
12
+ .coverage
13
+
14
+ # Virtual environments
15
+ .venv/
16
+
17
+ # Formatting
18
+ .ruff_cache/
19
+ .mypy_cache/
20
+
21
+ # VScode
22
+ .vscode/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: cineon-api-format
3
+ Version: 3.0.0
4
+ Summary: A shared repository that describes the types used by the ELE-api, and other Cineon apis.
5
+ Requires-Python: >=3.12
6
+ Requires-Dist: cineon-format<4,>=3.0.0
7
+ Requires-Dist: pydantic>=2.12.5
8
+ Requires-Dist: typeguard>=4.4.4
9
+ Description-Content-Type: text/markdown
10
+
11
+ # Python repository template
12
+
13
+ ![Latest Release](badges/version.svg) ![Coverage Status](badges/coverage.svg) ![Code complexity](badges/complexity.svg)
14
+
15
+ This serves as an example of how to set up a new Python project.
16
+
17
+ You should update this `README` to be specific to your project. You should update `pyproject.toml` with the name of your project and rename the `src/repository_template` directory to be appropriate for your project.
18
+
19
+ ## Run the example
20
+
21
+ A simple "Hello World" example can be run using:
22
+
23
+ ```bash
24
+ uv run scripts/example.py
25
+ ```
26
+
27
+ ## Set up the hooks
28
+
29
+ These pre-push hooks ensure that the formatter is run and the badges are updated every time you attempt to `git push`. This way formatting errors are caught and be corrected before they reach the GitHub continuous-integration (CI) step. The badges are then automatically up-to-date.
30
+
31
+ ```bash
32
+ git config --local core.hooksPath .githooks/
33
+ ```
34
+
35
+ ## Check the formatting
36
+
37
+ The formatting can be checked manually using:
38
+
39
+ ```bash
40
+ ./scripts/format.sh
41
+ ```
42
+
43
+ this is exactly the script that is run in the CI pipeline and the pre-push hook. Formatting uses `Prettier` for markdown, `shfmt` for shell scripts, and `ruff` for Python.
44
+
45
+ ## Run the tests
46
+
47
+ The tests can be run manually using:
48
+
49
+ ```bash
50
+ ./scripts/test.sh
51
+ ```
@@ -0,0 +1,41 @@
1
+ # Python repository template
2
+
3
+ ![Latest Release](badges/version.svg) ![Coverage Status](badges/coverage.svg) ![Code complexity](badges/complexity.svg)
4
+
5
+ This serves as an example of how to set up a new Python project.
6
+
7
+ You should update this `README` to be specific to your project. You should update `pyproject.toml` with the name of your project and rename the `src/repository_template` directory to be appropriate for your project.
8
+
9
+ ## Run the example
10
+
11
+ A simple "Hello World" example can be run using:
12
+
13
+ ```bash
14
+ uv run scripts/example.py
15
+ ```
16
+
17
+ ## Set up the hooks
18
+
19
+ These pre-push hooks ensure that the formatter is run and the badges are updated every time you attempt to `git push`. This way formatting errors are caught and be corrected before they reach the GitHub continuous-integration (CI) step. The badges are then automatically up-to-date.
20
+
21
+ ```bash
22
+ git config --local core.hooksPath .githooks/
23
+ ```
24
+
25
+ ## Check the formatting
26
+
27
+ The formatting can be checked manually using:
28
+
29
+ ```bash
30
+ ./scripts/format.sh
31
+ ```
32
+
33
+ this is exactly the script that is run in the CI pipeline and the pre-push hook. Formatting uses `Prettier` for markdown, `shfmt` for shell scripts, and `ruff` for Python.
34
+
35
+ ## Run the tests
36
+
37
+ The tests can be run manually using:
38
+
39
+ ```bash
40
+ ./scripts/test.sh
41
+ ```
@@ -0,0 +1,21 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="90" height="20" role="img" aria-label="complexity: A">
2
+ <title>complexity: A</title>
3
+ <linearGradient id="s" x2="0" y2="100%">
4
+ <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
5
+ <stop offset="1" stop-opacity=".1"/>
6
+ </linearGradient>
7
+ <clipPath id="r">
8
+ <rect width="90" height="20" rx="3" fill="#fff"/>
9
+ </clipPath>
10
+ <g clip-path="url(#r)">
11
+ <rect width="71" height="20" fill="#555"/>
12
+ <rect x="71" width="19" height="20" fill="#97ca00"/>
13
+ <rect width="90" height="20" fill="url(#s)"/>
14
+ </g>
15
+ <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
16
+ <text aria-hidden="true" x="365.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="610">complexity</text>
17
+ <text x="365.0" y="140" transform="scale(.1)" fill="#fff" textLength="610">complexity</text>
18
+ <text aria-hidden="true" x="795.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="90">A</text>
19
+ <text x="795.0" y="140" transform="scale(.1)" fill="#fff" textLength="90">A</text>
20
+ </g>
21
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="122" height="20" role="img" aria-label="coverage: 100.00%"><title>coverage: 100.00%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="122" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="61" height="20" fill="#4c1"/><rect width="122" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="905" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">100.00%</text><text x="905" y="140" transform="scale(.1)" fill="#fff" textLength="510">100.00%</text></g></svg>
@@ -0,0 +1,21 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="90" height="20" role="img" aria-label="version: 0.1.0">
2
+ <title>version: 0.1.0</title>
3
+ <linearGradient id="s" x2="0" y2="100%">
4
+ <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
5
+ <stop offset="1" stop-opacity=".1"/>
6
+ </linearGradient>
7
+ <clipPath id="r">
8
+ <rect width="90" height="20" rx="3" fill="#fff"/>
9
+ </clipPath>
10
+ <g clip-path="url(#r)">
11
+ <rect width="51" height="20" fill="#555"/>
12
+ <rect x="51" width="39" height="20" fill="#97ca00"/>
13
+ <rect width="90" height="20" fill="url(#s)"/>
14
+ </g>
15
+ <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
16
+ <text aria-hidden="true" x="265.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">version</text>
17
+ <text x="265.0" y="140" transform="scale(.1)" fill="#fff" textLength="410">version</text>
18
+ <text aria-hidden="true" x="695.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="290">0.1.0</text>
19
+ <text x="695.0" y="140" transform="scale(.1)" fill="#fff" textLength="290">0.1.0</text>
20
+ </g>
21
+ </svg>
@@ -0,0 +1,45 @@
1
+ [project]
2
+ name = "cineon-api-format"
3
+ version = "3.0.0"
4
+ description = "A shared repository that describes the types used by the ELE-api, and other Cineon apis."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = [
8
+ "pydantic>=2.12.5",
9
+ "typeguard>=4.4.4",
10
+ "cineon-format (>=3.0.0,<4)",
11
+ ]
12
+
13
+ [dependency-groups]
14
+ dev = [
15
+ "coverage>=7.10.6",
16
+ "genbadge[coverage]>=1.1.2",
17
+ "isort>=6.0.1",
18
+ "mypy>=1.17.1",
19
+ "pytest>=8.4.1",
20
+ "radon>=6.0.1",
21
+ "ruff>=0.12.11",
22
+ ]
23
+
24
+ [build-system]
25
+ requires = ["hatchling"]
26
+ build-backend = "hatchling.build"
27
+
28
+ [tool.isort]
29
+ profile = "black"
30
+
31
+ [tool.uv]
32
+ keyring-provider = "subprocess"
33
+
34
+ [tool.uv.sources]
35
+ cineon-format = { index = "cineon-registry" }
36
+
37
+ [[tool.uv.index]]
38
+ name = "cineon-registry"
39
+ url = "https://europe-west2-python.pkg.dev/elengine-463909/cineon-registry/simple/"
40
+ publish-url = "https://europe-west2-python.pkg.dev/elengine-463909/cineon-registry/"
41
+ authenticate = "always"
42
+ explicit = true
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["src/cineon_api_format"]
@@ -0,0 +1,37 @@
1
+ import argparse
2
+
3
+ from genbadge import Badge
4
+
5
+ # A map between code-complexity scores and colours
6
+ COLOUR_MAP = {
7
+ "A": "green",
8
+ "B": "yellow",
9
+ "C": "orange",
10
+ "D": "red",
11
+ "E": "darkred",
12
+ "F": "black",
13
+ }
14
+
15
+ # Get the filepath from the command-line
16
+ parser = argparse.ArgumentParser()
17
+ parser.add_argument("--input-file", help="Path to the complexity report file")
18
+ parser.add_argument("--output-file", help="Path to save the generated badge")
19
+ args = parser.parse_args()
20
+ input_path = args.input_file
21
+ output_path = args.output_file
22
+
23
+ # Read the complexity report
24
+ with open(input_path, "r") as f:
25
+ complexity = f.read().strip()
26
+
27
+ # Extract the code complexity score
28
+ complexity_score = complexity.split("Average complexity:")[-1].strip()[0]
29
+ print(f"Score: {complexity_score}")
30
+
31
+ # Create the badge and save
32
+ b = Badge(
33
+ left_txt="complexity",
34
+ right_txt=complexity_score,
35
+ color=COLOUR_MAP[complexity_score],
36
+ )
37
+ b.write_to(output_path, use_shields=False)
@@ -0,0 +1,15 @@
1
+ import argparse
2
+ import os
3
+
4
+ from genbadge import Badge
5
+
6
+ import cineon_api_format
7
+
8
+ DEFAULT_BADGE_FILEPATH = os.path.join("badges", "version.svg")
9
+
10
+ parser = argparse.ArgumentParser()
11
+ parser.add_argument("--output-file", type=str, default=DEFAULT_BADGE_FILEPATH)
12
+ args = parser.parse_args()
13
+
14
+ b = Badge(left_txt="version", right_txt=str(cineon_api_format.__version__), color="green")
15
+ b.write_to(args.output_file, use_shields=False)
@@ -0,0 +1,26 @@
1
+ #!/bin/bash
2
+
3
+ # Ensure that the script exits if any commands fail
4
+ set -euo pipefail
5
+
6
+ ## --- Generate release version badge ---
7
+ VERSION_BADGE=badges/version.svg
8
+ uv run scripts/badges/version.py --output-file $VERSION_BADGE
9
+
10
+ ## --- Generate code coverage badge ---
11
+ ./scripts/test.sh
12
+ COVERAGE_FILE=coverage.xml
13
+ COVERAGE_BADGE=badges/coverage.svg
14
+ uv run coverage xml -o $COVERAGE_FILE
15
+ uv run genbadge coverage \
16
+ --input-file $COVERAGE_FILE \
17
+ --output-file $COVERAGE_BADGE
18
+ rm $COVERAGE_FILE
19
+
20
+ ## --- Generate complexity badge ---
21
+ COMPLEXITY_FILE=.complexity
22
+ COMPLEXITY_BADGE=badges/complexity.svg
23
+ uv run radon cc src/**/*.py -a >$COMPLEXITY_FILE
24
+ uv run scripts/badges/complexity.py \
25
+ --input-file $COMPLEXITY_FILE \
26
+ --output-file $COMPLEXITY_BADGE
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+
3
+ # Ensure that the script exits if any commands fail
4
+ set -euo pipefail
5
+
6
+ # Check the markdown formatting
7
+ npx prettier --check "**/*.md"
8
+
9
+ # Check the shell script formatting
10
+ shfmt --diff --indent 4 scripts
11
+
12
+ # Install dependencies
13
+ uv sync --locked --dev
14
+
15
+ # Check the Python formatting
16
+ DIRECTORIES=("src/" "tests/" "scripts/")
17
+ uv run isort --check "${DIRECTORIES[@]}"
18
+ uv run ruff check "${DIRECTORIES[@]}"
19
+ uv run mypy "${DIRECTORIES[@]}" --follow-untyped-imports
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+
3
+ # Ensure that the script exits if any commands fail
4
+ set -euo pipefail
5
+
6
+ # Build the package
7
+ uv build
8
+
9
+ # Publish using an OAuth2 access token from gcloud (via keyring)
10
+ uv publish --index cineon-registry \
11
+ --username oauth2accesstoken \
12
+ --keyring-provider subprocess
13
+
14
+ # Clean up built distributions
15
+ rm -f dist/*.tar.gz dist/*.whl
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ # Ensure that the script exits if any commands fail
4
+ set -euo pipefail
5
+
6
+ # Install dependencies
7
+ uv sync --locked --dev
8
+
9
+ # Run all tests
10
+ uv run coverage run -m pytest
11
+ uv run coverage report
@@ -0,0 +1,28 @@
1
+ from .definitions import Construct, Metric
2
+ from .requests import (
3
+ CineonInferenceRequest,
4
+ ClientInfo,
5
+ InferenceRequest,
6
+ )
7
+ from .responses import (
8
+ InferenceOutput,
9
+ InferenceResponse,
10
+ PingResponse,
11
+ RootResponse,
12
+ VersionResponse,
13
+ )
14
+ from .version import __version__
15
+
16
+ __all__ = [
17
+ "__version__",
18
+ "Metric",
19
+ "Construct",
20
+ "ClientInfo",
21
+ "InferenceRequest",
22
+ "CineonInferenceRequest",
23
+ "RootResponse",
24
+ "PingResponse",
25
+ "InferenceOutput",
26
+ "InferenceResponse",
27
+ "VersionResponse",
28
+ ]
@@ -0,0 +1,189 @@
1
+ from enum import Enum
2
+
3
+
4
+ # This is part of the public API, so do not change existing names!
5
+ class Construct(Enum):
6
+ stress = "stress"
7
+ workload = "workload"
8
+ fatigue = "fatigue"
9
+
10
+
11
+ class GazetoolsInput(Enum):
12
+ t = "t"
13
+ gaze_origin_x = "gaze_origin_x"
14
+ gaze_origin_y = "gaze_origin_y"
15
+ gaze_origin_z = "gaze_origin_z"
16
+ gaze_direction_x = "gaze_direction_x"
17
+ gaze_direction_y = "gaze_direction_y"
18
+ gaze_direction_z = "gaze_direction_z"
19
+ pupil_diameter = "pupil_diameter"
20
+ object_gazed_at = "object_gazed_at"
21
+ left_eye_openness = "left_eye_openness"
22
+ right_eye_openness = "right_eye_openness"
23
+
24
+
25
+ # This is part of the public API, so do not change existing names!
26
+ class Metric(Enum):
27
+
28
+ # Fixations
29
+ fixation_duration_mean = "fixation_duration_mean"
30
+ fixation_dispersion_median = "fixation_dispersion_median"
31
+ total_fixation_displacement_mean = "total_fixation_displacement_mean"
32
+
33
+ # Saccades
34
+ saccade_speed_mean = "saccade_speed_mean"
35
+ saccade_speed_max = "saccade_speed_max"
36
+ saccade_amplitude_max = "saccade_amplitude_max"
37
+ persistent_saccade_ratio = "persistent_saccade_ratio"
38
+ saccade_rate = "saccade_rate"
39
+ saccade_angular_amplitude_mean = "saccade_angular_amplitude_mean"
40
+ saccade_angular_amplitude_std = "saccade_angular_amplitude_std"
41
+ saccade_angular_speed_mean = "saccade_angular_speed_mean"
42
+ saccade_angular_speed_std = "saccade_angular_speed_std"
43
+ saccade_antipersistent_to_persistent_ratio = (
44
+ "saccade_antipersistent_to_persistent_ratio"
45
+ )
46
+ saccade_persistent_to_total_ratio = "saccade_persistent_to_total_ratio"
47
+
48
+ # Entropy
49
+ entropy_gaze = "entropy_gaze"
50
+ entropy_gaze_efficiency = "entropy_gaze_efficiency"
51
+
52
+ # Pupillometry
53
+ pupil_diameter_mean = "pupil_diameter_mean"
54
+ pupil_diameter_std = "pupil_diameter_std"
55
+
56
+ # Blinks
57
+ blink_rate = "blink_rate"
58
+ blink_duration_mean = "blink_duration_mean"
59
+ blink_duration_std = "blink_duration_std"
60
+ percent_eyes_closed = "percent_eyes_closed"
61
+
62
+ # Head kinematics
63
+ head_acceleration_mean = "head_acceleration_mean"
64
+ head_acceleration_std = "head_acceleration_std"
65
+
66
+ # Fixations
67
+ fixation_rate = "fixation_rate"
68
+ fixation_duration_std = "fixation_duration_std"
69
+ fixation_angular_distance_mean = "fixation_angular_distance_mean"
70
+ fixation_angular_distance_std = "fixation_angular_distance_std"
71
+ fixation_yaw_dispersion_mean = "fixation_yaw_dispersion_mean"
72
+ fixation_yaw_dispersion_std = "fixation_yaw_dispersion_std"
73
+ fixation_pitch_dispersion_mean = "fixation_pitch_dispersion_mean"
74
+ fixation_pitch_dispersion_std = "fixation_pitch_dispersion_std"
75
+
76
+
77
+ feature_groups: dict[str, list[Metric | GazetoolsInput]] = {
78
+ "traditional": [
79
+ # v2
80
+ Metric.fixation_duration_mean,
81
+ Metric.fixation_rate,
82
+ Metric.fixation_dispersion_median,
83
+ Metric.total_fixation_displacement_mean,
84
+ Metric.saccade_speed_mean,
85
+ Metric.saccade_rate,
86
+ Metric.saccade_speed_max,
87
+ Metric.saccade_amplitude_max,
88
+ Metric.persistent_saccade_ratio,
89
+ Metric.entropy_gaze_efficiency,
90
+ Metric.head_acceleration_mean,
91
+ # v3
92
+ Metric.head_acceleration_std,
93
+ Metric.fixation_duration_std,
94
+ Metric.fixation_angular_distance_mean,
95
+ Metric.fixation_angular_distance_std,
96
+ Metric.fixation_yaw_dispersion_mean,
97
+ Metric.fixation_yaw_dispersion_std,
98
+ Metric.fixation_pitch_dispersion_mean,
99
+ Metric.fixation_pitch_dispersion_std,
100
+ Metric.saccade_angular_amplitude_mean,
101
+ Metric.saccade_angular_amplitude_std,
102
+ Metric.saccade_angular_speed_std,
103
+ Metric.saccade_antipersistent_to_persistent_ratio,
104
+ Metric.entropy_gaze,
105
+ ],
106
+ "pupillometry": [
107
+ # v2
108
+ Metric.pupil_diameter_mean,
109
+ # v3
110
+ Metric.pupil_diameter_std,
111
+ ],
112
+ "blink": [
113
+ # v2
114
+ Metric.blink_rate,
115
+ Metric.blink_duration_mean,
116
+ Metric.percent_eyes_closed,
117
+ # v3
118
+ Metric.blink_duration_std,
119
+ ],
120
+ # Deep-learning models do not take labelled DataFrame data
121
+ # Because of this input data is fed to the models in the order below
122
+ # This order must match what the model is expecting(!)
123
+ "deep_learning": [
124
+ GazetoolsInput.gaze_origin_x,
125
+ GazetoolsInput.gaze_origin_y,
126
+ GazetoolsInput.gaze_origin_z,
127
+ GazetoolsInput.gaze_direction_x,
128
+ GazetoolsInput.gaze_direction_y,
129
+ GazetoolsInput.gaze_direction_z,
130
+ GazetoolsInput.pupil_diameter,
131
+ GazetoolsInput.left_eye_openness,
132
+ GazetoolsInput.right_eye_openness,
133
+ ],
134
+ # Python models don't explicitly require features, and instead accept
135
+ # a `model_dump` from CineonData, that is then serialised into JSON
136
+ "python_model_features": [],
137
+ }
138
+
139
+ # Necessary because the ml-pipeline has different nomenclature
140
+ ml_metric_names: dict[Metric, str] = {
141
+ Metric.fixation_duration_mean: "MeanFixationDuration",
142
+ Metric.fixation_rate: "MeanFixationRate",
143
+ Metric.fixation_dispersion_median: "median_fix_dispersion",
144
+ Metric.total_fixation_displacement_mean: "mean_total_fix_displacement",
145
+ Metric.saccade_speed_mean: "MeanSaccadeVelocity",
146
+ Metric.saccade_rate: "MeanSaccadeRate",
147
+ Metric.saccade_speed_max: "PeakSaccadeVelocity",
148
+ Metric.saccade_amplitude_max: "SaccadeAmplitude",
149
+ Metric.persistent_saccade_ratio: "PersistenceSaccsRatio",
150
+ Metric.head_acceleration_mean: "MeanHeadAccel",
151
+ Metric.entropy_gaze_efficiency: "Entropy",
152
+ Metric.pupil_diameter_mean: "PupilDiameterMean",
153
+ }
154
+
155
+ gazetools_metric_names: dict[Metric, str] = {
156
+ Metric.fixation_duration_mean: "fixations.duration.mean",
157
+ Metric.fixation_rate: "fixations.rate",
158
+ # TODO should this be `yaw_dispersion` or `pitch_dispersion`?
159
+ Metric.fixation_dispersion_median: "fixations.yaw_dispersion.median",
160
+ Metric.total_fixation_displacement_mean: "fixations.angular_displacement.mean",
161
+ Metric.saccade_speed_mean: "saccades.angular_speed.mean",
162
+ Metric.saccade_rate: "saccades.rate",
163
+ Metric.saccade_speed_max: "saccades.angular_speed.max",
164
+ Metric.saccade_amplitude_max: "saccades.angular_straight_amplitude.max",
165
+ Metric.persistent_saccade_ratio: "saccades.persistent_to_total_ratio",
166
+ Metric.head_acceleration_mean: "head_kinematics.acceleration.mean",
167
+ Metric.pupil_diameter_mean: "pupillometry.diameter.mean",
168
+ Metric.blink_rate: "blinks.rate",
169
+ Metric.blink_duration_mean: "blinks.duration.mean",
170
+ Metric.percent_eyes_closed: "blinks.percent_eyes_closed",
171
+ Metric.head_acceleration_std: "head_kinematics.acceleration.std",
172
+ Metric.fixation_duration_std: "fixations.duration.std",
173
+ Metric.fixation_angular_distance_mean: "fixations.angular_distance.mean",
174
+ Metric.fixation_angular_distance_std: "fixations.angular_distance.std",
175
+ Metric.fixation_yaw_dispersion_mean: "fixations.yaw_dispersion.mean",
176
+ Metric.fixation_yaw_dispersion_std: "fixations.yaw_dispersion.std",
177
+ Metric.fixation_pitch_dispersion_mean: "fixations.pitch_dispersion.mean",
178
+ Metric.fixation_pitch_dispersion_std: "fixations.pitch_dispersion.std",
179
+ Metric.saccade_angular_amplitude_mean: "saccades.angular_straight_amplitude.mean",
180
+ Metric.saccade_angular_amplitude_std: "saccades.angular_straight_amplitude.std",
181
+ Metric.saccade_angular_speed_mean: "saccades.angular_speed.mean",
182
+ Metric.saccade_angular_speed_std: "saccades.angular_speed.std",
183
+ Metric.saccade_antipersistent_to_persistent_ratio: "saccades.antipersistent_to_persistent_ratio",
184
+ Metric.saccade_persistent_to_total_ratio: "saccades.persistent_to_total_ratio",
185
+ Metric.entropy_gaze: "entropy.gaze",
186
+ Metric.entropy_gaze_efficiency: "entropy.gaze_efficiency",
187
+ Metric.blink_duration_std: "blinks.duration.std",
188
+ Metric.pupil_diameter_std: "pupillometry.diameter.std",
189
+ }