pbl-exp 0.1__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.
- pbl_exp-0.1/.gitattributes +2 -0
- pbl_exp-0.1/.github/workflows/python-publish.yml +67 -0
- pbl_exp-0.1/.gitignore +183 -0
- pbl_exp-0.1/LICENSE +21 -0
- pbl_exp-0.1/PKG-INFO +15 -0
- pbl_exp-0.1/README.md +2 -0
- pbl_exp-0.1/demos/psychopy_and_pupil_labs.py +63 -0
- pbl_exp-0.1/pyproject.toml +18 -0
- pbl_exp-0.1/setup.cfg +4 -0
- pbl_exp-0.1/src/PBL/exp/__init__.py +3 -0
- pbl_exp-0.1/src/PBL/exp/eyelink.py +0 -0
- pbl_exp-0.1/src/PBL/exp/psychopy.py +0 -0
- pbl_exp-0.1/src/PBL/exp/pupil_labs.py +99 -0
- pbl_exp-0.1/src/pbl_exp.egg-info/PKG-INFO +15 -0
- pbl_exp-0.1/src/pbl_exp.egg-info/SOURCES.txt +18 -0
- pbl_exp-0.1/src/pbl_exp.egg-info/dependency_links.txt +1 -0
- pbl_exp-0.1/src/pbl_exp.egg-info/requires.txt +3 -0
- pbl_exp-0.1/src/pbl_exp.egg-info/scm_file_list.json +15 -0
- pbl_exp-0.1/src/pbl_exp.egg-info/scm_version.json +8 -0
- pbl_exp-0.1/src/pbl_exp.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
release-build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
with:
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
|
|
27
|
+
- uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.x"
|
|
30
|
+
|
|
31
|
+
- name: Build release distributions
|
|
32
|
+
run: |
|
|
33
|
+
# NOTE: put your own distribution build steps here.
|
|
34
|
+
python -m pip install build
|
|
35
|
+
python -m build
|
|
36
|
+
|
|
37
|
+
- name: Upload distributions
|
|
38
|
+
uses: actions/upload-artifact@v4
|
|
39
|
+
with:
|
|
40
|
+
name: release-dists
|
|
41
|
+
path: dist/
|
|
42
|
+
|
|
43
|
+
pypi-publish:
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
needs:
|
|
46
|
+
- release-build
|
|
47
|
+
permissions:
|
|
48
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
49
|
+
id-token: write
|
|
50
|
+
|
|
51
|
+
# Dedicated environments with protections for publishing are strongly recommended.
|
|
52
|
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
53
|
+
environment:
|
|
54
|
+
name: pypi
|
|
55
|
+
url: https://pypi.org/p/VisFeats
|
|
56
|
+
|
|
57
|
+
steps:
|
|
58
|
+
- name: Retrieve release distributions
|
|
59
|
+
uses: actions/download-artifact@v4
|
|
60
|
+
with:
|
|
61
|
+
name: release-dists
|
|
62
|
+
path: dist/
|
|
63
|
+
|
|
64
|
+
- name: Publish release distributions to PyPI
|
|
65
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
66
|
+
with:
|
|
67
|
+
packages-dir: dist/
|
pbl_exp-0.1/.gitignore
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
#pdm.lock
|
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
+
# in version control.
|
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
+
.pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# Environments
|
|
131
|
+
.env
|
|
132
|
+
.venv
|
|
133
|
+
env/
|
|
134
|
+
venv/
|
|
135
|
+
ENV/
|
|
136
|
+
env.bak/
|
|
137
|
+
venv.bak/
|
|
138
|
+
|
|
139
|
+
# Spyder project settings
|
|
140
|
+
.spyderproject
|
|
141
|
+
.spyproject
|
|
142
|
+
|
|
143
|
+
# Rope project settings
|
|
144
|
+
.ropeproject
|
|
145
|
+
|
|
146
|
+
# mkdocs documentation
|
|
147
|
+
/site
|
|
148
|
+
|
|
149
|
+
# mypy
|
|
150
|
+
.mypy_cache/
|
|
151
|
+
.dmypy.json
|
|
152
|
+
dmypy.json
|
|
153
|
+
|
|
154
|
+
# Pyre type checker
|
|
155
|
+
.pyre/
|
|
156
|
+
|
|
157
|
+
# pytype static type analyzer
|
|
158
|
+
.pytype/
|
|
159
|
+
|
|
160
|
+
# Cython debug symbols
|
|
161
|
+
cython_debug/
|
|
162
|
+
|
|
163
|
+
# PyCharm
|
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
+
#.idea/
|
|
169
|
+
|
|
170
|
+
# Ruff stuff:
|
|
171
|
+
.ruff_cache/
|
|
172
|
+
|
|
173
|
+
# PyPI configuration file
|
|
174
|
+
.pypirc
|
|
175
|
+
|
|
176
|
+
# Cursor
|
|
177
|
+
# Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
|
|
178
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
179
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
180
|
+
.cursorignore
|
|
181
|
+
.cursorindexingignore
|
|
182
|
+
|
|
183
|
+
.demo_logs/
|
pbl_exp-0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Qian Chu
|
|
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.
|
pbl_exp-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pbl-exp
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Helper functions for running experiments at the Predictive Brain Lab (Bochum)
|
|
5
|
+
Author-email: Qian Chu <qianchu99@gmail.com>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: psychopy
|
|
10
|
+
Requires-Dist: pupil-labs-realtime-api
|
|
11
|
+
Requires-Dist: sr-research-pylink
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# pbl-exp
|
|
15
|
+
|
pbl_exp-0.1/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from psychopy import core, logging, visual
|
|
2
|
+
from psychopy.hardware import keyboard
|
|
3
|
+
|
|
4
|
+
from PBL.exp import get_pupil_labs_device, send_event_to_pupil_labs
|
|
5
|
+
|
|
6
|
+
# Create a log file to record experiment events and messages
|
|
7
|
+
lastLog = logging.LogFile(
|
|
8
|
+
"demo_logs/psychopy_and_pupil_labs.log", level=logging.INFO, filemode="w"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
N = 5 # Number of trials
|
|
12
|
+
DUR = 0.5 # Duration of the flash in seconds
|
|
13
|
+
INTERVAL = 3 # Interval between flashes in seconds
|
|
14
|
+
|
|
15
|
+
# Choose whether to record from a Pupil Labs device
|
|
16
|
+
device, offset_ns = get_pupil_labs_device()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def end_experiment(device, offset_ns):
|
|
20
|
+
if device is not None and offset_ns is not None:
|
|
21
|
+
send_event_to_pupil_labs(device, "experiment end", offset_ns)
|
|
22
|
+
device.recording_stop_and_save()
|
|
23
|
+
device.close()
|
|
24
|
+
logging.exp("experiment end")
|
|
25
|
+
logging.flush()
|
|
26
|
+
core.quit()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Experiment parameters and PsychoPy objects
|
|
30
|
+
win = visual.Window(fullscr=True, color=[-1, -1, -1]) # black
|
|
31
|
+
win.mouseVisible = False
|
|
32
|
+
square = visual.Rect(win, width=2, height=2, fillColor="white", units="norm")
|
|
33
|
+
text = visual.TextStim(win, text="Press space to start", height=0.05, units="height")
|
|
34
|
+
|
|
35
|
+
kb = keyboard.KeyboardDevice()
|
|
36
|
+
kb.registerCallback(
|
|
37
|
+
response="escape",
|
|
38
|
+
func=end_experiment,
|
|
39
|
+
args=[device, offset_ns],
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
# Display initial message and wait for space key to continue
|
|
43
|
+
text.draw()
|
|
44
|
+
win.flip()
|
|
45
|
+
kb.waitKeys(keyList=["space"])
|
|
46
|
+
win.flip()
|
|
47
|
+
logging.exp("experiment start")
|
|
48
|
+
device.recording_start() if device is not None else None
|
|
49
|
+
core.wait(3)
|
|
50
|
+
|
|
51
|
+
for i in range(N):
|
|
52
|
+
square.draw()
|
|
53
|
+
win.callOnFlip(send_event_to_pupil_labs, device, "flash onset", offset_ns)
|
|
54
|
+
win.logOnFlip(level=logging.EXP, msg="flash onset")
|
|
55
|
+
win.flip()
|
|
56
|
+
core.wait(DUR)
|
|
57
|
+
win.flip()
|
|
58
|
+
core.wait(INTERVAL)
|
|
59
|
+
logging.flush()
|
|
60
|
+
kb.getKeys() # Check for escape key press during the interval
|
|
61
|
+
|
|
62
|
+
core.wait(1)
|
|
63
|
+
end_experiment(device, offset_ns)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=80", "setuptools-scm>=8"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pbl-exp"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Helper functions for running experiments at the Predictive Brain Lab (Bochum)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "Qian Chu", email = "qianchu99@gmail.com" }]
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = ["psychopy", "pupil-labs-realtime-api", "sr-research-pylink"]
|
|
13
|
+
|
|
14
|
+
[tool.setuptools.packages.find]
|
|
15
|
+
where = ["src"]
|
|
16
|
+
|
|
17
|
+
[tool.setuptools_scm]
|
|
18
|
+
local_scheme = "node-and-date"
|
pbl_exp-0.1/setup.cfg
ADDED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from time import time_ns
|
|
3
|
+
|
|
4
|
+
from psychopy import gui, logging
|
|
5
|
+
from pupil_labs.realtime_api.simple import Device, discover_devices
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_pupil_labs_device(search_duration_seconds=5.0):
|
|
9
|
+
"""
|
|
10
|
+
Get the Pupil Labs device and its time offset.
|
|
11
|
+
|
|
12
|
+
Parameters
|
|
13
|
+
----------
|
|
14
|
+
search_duration_seconds : float
|
|
15
|
+
Duration to search for Pupil Labs devices.
|
|
16
|
+
|
|
17
|
+
Returns
|
|
18
|
+
-------
|
|
19
|
+
device : object or None
|
|
20
|
+
The connected Pupil Labs device, or None if not used.
|
|
21
|
+
median_offset_ns : int or None
|
|
22
|
+
The estimated median time offset of the device in nanoseconds, or None if not used.
|
|
23
|
+
|
|
24
|
+
Raises
|
|
25
|
+
------
|
|
26
|
+
RuntimeError
|
|
27
|
+
If no Pupil Labs device is found when one is expected.
|
|
28
|
+
"""
|
|
29
|
+
# Get whether to use the Pupil Labs Eye Tracker
|
|
30
|
+
dlg = gui.Dlg(title="Pupil Labs Eye Tracker")
|
|
31
|
+
dlg.addField("Use Pupil Labs eye tracker?", False, choices=[True, False])
|
|
32
|
+
dlg_data = dlg.show()
|
|
33
|
+
sys.exit() if not dlg.OK else None
|
|
34
|
+
record_pl = dlg_data[0]
|
|
35
|
+
|
|
36
|
+
if record_pl:
|
|
37
|
+
devices = discover_devices(search_duration_seconds=search_duration_seconds)
|
|
38
|
+
if not devices:
|
|
39
|
+
dlg = gui.Dlg(title="No Pupil Labs device found")
|
|
40
|
+
dlg.addText("No Pupil Labs device found. Check your connection.")
|
|
41
|
+
dlg.show()
|
|
42
|
+
raise RuntimeError("No Pupil Labs device found.")
|
|
43
|
+
elif len(devices) == 1:
|
|
44
|
+
device = devices[0]
|
|
45
|
+
dlg = gui.Dlg(title="Pupil Labs configuration")
|
|
46
|
+
dlg.addText(f"Using the only Pupil Labs device found at {device.address}")
|
|
47
|
+
dlg.show()
|
|
48
|
+
else:
|
|
49
|
+
ip_addresses = [device.address for device in devices]
|
|
50
|
+
dlg = gui.Dlg(title="Pupil Labs configuration")
|
|
51
|
+
dlg.addText("Multiple Pupil Labs devices found.")
|
|
52
|
+
dlg.addField("Select the device to use:", choices=ip_addresses)
|
|
53
|
+
dlg.show()
|
|
54
|
+
selected_ip = dlg.data[0]
|
|
55
|
+
for d in devices:
|
|
56
|
+
if d.address == selected_ip:
|
|
57
|
+
device = d
|
|
58
|
+
else:
|
|
59
|
+
d.close()
|
|
60
|
+
logging.info(f"Connected to Pupil Labs device at {device.address}")
|
|
61
|
+
|
|
62
|
+
median_offset_ns = round(
|
|
63
|
+
device.estimate_time_offset().time_offset_ms.median * 1_000_000
|
|
64
|
+
)
|
|
65
|
+
offset_std = round(device.estimate_time_offset().time_offset_ms.std * 1_000_000)
|
|
66
|
+
logging.info(
|
|
67
|
+
f"Estimated Pupil Labs device time offset (ns) = {median_offset_ns} ± {offset_std} (median ± std)"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
return device, median_offset_ns
|
|
71
|
+
else:
|
|
72
|
+
return None, None
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def send_event_to_pupil_labs(device: Device, event_string: str, clock_offset_ns: int):
|
|
76
|
+
"""
|
|
77
|
+
Send an event to the Pupil Labs device with a timestamp.
|
|
78
|
+
|
|
79
|
+
Parameters
|
|
80
|
+
----------
|
|
81
|
+
device : Device
|
|
82
|
+
The connected Pupil Labs device.
|
|
83
|
+
event_string : str
|
|
84
|
+
The event description to send.
|
|
85
|
+
clock_offset_ns : int
|
|
86
|
+
The clock offset in nanoseconds to adjust the event timestamp.
|
|
87
|
+
"""
|
|
88
|
+
if device is not None:
|
|
89
|
+
device.send_event(
|
|
90
|
+
event_string,
|
|
91
|
+
event_timestamp_unix_ns=int(time_ns() - clock_offset_ns),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
if __name__ == "__main__":
|
|
96
|
+
logging.console.setLevel(logging.INFO)
|
|
97
|
+
device, offset_ns = get_pupil_labs_device()
|
|
98
|
+
if device is not None:
|
|
99
|
+
device.close()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pbl-exp
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Helper functions for running experiments at the Predictive Brain Lab (Bochum)
|
|
5
|
+
Author-email: Qian Chu <qianchu99@gmail.com>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: psychopy
|
|
10
|
+
Requires-Dist: pupil-labs-realtime-api
|
|
11
|
+
Requires-Dist: sr-research-pylink
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# pbl-exp
|
|
15
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.gitattributes
|
|
2
|
+
.gitignore
|
|
3
|
+
LICENSE
|
|
4
|
+
README.md
|
|
5
|
+
pyproject.toml
|
|
6
|
+
.github/workflows/python-publish.yml
|
|
7
|
+
demos/psychopy_and_pupil_labs.py
|
|
8
|
+
src/PBL/exp/__init__.py
|
|
9
|
+
src/PBL/exp/eyelink.py
|
|
10
|
+
src/PBL/exp/psychopy.py
|
|
11
|
+
src/PBL/exp/pupil_labs.py
|
|
12
|
+
src/pbl_exp.egg-info/PKG-INFO
|
|
13
|
+
src/pbl_exp.egg-info/SOURCES.txt
|
|
14
|
+
src/pbl_exp.egg-info/dependency_links.txt
|
|
15
|
+
src/pbl_exp.egg-info/requires.txt
|
|
16
|
+
src/pbl_exp.egg-info/scm_file_list.json
|
|
17
|
+
src/pbl_exp.egg-info/scm_version.json
|
|
18
|
+
src/pbl_exp.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
".gitattributes",
|
|
4
|
+
".github/workflows/python-publish.yml",
|
|
5
|
+
".gitignore",
|
|
6
|
+
"LICENSE",
|
|
7
|
+
"README.md",
|
|
8
|
+
"demos/psychopy_and_pupil_labs.py",
|
|
9
|
+
"pyproject.toml",
|
|
10
|
+
"src/PBL/exp/__init__.py",
|
|
11
|
+
"src/PBL/exp/eyelink.py",
|
|
12
|
+
"src/PBL/exp/psychopy.py",
|
|
13
|
+
"src/PBL/exp/pupil_labs.py"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PBL
|