psyphy 0.0.2__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.
- psyphy/__init__.py +126 -0
- psyphy/data/__init__.py +15 -0
- psyphy/data/dataset.py +303 -0
- psyphy/data/io.py +92 -0
- psyphy/inference/__init__.py +39 -0
- psyphy/inference/base.py +47 -0
- psyphy/inference/langevin.py +89 -0
- psyphy/inference/laplace.py +56 -0
- psyphy/inference/map_optimizer.py +245 -0
- psyphy/model/__init__.py +46 -0
- psyphy/model/base.py +77 -0
- psyphy/model/covariance_field.py +518 -0
- psyphy/model/likelihood.py +701 -0
- psyphy/model/noise.py +44 -0
- psyphy/model/prior.py +215 -0
- psyphy/model/wppm.py +531 -0
- psyphy/posterior/__init__.py +34 -0
- psyphy/posterior/parameter_posterior.py +87 -0
- psyphy/posterior/posterior.py +75 -0
- psyphy/posterior/predictive_posterior.py +287 -0
- psyphy/trial_placement/__init__.py +38 -0
- psyphy/trial_placement/grid.py +56 -0
- psyphy/trial_placement/sobol.py +65 -0
- psyphy/utils/__init__.py +19 -0
- psyphy/utils/math.py +104 -0
- psyphy-0.0.2.dist-info/METADATA +139 -0
- psyphy-0.0.2.dist-info/RECORD +29 -0
- psyphy-0.0.2.dist-info/WHEEL +4 -0
- psyphy-0.0.2.dist-info/licenses/LICENSE.md +21 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: psyphy
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Adaptive Trial Placement for Psychophysical Experiments
|
|
5
|
+
Project-URL: Homepage, https://flatironinstitute.github.io/psyphy
|
|
6
|
+
Project-URL: Repository, https://github.com/flatironinstitute/psyphy
|
|
7
|
+
Project-URL: Issues, https://github.com/flatironinstitute/psyphy/issues
|
|
8
|
+
Author: Hanna Dettki, Alex Williams
|
|
9
|
+
Maintainer: Hanna Dettki
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 Psyphy authors
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE.md
|
|
32
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
33
|
+
Classifier: Operating System :: OS Independent
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Requires-Python: >=3.10
|
|
36
|
+
Requires-Dist: jax>=0.4.28
|
|
37
|
+
Requires-Dist: numpy>=1.22
|
|
38
|
+
Requires-Dist: optax>=0.2.4
|
|
39
|
+
Requires-Dist: scipy>=1.7
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: ruff>=0.9; extra == 'dev'
|
|
45
|
+
Provides-Extra: docs
|
|
46
|
+
Requires-Dist: jupyterlab>=4.0; extra == 'docs'
|
|
47
|
+
Requires-Dist: matplotlib>=3.5; extra == 'docs'
|
|
48
|
+
Requires-Dist: seaborn>=0.13; extra == 'docs'
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
<div align="center">
|
|
54
|
+
<picture>
|
|
55
|
+
<source srcset="docs/images/psyphy_logo_draft.png" media="(prefers-color-scheme: light)"/>
|
|
56
|
+
<source srcset="docs/images/psyphy_logo_draft.png" media="(prefers-color-scheme: dark)"/>
|
|
57
|
+
<!-- <img align="center" src="docs/assets/logo/logo_text_black.svg" alt="Inferno" width="400" style="padding-right: 10px; padding left: 10px;"/> -->
|
|
58
|
+
</picture>
|
|
59
|
+
<h3>Psychophysical Modeling and Adaptive Trial Placement</h3>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<h4 align="center">
|
|
64
|
+
<a href="https://flatironinstitute.github.io/psyphy/#install/">Installation</a> |
|
|
65
|
+
<a href="https://flatironinstitute.github.io/psyphy/reference/">Documentation</a> |
|
|
66
|
+
<a href="https://flatironinstitute.github.io/psyphy/examples/">Examples</a> |
|
|
67
|
+
<a href="https://flatironinstitute.github.io/psyphy/CONTRIBUTING/">Contributing</a>
|
|
68
|
+
</h4>
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Install (editable)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
git clone https://flatironinstitute.github.io/psyphy.git
|
|
75
|
+
cd psyphy
|
|
76
|
+
pip install -e .
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## [Quickstart](https://flatironinstitute.github.io/psyphy/examples/wppm/quick_start/)
|
|
81
|
+
- Go [here](https://flatironinstitute.github.io/psyphy/examples/wppm/quick_start/) for a light-weight tutorial that demonstrates how to instantiate, evaluate and fit a model quickly. You should be able to run the underlying [script](https://github.com/flatironinstitute/psyphy/blob/main/docs/examples/wppm/quick_start.py) on your CPU.
|
|
82
|
+
- Go [here](https://flatironinstitute.github.io/psyphy/examples/wppm/full_wppm_fit_example/) for a more comprehensive example visualizing a spatially varying covariance field, also explaining the underlying math. The underlying [script](https://github.com/flatironinstitute/psyphy/blob/main/docs/examples/wppm/full_wppm_fit_example.py) for this tutorial requires a GPU.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## This package provides:
|
|
86
|
+
|
|
87
|
+
- Wishart Process Psychophysical Model (WPPM)
|
|
88
|
+
- fit to subject's data
|
|
89
|
+
- predict psychphysical thresholds
|
|
90
|
+
- optional trial placement strategy leveraging model's posterior (e.g., information gain, place next batch of trials such that model's uncertainty is maximally reduced)
|
|
91
|
+
- Priors and noise models
|
|
92
|
+
- supports cold and warm starts where warm means initialzing with parameters from previous subjects fitted parameters
|
|
93
|
+
- Noise Model:
|
|
94
|
+
- default: Gaussian
|
|
95
|
+
- supports Student's T
|
|
96
|
+
- Task likelihoods
|
|
97
|
+
- currently supports OddityTask, TwoAFC
|
|
98
|
+
- Inference engines (MAP, Langevin, Laplace)
|
|
99
|
+
- Posterior wrappers and diagnostics
|
|
100
|
+
- Trial placement strategies (grid, information gain)
|
|
101
|
+
- supports online and batchwise trial placement
|
|
102
|
+
- Experiment session orchestration
|
|
103
|
+
- reading session data and exporting next batch of trial placments
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## Background
|
|
108
|
+
|
|
109
|
+
This package implements methods described in:
|
|
110
|
+
- [Hong et al. (2025). *Comprehensive characterization of human color discrimination thresholds*.](https://www.biorxiv.org/content/10.1101/2025.07.16.665219v1)
|
|
111
|
+
|
|
112
|
+
While the paper above used AEPsych (a Gaussian Process–based trial placer),
|
|
113
|
+
`psyphy` integrates trial placement directly with the WPPM posterior (e.g. via InfoGain/EAVC),
|
|
114
|
+
making the adaptive trial placement model-aware.
|
|
115
|
+
|
|
116
|
+
## Docs
|
|
117
|
+
|
|
118
|
+
Build and preview the documentation locally:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# from repo root
|
|
122
|
+
source .venv/bin/activate
|
|
123
|
+
pip install mkdocs mkdocs-material 'mkdocstrings[python]'
|
|
124
|
+
mkdocs serve
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Build the static site:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
mkdocs build
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Deploy to GitHub Pages (manual):
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
mkdocs gh-deploy --clean
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
For contributors, see CONTRIBUTING.md for full doc guidelines and NumPy-style docstrings.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
psyphy/__init__.py,sha256=C7QMt_MlKxXDWIWygnqBYiXvsbMO8XQcBA_t-1X7LYc,4400
|
|
2
|
+
psyphy/data/__init__.py,sha256=9WRn3g9xPvbcWv-3-JbsHANbbBWpeIxEARGkU_F9an8,325
|
|
3
|
+
psyphy/data/dataset.py,sha256=nj8HTK-p5XWwZnDClWM57IKjhKsWIpyoa_qqI-jNo_E,9208
|
|
4
|
+
psyphy/data/io.py,sha256=WUPi1zjq54hg_hktISyye0_8FAzBgTO64pb6zC8P5dc,2139
|
|
5
|
+
psyphy/inference/__init__.py,sha256=WVyOqA-dc3PJvA2u8YL4WI_SYIvUT3mPC36cRMZla5c,974
|
|
6
|
+
psyphy/inference/base.py,sha256=hxEx1l1_TnEo7y0U641jiCWfIKmM4aK_md6V3akhrn8,1010
|
|
7
|
+
psyphy/inference/langevin.py,sha256=_U2TUbtF_eeV0GcEKfHuU5w7IYg8iIjCZnINFVBGqc0,2126
|
|
8
|
+
psyphy/inference/laplace.py,sha256=hzlwaUmtgjcqQOeMN53SoW_UamYuWrwn_hXG-2buJ7o,1398
|
|
9
|
+
psyphy/inference/map_optimizer.py,sha256=QNNPhqtONV_0tNP7O42kXpoam3QqIOqrkUyGSz0_WQg,9213
|
|
10
|
+
psyphy/model/__init__.py,sha256=fbKhbA1PfXzX_RGUg9B6FhhJ41VtDEVnTLDPzN1K9DM,989
|
|
11
|
+
psyphy/model/base.py,sha256=zi6A2kfhggO8An8-qR2pyZRClOzT2XipwncCVyhFj-0,1786
|
|
12
|
+
psyphy/model/covariance_field.py,sha256=5uQrTjq3_C5jwcxu666SMk69K9z5S_6Kbw-oBfe3lK4,16629
|
|
13
|
+
psyphy/model/likelihood.py,sha256=DLScKpb_de6Xcz__j6mqjpFy93EbNtugC6f5LCBlGU0,30362
|
|
14
|
+
psyphy/model/noise.py,sha256=VRR06F_AkzFQLbiIRCpl-dV4x2CUSWNLBG83UK1QSTk,1095
|
|
15
|
+
psyphy/model/prior.py,sha256=ik-FxD_RrM9YFMKQ1PacR532WEiGKrBu_bvcWxLsOwQ,7390
|
|
16
|
+
psyphy/model/wppm.py,sha256=tfb-aITG-O7FcH-tY4qka07HCpeCTVqERq5DvI7A9MI,20303
|
|
17
|
+
psyphy/posterior/__init__.py,sha256=tVsBifb-ADR4Ayga1OU2kC-RI_56cVhAfepGXIUsEU4,893
|
|
18
|
+
psyphy/posterior/parameter_posterior.py,sha256=PLalQTB7-iofWaoND_Czf0UYVXxtm-Cx7Dwba9qROB4,2023
|
|
19
|
+
psyphy/posterior/posterior.py,sha256=8LE7ZojujReGVl0EHGQCWyr0tTGmquxW9I8-AWbu7JA,1866
|
|
20
|
+
psyphy/posterior/predictive_posterior.py,sha256=X3jaKgM2RV3TrOFmTXqxFQpDzimOVoR27QM5UM0lELE,8324
|
|
21
|
+
psyphy/trial_placement/__init__.py,sha256=pmqo0RPyrcLqFAuwcE7gBM4fDBrsZucv9iMbBfMAXSU,1238
|
|
22
|
+
psyphy/trial_placement/grid.py,sha256=WHRsvH4SaVCxSsuCyhMOqeKHyiyZ-nsjiyULT3GIelE,1285
|
|
23
|
+
psyphy/trial_placement/sobol.py,sha256=GQt0fEkhhHsI_M857dE29cRfBzH2JoBtd94kiZnBl-0,1741
|
|
24
|
+
psyphy/utils/__init__.py,sha256=GqBnQJ51vbrTZRzSzSAFVUYpBl_zVAU8QGdSccT7ySU,281
|
|
25
|
+
psyphy/utils/math.py,sha256=NKBbPGPckXNjU6QJR-Bu_Kh_2pVa9GKR6aYff959ZSY,3020
|
|
26
|
+
psyphy-0.0.2.dist-info/METADATA,sha256=5dW563KeasWd0akFlP9d1kbv2T3DJmKLkWpPTm4QB2Y,5861
|
|
27
|
+
psyphy-0.0.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
28
|
+
psyphy-0.0.2.dist-info/licenses/LICENSE.md,sha256=BGMVTONrFCdp6Rw2W6pcC5wtmwMWORy107IlFbAQp6E,1071
|
|
29
|
+
psyphy-0.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Psyphy authors
|
|
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.
|