Skip to main content

psychopy-pest

A PsychoPy plugin that adds PEST (Parameter Estimation by Sequential Testing; Taylor & Creelman, 1967) as psychopy.data.PestHandler, alongside PsychoPy's own StairHandler and QuestHandler.

Taylor, M. M., & Creelman, C. D. (1967). PEST: Efficient estimates on probability functions. The Journal of the Acoustical Society of America, 41(4A), 782–787. https://doi.org/10.1121/1.1910407

It implements the same procedure as the MATLAB toolbox in this repository and gives identical results: the Wald sequential test (or an optional N-down/M-up rule), the five step-size rules, and termination when a reversal would halve the step below the minimum. See the main README for the rules.

Installation

In the Python environment that runs PsychoPy:

pip install "psychopy-pest @ git+https://github.com/ZhenxianLi/PEST_Toolbox#subdirectory=python"

In the PsychoPy app, open Tools → Plugins/packages manager → Packages and install the same address, or run the command above in the app's terminal.

Usage with PsychoPy

from psychopy import plugins
plugins.scanPlugins()             # find newly installed plugins
plugins.loadPlugin('psychopy-pest')
from psychopy import data

staircase = data.PestHandler(
    startVal=-20,         # intensity of the first trial
    startStepSize=8,
    minStepSize=1,        # run ends when a reversal halves the step below this
    maxStepSize=16,
    pThreshold=0.75,      # Wald test target
    waldLimit=1)

for intensity in staircase:          # stops when the PEST run ends
    isCorrect = runTrial(intensity)  # your trial code
    staircase.addResponse(isCorrect)

print(staircase.threshold)
staircase.saveAsExcel('pest_run.xlsx')

PestHandler is a subclass of StairHandler, so addOtherData, the saveAs* methods and ExperimentHandler.addLoop work as usual. A correct response steps the intensity down, and steps are linear: express the intensity in the unit PEST should step in (for example, dB).

In Builder, enable the plugin in the plugin manager and create the handler in a Code component.

Usage without PsychoPy

The algorithm itself has no dependencies:

from psychopy_pest import PEST

pest = PEST(initial_level=-20, initial_step_size=8, min_step_size=1)
while not pest.finished:
    pest.update(run_trial(pest.level))
print(pest.threshold, pest.history)

Development

pip install -e ".[test]"
pytest

The handler tests run when PsychoPy is installed and are skipped otherwise. examples/simulated_observer.py runs both classes against a simulated observer.

License

Non-commercial research and educational use only; see LICENSE.

Metadata

Release files for psychopy-pest 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psychopy-pest 2.1.0
File Size Uploaded Provenance Actions
psychopy_pest-2.1.0.tar.gz 12.6 kB With provenance Details for psychopy_pest-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for psychopy-pest 2.1.0
File Interpreter ABI Platform Actions
psychopy_pest-2.1.0-py3-none-any.whl Python 3 none any Details for psychopy_pest-2.1.0-py3-none-any.whl

Total release size: 23.0 kB

Release files / psychopy_pest-2.1.0.tar.gz

Download URL psychopy_pest-2.1.0.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8700af4bff524552173cfc0fdf37ac6ef1c0fb3c970f8375e2852a38a179c908
BLAKE2b-256 checksum
How to use checksums
08f9e1ac31835a0477bc813e909a6e3a7fc5d295f9830165e856f25958fa3318
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Release files / psychopy_pest-2.1.0-py3-none-any.whl

Download URL psychopy_pest-2.1.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ff2e6e4bc776cc8d40e1660f28dd663ebc612f0607328cb5840325be45789e1
BLAKE2b-256 checksum
How to use checksums
186fc660e917ec5cef9728e4bb93fbc98680482e0d3d208dd97c741b7eb97dfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Security for psychopy-pest 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for psychopy_pest-2.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page