Metadata-Version: 2.4
Name: psyphy
Version: 0.0.2
Summary: Adaptive Trial Placement for Psychophysical Experiments
Project-URL: Homepage, https://flatironinstitute.github.io/psyphy
Project-URL: Repository, https://github.com/flatironinstitute/psyphy
Project-URL: Issues, https://github.com/flatironinstitute/psyphy/issues
Author: Hanna Dettki, Alex Williams
Maintainer: Hanna Dettki
License: MIT License
        
        Copyright (c) 2026 Psyphy authors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE.md
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: jax>=0.4.28
Requires-Dist: numpy>=1.22
Requires-Dist: optax>=0.2.4
Requires-Dist: scipy>=1.7
Provides-Extra: dev
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pre-commit>=3.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.9; extra == 'dev'
Provides-Extra: docs
Requires-Dist: jupyterlab>=4.0; extra == 'docs'
Requires-Dist: matplotlib>=3.5; extra == 'docs'
Requires-Dist: seaborn>=0.13; extra == 'docs'
Description-Content-Type: text/markdown

![psyphy logo](docs/images/psyphy_logo_draft.png)

<div align="center">
    <picture>
    <source srcset="docs/images/psyphy_logo_draft.png" media="(prefers-color-scheme: light)"/>
    <source srcset="docs/images/psyphy_logo_draft.png"  media="(prefers-color-scheme: dark)"/>
    <!-- <img align="center" src="docs/assets/logo/logo_text_black.svg" alt="Inferno" width="400" style="padding-right: 10px; padding left: 10px;"/> -->
    </picture>
    <h3>Psychophysical Modeling and Adaptive Trial Placement</h3>
</div>


<h4 align="center">
  <a href="https://flatironinstitute.github.io/psyphy/#install/">Installation</a> |
  <a href="https://flatironinstitute.github.io/psyphy/reference/">Documentation</a> |
  <a href="https://flatironinstitute.github.io/psyphy/examples/">Examples</a> |
  <a href="https://flatironinstitute.github.io/psyphy/CONTRIBUTING/">Contributing</a>
</h4>


## Install (editable)

```bash
git clone https://flatironinstitute.github.io/psyphy.git
cd psyphy
pip install -e .

```

## [Quickstart](https://flatironinstitute.github.io/psyphy/examples/wppm/quick_start/)
- 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.
- 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.


## This package provides:

- Wishart Process Psychophysical Model (WPPM)
    - fit to subject's data
    - predict psychphysical thresholds
    - 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)
- Priors and noise models
    - supports cold and warm starts where warm means initialzing with parameters from previous subjects fitted parameters
    - Noise Model:
        - default: Gaussian
        - supports Student's T
- Task likelihoods
    - currently supports OddityTask, TwoAFC
- Inference engines (MAP, Langevin, Laplace)
- Posterior wrappers and diagnostics
- Trial placement strategies (grid, information gain)
    - supports online and batchwise trial placement
- Experiment session orchestration
    - reading session data and exporting next batch of trial placments



## Background

This package implements methods described in:
-  [Hong et al. (2025). *Comprehensive characterization of human color discrimination thresholds*.](https://www.biorxiv.org/content/10.1101/2025.07.16.665219v1)

While the paper above  used AEPsych (a Gaussian Process–based trial placer),
`psyphy` integrates trial placement directly with the WPPM posterior (e.g. via InfoGain/EAVC),
making the  adaptive trial placement model-aware.

## Docs

Build and preview the documentation locally:

```bash
# from repo root
source .venv/bin/activate
pip install mkdocs mkdocs-material 'mkdocstrings[python]'
mkdocs serve
```

Build the static site:

```bash
mkdocs build
```

Deploy to GitHub Pages (manual):

```bash
mkdocs gh-deploy --clean
```

For contributors, see CONTRIBUTING.md for full doc guidelines and NumPy-style docstrings.
