eyedentify3d 1.0.0__py3-none-any.whl
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.
- eyedentify3d/__init__.py +16 -0
- eyedentify3d/error_type.py +30 -0
- eyedentify3d/time_range.py +56 -0
- eyedentify3d/version.py +1 -0
- eyedentify3d-1.0.0.dist-info/METADATA +57 -0
- eyedentify3d-1.0.0.dist-info/RECORD +9 -0
- eyedentify3d-1.0.0.dist-info/WHEEL +5 -0
- eyedentify3d-1.0.0.dist-info/licenses/LICENSE +21 -0
- eyedentify3d-1.0.0.dist-info/top_level.txt +1 -0
eyedentify3d/__init__.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from .data_parsers.htc_vive_pro_data import HtcViveProData
|
|
2
|
+
from .data_parsers.reduced_data import ReducedData
|
|
3
|
+
from .error_type import ErrorType
|
|
4
|
+
from .identification.gaze_behavior_identifier import GazeBehaviorIdentifier
|
|
5
|
+
from .time_range import TimeRange
|
|
6
|
+
from .version import __version__
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"HtcViveProData",
|
|
11
|
+
"ReducedData",
|
|
12
|
+
"ErrorType",
|
|
13
|
+
"GazeBehaviorIdentifier",
|
|
14
|
+
"TimeRange",
|
|
15
|
+
"__version__",
|
|
16
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ErrorType(Enum):
|
|
5
|
+
"""This enum defines the way errors are handled"""
|
|
6
|
+
|
|
7
|
+
SKIP = "continues silently on errors"
|
|
8
|
+
PRINT = "prints the error message to the console"
|
|
9
|
+
FILE = "print the error message to a file"
|
|
10
|
+
RAISE = "raises an exception on errors"
|
|
11
|
+
|
|
12
|
+
def __call__(self, error_str: str) -> None:
|
|
13
|
+
"""
|
|
14
|
+
Handle the error based on the enum type
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
error_str: The error message to handle
|
|
19
|
+
"""
|
|
20
|
+
if self == ErrorType.FILE:
|
|
21
|
+
with open("bad_data_files.txt", "a") as bad_data_file:
|
|
22
|
+
bad_data_file.write(error_str + "\n")
|
|
23
|
+
elif self == ErrorType.PRINT:
|
|
24
|
+
print(error_str, end="")
|
|
25
|
+
elif self == ErrorType.SKIP:
|
|
26
|
+
pass
|
|
27
|
+
elif self == ErrorType.RAISE:
|
|
28
|
+
raise RuntimeError(error_str)
|
|
29
|
+
else:
|
|
30
|
+
raise ValueError(f"Unknown error type: {self}")
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TimeRange:
|
|
5
|
+
"""A class to represent a time range for data processing in trials."""
|
|
6
|
+
|
|
7
|
+
def __init__(self, min_time: float = 0, max_time: float = float("inf")) -> None:
|
|
8
|
+
"""
|
|
9
|
+
Parameters
|
|
10
|
+
----------
|
|
11
|
+
min_time: The time at which to start considering the data in the trial.
|
|
12
|
+
max_time: The time at which to stop considering the data in the trial.
|
|
13
|
+
"""
|
|
14
|
+
if min_time > max_time:
|
|
15
|
+
raise ValueError("The min_time must be less than or equal to the max_time.")
|
|
16
|
+
|
|
17
|
+
self.min_time = min_time
|
|
18
|
+
self.max_time = max_time
|
|
19
|
+
|
|
20
|
+
def get_indices(self, time_vector: np.ndarray):
|
|
21
|
+
"""
|
|
22
|
+
Get the indices of the time vector that fall within the specified time range.
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
time_vector: A numpy array of time values.
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
A numpy array of indices where the time values are within the specified range.
|
|
31
|
+
"""
|
|
32
|
+
if np.any(time_vector[-1:] - time_vector[:-1] < 0):
|
|
33
|
+
raise ValueError("The time vector must be strictly increasing.")
|
|
34
|
+
|
|
35
|
+
if np.all(time_vector < self.min_time) or np.all(time_vector > self.max_time):
|
|
36
|
+
# If all values are outside the range, return an empty array
|
|
37
|
+
return np.array([], dtype=int)
|
|
38
|
+
|
|
39
|
+
# This approach is less clean but is robust no NaNs in the time_vector
|
|
40
|
+
beginning_idx = np.where(time_vector >= self.min_time)[0]
|
|
41
|
+
end_idx = np.where(time_vector > self.max_time)[0]
|
|
42
|
+
|
|
43
|
+
if len(beginning_idx) == 0:
|
|
44
|
+
beginning_idx = 0
|
|
45
|
+
else:
|
|
46
|
+
beginning_idx = beginning_idx[0]
|
|
47
|
+
|
|
48
|
+
if len(end_idx) == 0:
|
|
49
|
+
end_idx = len(time_vector)
|
|
50
|
+
else:
|
|
51
|
+
end_idx = end_idx[0]
|
|
52
|
+
|
|
53
|
+
if beginning_idx >= end_idx:
|
|
54
|
+
return np.array([], dtype=int)
|
|
55
|
+
else:
|
|
56
|
+
return np.arange(beginning_idx, end_idx)
|
eyedentify3d/version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: eyedentify3d
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A package to identify gaze behavior from 3D eye-tracking data.
|
|
5
|
+
Home-page: https://github.com/EveCharbie/EyeDentify3D
|
|
6
|
+
Author: Eve Charbonneau
|
|
7
|
+
Author-email: EveCharbie <eve.charbie@gmail.com>
|
|
8
|
+
Project-URL: Documentation, https://github.com/EveCharbie/EyeDentify3d/tree/main#readme
|
|
9
|
+
Project-URL: Source, https://github.com/EveCharbie/EyeDentify3d
|
|
10
|
+
Project-URL: Tracker, https://github.com/EveCharbie/EyeDentify3d/issues
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: scipy
|
|
17
|
+
Requires-Dist: numpy
|
|
18
|
+
Requires-Dist: matplotlib
|
|
19
|
+
Requires-Dist: pandas
|
|
20
|
+
Requires-Dist: pingouin
|
|
21
|
+
Provides-Extra: test
|
|
22
|
+
Requires-Dist: pytest; extra == "test"
|
|
23
|
+
Requires-Dist: black; extra == "test"
|
|
24
|
+
Dynamic: author
|
|
25
|
+
Dynamic: home-page
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# EyeDentify3D: A Python package for gaze behavior classification of 3D eye-tracking data
|
|
29
|
+
|
|
30
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-success" alt="License"/></a>
|
|
31
|
+
[](https://github.com/EveCharbie/EyeDentify3d/actions)
|
|
32
|
+
[](https://codecov.io/gh/EveCharbie/EyeDentify3d)
|
|
33
|
+
[](https://doi.org/10.5281/zenodo.14718072)
|
|
34
|
+
[](https://qlty.sh/gh/EveCharbie/projects/EyeDentify3d)
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
The easiest way to install `EyeDentify3D` is to use pip:
|
|
38
|
+
```bash
|
|
39
|
+
pip install eyedentify3d
|
|
40
|
+
```
|
|
41
|
+
or conda-forge:
|
|
42
|
+
```bash
|
|
43
|
+
conda install -c conda-forge eyedentify3d
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you prefer to install from source, you can clone the repository and create a conda environment with the required dependencies:
|
|
47
|
+
```bash
|
|
48
|
+
conda env create -f environment.yml
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
you can find the paper accompanying our JOSS submission [here](paper/paper.pdf) and a deeper documentation of the
|
|
53
|
+
package features and underlying mathematical choices [here](https://evecharbie.github.io/EyeDentify3d).
|
|
54
|
+
|
|
55
|
+
## Examples
|
|
56
|
+
Examples of usage can be found in the [examples](examples/) directory.
|
|
57
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
eyedentify3d/__init__.py,sha256=ivZn7z1KxZ8nX_NTYjsPuvTnzEbMcjSWyzOXBBK1-vs,427
|
|
2
|
+
eyedentify3d/error_type.py,sha256=NVZLteIYRh29cF96KZiP9hHFSVYh2OfuqDVu2QBVeTc,936
|
|
3
|
+
eyedentify3d/time_range.py,sha256=A1RSWCLgeuN9FECpJzteKzZrvzlg-7XTN1nyEIO9kSA,1918
|
|
4
|
+
eyedentify3d/version.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
|
|
5
|
+
eyedentify3d-1.0.0.dist-info/licenses/LICENSE,sha256=pHnyhUi4V8m5saDcAe2UC1vs6FzwUOcgWqa1qCVfUIE,1067
|
|
6
|
+
eyedentify3d-1.0.0.dist-info/METADATA,sha256=XS1nutaOZ3VtjMmJ4tRG-Tv0OncrHflkbVrPvF0Th7A,2361
|
|
7
|
+
eyedentify3d-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
eyedentify3d-1.0.0.dist-info/top_level.txt,sha256=M0UGHm62LzHbtY2qlncTLCo1zKWSe7KKUq0YlrHKS-A,13
|
|
9
|
+
eyedentify3d-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 EveCharbie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
eyedentify3d
|