pypillometry 1.0.2__tar.gz → 2.0a2__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.
Files changed (57) hide show
  1. pypillometry-2.0a2/LICENSE +21 -0
  2. pypillometry-2.0a2/PKG-INFO +76 -0
  3. pypillometry-2.0a2/README.md +40 -0
  4. pypillometry-2.0a2/docs/conf.py +135 -0
  5. pypillometry-2.0a2/docs/examples/pypillometry_conf.py +345 -0
  6. pypillometry-2.0a2/pypillometry/__init__.py +120 -0
  7. {pypillometry-1.0.2 → pypillometry-2.0a2}/pypillometry/convenience.py +126 -53
  8. pypillometry-2.0a2/pypillometry/data/002_rlmw_events_short.asc +1644 -0
  9. pypillometry-2.0a2/pypillometry/data/002_rlmw_samples_short.asc +20465 -0
  10. pypillometry-2.0a2/pypillometry/erpd.py +246 -0
  11. pypillometry-2.0a2/pypillometry/example_data.py +201 -0
  12. pypillometry-2.0a2/pypillometry/eyedata/__init__.py +28 -0
  13. pypillometry-2.0a2/pypillometry/eyedata/eyedata.py +231 -0
  14. pypillometry-2.0a2/pypillometry/eyedata/eyedatadict.py +529 -0
  15. {pypillometry-1.0.2/pypillometry → pypillometry-2.0a2/pypillometry/eyedata}/fakedata.py +24 -28
  16. pypillometry-2.0a2/pypillometry/eyedata/gazedata.py +297 -0
  17. pypillometry-2.0a2/pypillometry/eyedata/generic.py +1203 -0
  18. pypillometry-2.0a2/pypillometry/eyedata/pupildata.py +576 -0
  19. pypillometry-2.0a2/pypillometry/intervals.py +118 -0
  20. pypillometry-2.0a2/pypillometry/io.py +356 -0
  21. pypillometry-2.0a2/pypillometry/plot/__init__.py +13 -0
  22. pypillometry-2.0a2/pypillometry/plot/eyeplotter.py +5 -0
  23. pypillometry-2.0a2/pypillometry/plot/gazeplotter.py +207 -0
  24. pypillometry-2.0a2/pypillometry/plot/genplotter.py +276 -0
  25. pypillometry-2.0a2/pypillometry/plot/pupilplotter.py +213 -0
  26. pypillometry-2.0a2/pypillometry/signal/__init__.py +11 -0
  27. {pypillometry-1.0.2/pypillometry → pypillometry-2.0a2/pypillometry/signal}/baseline.py +28 -90
  28. {pypillometry-1.0.2/pypillometry → pypillometry-2.0a2/pypillometry/signal}/preproc.py +28 -3
  29. {pypillometry-1.0.2/pypillometry → pypillometry-2.0a2/pypillometry/signal}/pupil.py +12 -63
  30. pypillometry-2.0a2/pypillometry/stan/baseline_model_asym_laplac.stan +60 -0
  31. pypillometry-2.0a2/pypillometry.egg-info/PKG-INFO +76 -0
  32. pypillometry-2.0a2/pypillometry.egg-info/SOURCES.txt +44 -0
  33. {pypillometry-1.0.2 → pypillometry-2.0a2}/pypillometry.egg-info/requires.txt +6 -1
  34. pypillometry-2.0a2/pypillometry.egg-info/top_level.txt +7 -0
  35. {pypillometry-1.0.2 → pypillometry-2.0a2}/setup.py +13 -3
  36. pypillometry-2.0a2/tests/__init__.py +0 -0
  37. pypillometry-2.0a2/tests/test_convenience.py +109 -0
  38. pypillometry-2.0a2/tests/test_eyedata.py +389 -0
  39. pypillometry-2.0a2/tests/test_eyedatadict.py +376 -0
  40. pypillometry-2.0a2/tests/test_gazedata.py +47 -0
  41. pypillometry-2.0a2/tests/test_io.py +100 -0
  42. {pypillometry-1.0.2/pypillometry → pypillometry-2.0a2}/tests/test_pupil.py +4 -4
  43. pypillometry-2.0a2/tests/test_pupildata.py +44 -0
  44. pypillometry-1.0.2/PKG-INFO +0 -34
  45. pypillometry-1.0.2/README.md +0 -20
  46. pypillometry-1.0.2/pypillometry/__init__.py +0 -16
  47. pypillometry-1.0.2/pypillometry/erpd.py +0 -184
  48. pypillometry-1.0.2/pypillometry/io.py +0 -54
  49. pypillometry-1.0.2/pypillometry/pupildata.py +0 -1656
  50. pypillometry-1.0.2/pypillometry/tests/test_io.py +0 -32
  51. pypillometry-1.0.2/pypillometry/tests/test_pdata.py +0 -116
  52. pypillometry-1.0.2/pypillometry.egg-info/PKG-INFO +0 -34
  53. pypillometry-1.0.2/pypillometry.egg-info/SOURCES.txt +0 -20
  54. pypillometry-1.0.2/pypillometry.egg-info/top_level.txt +0 -1
  55. {pypillometry-1.0.2/pypillometry/tests → pypillometry-2.0a2/pypillometry/data}/__init__.py +0 -0
  56. {pypillometry-1.0.2 → pypillometry-2.0a2}/pypillometry.egg-info/dependency_links.txt +0 -0
  57. {pypillometry-1.0.2 → pypillometry-2.0a2}/setup.cfg +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Matthias Mittner
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,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: pypillometry
3
+ Version: 2.0a2
4
+ Summary: Pupillometry in Python.
5
+ Home-page: https://github.com/ihrke/pypillometry
6
+ Author: Matthias Mittner
7
+ Author-email: matthias.mittner@uit.no
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: numpy
15
+ Requires-Dist: scipy
16
+ Requires-Dist: cmdstanpy
17
+ Requires-Dist: matplotlib
18
+ Requires-Dist: pandas
19
+ Requires-Dist: typing
20
+ Requires-Dist: requests
21
+ Requires-Dist: loguru
22
+ Requires-Dist: tqdm
23
+ Requires-Dist: pytest
24
+ Requires-Dist: pytest-cov
25
+ Requires-Dist: h5py
26
+ Dynamic: author
27
+ Dynamic: author-email
28
+ Dynamic: classifier
29
+ Dynamic: description
30
+ Dynamic: description-content-type
31
+ Dynamic: home-page
32
+ Dynamic: license-file
33
+ Dynamic: requires-dist
34
+ Dynamic: requires-python
35
+ Dynamic: summary
36
+
37
+ # Welcome to pypillometry (v2)!
38
+
39
+ [![GitHub issues](https://img.shields.io/github/issues/ihrke/pypillometry)](https://github.com/ihrke/pypillometry/issues)
40
+ [![status](https://joss.theoj.org/papers/3b06f4f3d5b703fd99c7e622b7edebe4/status.svg)](https://joss.theoj.org/papers/3b06f4f3d5b703fd99c7e622b7edebe4)
41
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3925528.svg)](https://doi.org/10.5281/zenodo.3925528)
42
+ [![codecov](https://codecov.io/gh/ihrke/pypillometry/graph/badge.svg?token=BFSKNGT772)](https://codecov.io/gh/ihrke/pypillometry)
43
+ [![tests](https://github.com/ihrke/pypillometry/actions/workflows/run-tests.yml/badge.svg)](https://github.com/ihrke/pypillometry/actions/workflows/run-tests.yml)
44
+
45
+
46
+
47
+ [![GitHub release](https://img.shields.io/github/release/ihrke/pypillometry.svg)](https://gitHub.com/ihrke/pypillometry/releases/)
48
+ [![PyPI version](https://badge.fury.io/py/pypillometry.svg)](https://badge.fury.io/py/pypillometry)
49
+
50
+
51
+ ![](https://raw.githubusercontent.com/ihrke/pypillometry/master/logo/pypillometry_logo_200x200.png?token=AAIWMEINEM6MUOAPT2NV4I252K5QW)
52
+
53
+ > [!NOTE]
54
+ > This is `pypillometry` version 2 that contains a major restructuring of the code. Scripts written for version 1 will not continue to work. The reason for the update is that the new version will be able to handle eyetracking-data in addition to pupillometry data (and it will be able to handle more than one eye and other data sources at the same time).
55
+ >
56
+ > The documentation for v2 is currently incomplete and broken as we focus on developing the new API.
57
+ >
58
+ > - Version 1 is here: [pypillometry version 1](https://github.com/ihrke/pypillometry/tree/v1)
59
+ > - Documentation for Version 1 is here: [pypillometry docs v1](https://ihrke.github.io/pypillometry/v1/html/index.html)
60
+ >
61
+
62
+ This package implements functions for the analysis of pupillometric and eyetracking data. Features include preprocessing, blink handling, event-related pupil-dilation, plotting and signal modeling.
63
+
64
+ - Github-repository: <https://github.com/ihrke/pypillometry>
65
+
66
+ - Homepage/Documentation: <https://ihrke.github.io/pypillometry/>
67
+
68
+
69
+
70
+ ---
71
+
72
+ The project is maintained by Matthias Mittner <matthias.mittner@uit.no>
73
+
74
+ To report a bug or recommend a new feature, please use [github's issue tracker](https://github.com/ihrke/pypillometry/issues).
75
+
76
+ For more details about how to contribute, please see the [contribution-section](https://ihrke.github.io/pypillometry/docs/dev.html) in the documentation.
@@ -0,0 +1,40 @@
1
+ # Welcome to pypillometry (v2)!
2
+
3
+ [![GitHub issues](https://img.shields.io/github/issues/ihrke/pypillometry)](https://github.com/ihrke/pypillometry/issues)
4
+ [![status](https://joss.theoj.org/papers/3b06f4f3d5b703fd99c7e622b7edebe4/status.svg)](https://joss.theoj.org/papers/3b06f4f3d5b703fd99c7e622b7edebe4)
5
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3925528.svg)](https://doi.org/10.5281/zenodo.3925528)
6
+ [![codecov](https://codecov.io/gh/ihrke/pypillometry/graph/badge.svg?token=BFSKNGT772)](https://codecov.io/gh/ihrke/pypillometry)
7
+ [![tests](https://github.com/ihrke/pypillometry/actions/workflows/run-tests.yml/badge.svg)](https://github.com/ihrke/pypillometry/actions/workflows/run-tests.yml)
8
+
9
+
10
+
11
+ [![GitHub release](https://img.shields.io/github/release/ihrke/pypillometry.svg)](https://gitHub.com/ihrke/pypillometry/releases/)
12
+ [![PyPI version](https://badge.fury.io/py/pypillometry.svg)](https://badge.fury.io/py/pypillometry)
13
+
14
+
15
+ ![](https://raw.githubusercontent.com/ihrke/pypillometry/master/logo/pypillometry_logo_200x200.png?token=AAIWMEINEM6MUOAPT2NV4I252K5QW)
16
+
17
+ > [!NOTE]
18
+ > This is `pypillometry` version 2 that contains a major restructuring of the code. Scripts written for version 1 will not continue to work. The reason for the update is that the new version will be able to handle eyetracking-data in addition to pupillometry data (and it will be able to handle more than one eye and other data sources at the same time).
19
+ >
20
+ > The documentation for v2 is currently incomplete and broken as we focus on developing the new API.
21
+ >
22
+ > - Version 1 is here: [pypillometry version 1](https://github.com/ihrke/pypillometry/tree/v1)
23
+ > - Documentation for Version 1 is here: [pypillometry docs v1](https://ihrke.github.io/pypillometry/v1/html/index.html)
24
+ >
25
+
26
+ This package implements functions for the analysis of pupillometric and eyetracking data. Features include preprocessing, blink handling, event-related pupil-dilation, plotting and signal modeling.
27
+
28
+ - Github-repository: <https://github.com/ihrke/pypillometry>
29
+
30
+ - Homepage/Documentation: <https://ihrke.github.io/pypillometry/>
31
+
32
+
33
+
34
+ ---
35
+
36
+ The project is maintained by Matthias Mittner <matthias.mittner@uit.no>
37
+
38
+ To report a bug or recommend a new feature, please use [github's issue tracker](https://github.com/ihrke/pypillometry/issues).
39
+
40
+ For more details about how to contribute, please see the [contribution-section](https://ihrke.github.io/pypillometry/docs/dev.html) in the documentation.
@@ -0,0 +1,135 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # This file only contains a selection of the most common options. For a full
4
+ # list see the documentation:
5
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
+
7
+ # -- Path setup --------------------------------------------------------------
8
+
9
+ # If extensions (or modules to document with autodoc) are in another directory,
10
+ # add these directories to sys.path here. If the directory is relative to the
11
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
12
+ #
13
+ import os
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ #sys.path.insert(0, str(Path('.').resolve()))
18
+
19
+
20
+ # -- Project information -----------------------------------------------------
21
+
22
+ project = 'pypillometry'
23
+ copyright = '2020, Matthias Mittner'
24
+ author = 'Matthias Mittner'
25
+
26
+
27
+ # -- General configuration ---------------------------------------------------
28
+
29
+ # Add any Sphinx extension module names here, as strings. They can be
30
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
31
+ # ones.
32
+ extensions=['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.napoleon',
33
+ "sphinx.ext.doctest", 'sphinx.ext.viewcode', ## enable doctests
34
+ "sphinxcontrib.mermaid", ## enable mermaid diagrams
35
+ 'sphinx_math_dollar', 'sphinx.ext.mathjax', 'sphinx_autodoc_typehints',
36
+ #"sphinx_mdinclude", ## include markdown files
37
+ "myst_parser", ## enable myst-parser
38
+ 'sphinx.ext.intersphinx', 'sphinx.ext.autosummary',
39
+ "nbsphinx", ## enable jupyter notebooks
40
+ "numpydoc" ## enable numpy-style docstrings
41
+ ]
42
+
43
+ myst_enable_extensions = ["colon_fence"]
44
+
45
+ nbsphinx_epilog = """
46
+
47
+ .. raw:: html
48
+
49
+ <div class="admonition note">
50
+ This file was created from the following Jupyter-notebook: <a href="https://github.com/ihrke/pypillometry/tree/master/{{ env.doc2path(env.docname, base=None) }}">{{ env.doc2path(env.docname, base=None) }}</a>
51
+ <br>
52
+ Interactive version:
53
+ <a href="https://mybinder.org/v2/gh/ihrke/pypillometry/master?filepath={{ env.doc2path(env.docname, base=None)|e }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>
54
+ </div>
55
+
56
+ """
57
+
58
+ # do not create TOC entries for each function/class
59
+ toc_object_entries = False
60
+
61
+ nbsphinx_prolog=nbsphinx_epilog
62
+
63
+ # List of patterns, relative to source directory, that match files and
64
+ # directories to ignore when looking for source files.
65
+ # This pattern also affects html_static_path and html_extra_path.
66
+ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints', 'notebooks', "**nbsphinx", "docs/html", "src", "docs/v1"]
67
+
68
+
69
+ # Add mappings
70
+ intersphinx_mapping = {
71
+ 'urllib3': ('http://urllib3.readthedocs.org/en/latest', None),
72
+ 'python': ('http://docs.python.org/3', None),
73
+ 'numpy': ('http://docs.scipy.org/doc/numpy', None),
74
+ 'scipy': ('http://docs.scipy.org/doc/scipy/reference', None),
75
+ 'matplotlib': ('http://matplotlib.sourceforge.net', None),
76
+ 'pystan': ('https://pystan.readthedocs.io/en/latest/', None),
77
+ }
78
+
79
+ # Add any paths that contain templates here, relative to this directory.
80
+ templates_path = ['_templates']
81
+
82
+
83
+ # -- Options for HTML output -------------------------------------------------
84
+ pygments_style = 'sphinx'
85
+ # The theme to use for HTML and HTML Help pages. See the documentation for
86
+ # a list of builtin themes.
87
+ #
88
+ html_theme = 'nature'
89
+ #alabaster'
90
+
91
+ html_logo = "../logo/pypillometry_logo_200x200.png"
92
+
93
+ # Add any paths that contain custom static files (such as style sheets) here,
94
+ # relative to this directory. They are copied after the builtin static files,
95
+ # so a file named "default.css" will overwrite the builtin "default.css".
96
+ html_static_path = ['_static']
97
+
98
+
99
+ _GITHUB_ADMONITIONS = {
100
+ "> [!NOTE]": "note",
101
+ "> [!TIP]": "tip",
102
+ "> [!IMPORTANT]": "important",
103
+ "> [!WARNING]": "warning",
104
+ "> [!CAUTION]": "caution",
105
+ }
106
+
107
+ def run_convert_github_admonitions_to_rst(app, relative_path, parent_docname, lines):
108
+ print("HOOK:", relative_path, parent_docname)
109
+ # loop through lines, replace github admonitions
110
+ for i, orig_line in enumerate(lines):
111
+ orig_line_splits = orig_line.split("\n")
112
+ replacing = False
113
+ for j, line in enumerate(orig_line_splits):
114
+ # look for admonition key
115
+ for admonition_key in _GITHUB_ADMONITIONS:
116
+ if admonition_key in line:
117
+ line = line.replace(admonition_key, ":::{" + _GITHUB_ADMONITIONS[admonition_key] + "}\n")
118
+ # start replacing quotes in subsequent lines
119
+ replacing = True
120
+ break
121
+ else:
122
+ # replace indent to match directive
123
+ if replacing and "> " in line:
124
+ line = line.replace("> ", " ")
125
+ elif replacing:
126
+ # missing "> ", so stop replacing and terminate directive
127
+ line = f"\n:::\n{line}"
128
+ replacing = False
129
+ # swap line back in splits
130
+ orig_line_splits[j] = line
131
+ # swap line back in original
132
+ lines[i] = "\n".join(orig_line_splits)
133
+
134
+ def setup(app):
135
+ app.connect('include-read', run_convert_github_admonitions_to_rst)
@@ -0,0 +1,345 @@
1
+ """
2
+ Configuration file for the RLMW study.
3
+ This file contains information about the raw data files and how to read them.
4
+ """
5
+ import pypillometry as pp
6
+ import pandas as pd
7
+ import os
8
+ import numpy as np
9
+
10
+
11
+ # Additional study metadata
12
+ study_info = {
13
+ "name": "RLMW Study",
14
+ "osf_id": "ca95r",
15
+ "description": "Reinforcement learning study with mind wandering probes",
16
+ "author": "Matthias Mittner",
17
+ "doi": "",
18
+ "date": "2024-04-10",
19
+ "sampling_rate": 1000.0, # Hz
20
+ "time_unit": "ms",
21
+ "screen_eye_distance": 60, # cm (distance between screen and eye)
22
+ "screen_resolution": (1280,1024), # pixels (width, height)
23
+ "physical_screen_size": (30, 20) # cm (width, height)
24
+ }
25
+
26
+
27
+ # Dictionary of raw data files to be downloaded
28
+ # Keys are participant IDs, values are dictionaries containing paths to .asc files
29
+ raw_data = {
30
+ "001": {
31
+ "events": "data/eyedata/asc/001_rlmw_events.asc",
32
+ "samples": "data/eyedata/asc/001_rlmw_samples.asc"
33
+ },
34
+ "002": {
35
+ "events": "data/eyedata/asc/002_rlmw_events.asc",
36
+ "samples": "data/eyedata/asc/002_rlmw_samples.asc"
37
+ },
38
+ "003": {
39
+ "events": "data/eyedata/asc/003_rlmw_events.asc",
40
+ "samples": "data/eyedata/asc/003_rlmw_samples.asc"
41
+ },
42
+ "004": {
43
+ "events": "data/eyedata/asc/004_rlmw_events.asc",
44
+ "samples": "data/eyedata/asc/004_rlmw_samples.asc"
45
+ },
46
+ "005": {
47
+ "events": "data/eyedata/asc/005_rlmw_events.asc",
48
+ "samples": "data/eyedata/asc/005_rlmw_samples.asc"
49
+ },
50
+ "006": {
51
+ "events": "data/eyedata/asc/006_rlmw_events.asc",
52
+ "samples": "data/eyedata/asc/006_rlmw_samples.asc"
53
+ },
54
+ "007": {
55
+ "events": "data/eyedata/asc/007_rlmw_events.asc",
56
+ "samples": "data/eyedata/asc/007_rlmw_samples.asc"
57
+ },
58
+ "008": {
59
+ "events": "data/eyedata/asc/008_rlmw_events.asc",
60
+ "samples": "data/eyedata/asc/008_rlmw_samples.asc"
61
+ },
62
+ "009": {
63
+ "events": "data/eyedata/asc/009_rlmw_events.asc",
64
+ "samples": "data/eyedata/asc/009_rlmw_samples.asc"
65
+ },
66
+ "010": {
67
+ "events": "data/eyedata/asc/010_rlmw_events.asc",
68
+ "samples": "data/eyedata/asc/010_rlmw_samples.asc"
69
+ },
70
+ "011": {
71
+ "events": "data/eyedata/asc/011_rlmw_events.asc",
72
+ "samples": "data/eyedata/asc/011_rlmw_samples.asc"
73
+ },
74
+ "012": {
75
+ "events": "data/eyedata/asc/012_rlmw_events.asc",
76
+ "samples": "data/eyedata/asc/012_rlmw_samples.asc"
77
+ },
78
+ "013": {
79
+ "events": "data/eyedata/asc/013_rlmw_events.asc",
80
+ "samples": "data/eyedata/asc/013_rlmw_samples.asc"
81
+ },
82
+ "014": {
83
+ "events": "data/eyedata/asc/014_rlmw_events.asc",
84
+ "samples": "data/eyedata/asc/014_rlmw_samples.asc"
85
+ },
86
+ "015": {
87
+ "events": "data/eyedata/asc/015_rlmw_events.asc",
88
+ "samples": "data/eyedata/asc/015_rlmw_samples.asc"
89
+ },
90
+ "016": {
91
+ "events": "data/eyedata/asc/016_rlmw_events.asc",
92
+ "samples": "data/eyedata/asc/016_rlmw_samples.asc"
93
+ },
94
+ "017": {
95
+ "events": "data/eyedata/asc/017_rlmw_events.asc",
96
+ "samples": "data/eyedata/asc/017_rlmw_samples.asc"
97
+ },
98
+ "018": {
99
+ "events": "data/eyedata/asc/018_rlmw_events.asc",
100
+ "samples": "data/eyedata/asc/018_rlmw_samples.asc"
101
+ },
102
+ "019": {
103
+ "events": "data/eyedata/asc/019_rlmw_events.asc",
104
+ "samples": "data/eyedata/asc/019_rlmw_samples.asc"
105
+ },
106
+ "020": {
107
+ "events": "data/eyedata/asc/020_rlmw_events.asc",
108
+ "samples": "data/eyedata/asc/020_rlmw_samples.asc"
109
+ },
110
+ "021": {
111
+ "events": "data/eyedata/asc/021_rlmw_events.asc",
112
+ "samples": "data/eyedata/asc/021_rlmw_samples.asc"
113
+ },
114
+ "022": {
115
+ "events": "data/eyedata/asc/022_rlmw_events.asc",
116
+ "samples": "data/eyedata/asc/022_rlmw_samples.asc"
117
+ },
118
+ "023": {
119
+ "events": "data/eyedata/asc/023_rlmw_events.asc",
120
+ "samples": "data/eyedata/asc/023_rlmw_samples.asc"
121
+ },
122
+ "024": {
123
+ "events": "data/eyedata/asc/024_rlmw_events.asc",
124
+ "samples": "data/eyedata/asc/024_rlmw_samples.asc"
125
+ },
126
+ "025": {
127
+ "events": "data/eyedata/asc/025_rlmw_events.asc",
128
+ "samples": "data/eyedata/asc/025_rlmw_samples.asc"
129
+ },
130
+ "026": {
131
+ "events": "data/eyedata/asc/026_rlmw_events.asc",
132
+ "samples": "data/eyedata/asc/026_rlmw_samples.asc"
133
+ },
134
+ "027": {
135
+ "events": "data/eyedata/asc/027_rlmw_events.asc",
136
+ "samples": "data/eyedata/asc/027_rlmw_samples.asc"
137
+ },
138
+ "028": {
139
+ "events": "data/eyedata/asc/028_rlmw_events.asc",
140
+ "samples": "data/eyedata/asc/028_rlmw_samples.asc"
141
+ },
142
+ "029": {
143
+ "events": "data/eyedata/asc/029_rlmw_events.asc",
144
+ "samples": "data/eyedata/asc/029_rlmw_samples.asc"
145
+ },
146
+ "030": {
147
+ "events": "data/eyedata/asc/030_rlmw_events.asc",
148
+ "samples": "data/eyedata/asc/030_rlmw_samples.asc"
149
+ },
150
+ "031": {
151
+ "events": "data/eyedata/asc/031_rlmw_events.asc",
152
+ "samples": "data/eyedata/asc/031_rlmw_samples.asc"
153
+ },
154
+ "032": {
155
+ "events": "data/eyedata/asc/032_rlmw_events.asc",
156
+ "samples": "data/eyedata/asc/032_rlmw_samples.asc"
157
+ },
158
+ "033": {
159
+ "events": "data/eyedata/asc/033_rlmw_events.asc",
160
+ "samples": "data/eyedata/asc/033_rlmw_samples.asc"
161
+ },
162
+ "034": {
163
+ "events": "data/eyedata/asc/034_rlmw_events.asc",
164
+ "samples": "data/eyedata/asc/034_rlmw_samples.asc"
165
+ },
166
+ "035": {
167
+ "events": "data/eyedata/asc/035_rlmw_events.asc",
168
+ "samples": "data/eyedata/asc/035_rlmw_samples.asc"
169
+ },
170
+ "036": {
171
+ "events": "data/eyedata/asc/036_rlmw_events.asc",
172
+ "samples": "data/eyedata/asc/036_rlmw_samples.asc"
173
+ },
174
+ "037": {
175
+ "events": "data/eyedata/asc/037_rlmw_events.asc",
176
+ "samples": "data/eyedata/asc/037_rlmw_samples.asc"
177
+ },
178
+ "038": {
179
+ "events": "data/eyedata/asc/038_rlmw_events.asc",
180
+ "samples": "data/eyedata/asc/038_rlmw_samples.asc"
181
+ },
182
+ "039": {
183
+ "events": "data/eyedata/asc/039_rlmw_events.asc",
184
+ "samples": "data/eyedata/asc/039_rlmw_samples.asc"
185
+ },
186
+ "040": {
187
+ "events": "data/eyedata/asc/040_rlmw_events.asc",
188
+ "samples": "data/eyedata/asc/040_rlmw_samples.asc"
189
+ },
190
+ "041": {
191
+ "events": "data/eyedata/asc/041_rlmw_events.asc",
192
+ "samples": "data/eyedata/asc/041_rlmw_samples.asc"
193
+ },
194
+ "042": {
195
+ "events": "data/eyedata/asc/042_rlmw_events.asc",
196
+ "samples": "data/eyedata/asc/042_rlmw_samples.asc"
197
+ },
198
+ "043": {
199
+ "events": "data/eyedata/asc/043_rlmw_events.asc",
200
+ "samples": "data/eyedata/asc/043_rlmw_samples.asc"
201
+ },
202
+ "044": {
203
+ "events": "data/eyedata/asc/044_rlmw_events.asc",
204
+ "samples": "data/eyedata/asc/044_rlmw_samples.asc"
205
+ },
206
+ "045": {
207
+ "events": "data/eyedata/asc/045_rlmw_events.asc",
208
+ "samples": "data/eyedata/asc/045_rlmw_samples.asc"
209
+ },
210
+ "046": {
211
+ "events": "data/eyedata/asc/046_rlmw_events.asc",
212
+ "samples": "data/eyedata/asc/046_rlmw_samples.asc"
213
+ },
214
+ "047": {
215
+ "events": "data/eyedata/asc/047_rlmw_events.asc",
216
+ "samples": "data/eyedata/asc/047_rlmw_samples.asc"
217
+ },
218
+ "048": {
219
+ "events": "data/eyedata/asc/048_rlmw_events.asc",
220
+ "samples": "data/eyedata/asc/048_rlmw_samples.asc"
221
+ },
222
+ "049": {
223
+ "events": "data/eyedata/asc/049_rlmw_events.asc",
224
+ "samples": "data/eyedata/asc/049_rlmw_samples.asc"
225
+ },
226
+ "050": {
227
+ "events": "data/eyedata/asc/050_rlmw_events.asc",
228
+ "samples": "data/eyedata/asc/050_rlmw_samples.asc"
229
+ }
230
+ }
231
+
232
+
233
+ # write down notes about each subject when going through the preprocs
234
+ notes={
235
+ "001":"good",
236
+ "002":"good but many blinks",
237
+ "003":"ok, but some segments with many blinks (min 8, 12, ...)",
238
+ "004":"ok, beginning is crap, many 'double blinks', a few 'dip blinks' which don't go all the way to zero but filter is ok",
239
+ "005":"ok, some pretty long blinks and some dips but recovery mostly ok",
240
+ "006":"ok, near ideal in the beginning, more blinks later",
241
+ "007":"ok",
242
+ "008":"ok but problems around 8.7-14 mins",
243
+ "009":"ok, many multi-blinks but good recovery",
244
+ "010":"ok, very slow opening of eye, difficult to correct - used rather large margin",
245
+ "011":"very nice and regular blinking",
246
+ "012":"ok, there are some weird 'spikes' upwards in the data, saccades? filter seems ok",
247
+ "013":"ok",
248
+ "014":"nice and regular",
249
+ "015":"ok but not great, especially later parts",
250
+ "016":"ok but not great",
251
+ "017":"ok",
252
+ "018":"consider exclusion, another one with slow opening of eye, used large margin, lots of missings",
253
+ "019":"amazing, almost no blinks. Some spikes but filtered out ok",
254
+ "020":"ok",
255
+ "021":"ok, somewhat more messy during second half",
256
+ "022":"ok",
257
+ "023":"ok",
258
+ "024":"ok but not great, some double-blinks",
259
+ "025":"ok",
260
+ "026":"ok",
261
+ "027":"ok but data quality in last part is getting worse",
262
+ "028":"ok",
263
+ "029":"consider exclusion, pretty bad",
264
+ "030":"ok",
265
+ "031":"ok but not great",
266
+ "032":"consider exclusion, but not super bad",
267
+ "033":"ok",
268
+ "034":"ok",
269
+ "035":"ok but not great",
270
+ "036":"ok; very many but very short blinks... signal looks ok, though",
271
+ "037":"ok",
272
+ "038":"ok",
273
+ "039":"exclude: ok quality but saccades are super prominent in this subject",
274
+ "040":"ok",
275
+ "041":"ok",
276
+ "042":"ok",
277
+ "043":"ok, many blinks but ok recovery",
278
+ "044":"exclude: not great qual and saccades are prominent",
279
+ "045":"ok",
280
+ "046":"ok; qual not great but preproc seems to deal with it",
281
+ "047":"exclude: getting a lot worse at the end",
282
+ "048":"ok, slow opening of eye, used large margin, but signal looks ok",
283
+ "049":"exclude: huge saccades",
284
+ "050":"ok"
285
+ }
286
+ exclude = ["018", "029", "032", "039", "044", "047", "049"]
287
+
288
+ # Function to use for reading the data files
289
+ # This should be a string that can be evaluated to get the actual function
290
+ def read_subject(info):
291
+ """
292
+ Read the data for a single subject. Input is each element of `raw_data`.
293
+ """
294
+ ## loading the raw samples from the asc file
295
+ fname_samples=os.path.join(info["samples"])
296
+ df=pd.read_table(fname_samples, index_col=False,
297
+ names=["time", "left_x", "left_y", "left_p",
298
+ "right_x", "right_y", "right_p"])
299
+
300
+ ## Eyelink tracker puts " ." when no data is available for x/y coordinates
301
+ left_x=df.left_x.values
302
+ left_x[left_x==" ."] = np.nan
303
+ left_x = left_x.astype(float)
304
+
305
+ left_y=df.left_y.values
306
+ left_y[left_y==" ."] = np.nan
307
+ left_y = left_y.astype(float)
308
+
309
+ right_x=df.right_x.values
310
+ right_x[right_x==" ."] = np.nan
311
+ right_x = right_x.astype(float)
312
+
313
+ right_y=df.right_y.values
314
+ right_y[right_y==" ."] = np.nan
315
+ right_y = right_y.astype(float)
316
+
317
+ ## Loading the events from the events file
318
+ fname_events=os.path.join(info["events"])
319
+ # read the whole file into variable `events` (list with one entry per line)
320
+ with open(fname_events) as f:
321
+ events=f.readlines()
322
+
323
+ # keep only lines starting with "MSG"
324
+ events=[ev for ev in events if ev.startswith("MSG")]
325
+ experiment_start_index=np.where(["experiment_start" in ev for ev in events])[0][0]
326
+ events=events[experiment_start_index+1:]
327
+ df_ev=pd.DataFrame([ev.split() for ev in events])
328
+ df_ev=df_ev[[1,2]]
329
+ df_ev.columns=["time", "event"]
330
+
331
+ # Creating EyeData object that contains both X-Y coordinates
332
+ # and pupil data
333
+ d = pp.EyeData(time=df.time, name=info["subject"],
334
+ screen_resolution=study_info["screen_resolution"],
335
+ physical_screen_size=study_info["physical_screen_size"],
336
+ screen_eye_distance=study_info["screen_eye_distance"],
337
+ left_x=left_x, left_y=left_y, left_pupil=df.left_p,
338
+ right_x=right_x, right_y=right_y, right_pupil=df.right_p,
339
+ event_onsets=df_ev.time, event_labels=df_ev.event, notes=notes[info["subject"]],
340
+ keep_orig=True)\
341
+ .reset_time()
342
+ d.set_experiment_info(screen_eye_distance=study_info["screen_eye_distance"],
343
+ screen_resolution=study_info["screen_resolution"],
344
+ physical_screen_size=study_info["physical_screen_size"])
345
+ return d