Skip to main content

pilotr (Python)

PyPI python-tests Lifecycle: experimental License: MIT DOI 10.5281/zenodo.21266313

The Python implementation of pilotr simulates experimental and behavioural data from a portable JSON design specification.

This is the twin of the R package of the same name and contains its generative core. Both packages use the same design specification and random-number generator, so the same specification and seed produce identical data in either language wherever the two share a maths library, as on Linux, except in a rare Beta case under R 4.6.0 or later that the cross-language guide describes. Elsewhere, a value that passes through exp(), log() or pow() can differ in its last bits, as the same guide sets out.

This package provides simulation, validation, the analysis model a specification implies, simulation-based power, the sample-size report and the curve solvers. Precision/ROPE design analysis, power curves for mixed-effects designs, calibration and sweeps, the lme4 reference backend for mixed-effects power, the brms bridge, the analysis-script emitters, the helpers that build specifications, and the app launcher are in the R package alone.

Install

pilotr requires Python 3.9 or later. The first command below installs the generative core, which is pure Python and has no dependencies. The second adds scipy, for power and power_curve, and the third adds scipy, statsmodels and pandas, for power_mixed and model_data. The double quotes keep zsh, the default shell on macOS, from reading the brackets as a filename pattern.

pip install pilotr
pip install "pilotr[power]"
pip install "pilotr[mixed]"

For development, install from a checkout of the repository instead. Clone https://github.com/pablobernabeu/pilotr and run pip install . (or pip install ".[dev]") from the python directory.

Quick start

A design specification is an ordinary dictionary, so the shortest example needs nothing beyond the package itself.

from pilotr import simulate

spec = {
    "name": "two_group", "seed": 2024,
    "units": {"subject": {"n": 64}},
    "factors": [{"name": "group", "levels": ["control", "treatment"],
                 "contrasts": {"effect": [-0.5, 0.5]}, "between": "subject"}],
    "fixed": {"intercept": 100, "coefficients": {"effect": 5}},
    "response": {"family": "gaussian", "name": "score", "sigma": 10},
}

data = simulate(spec)               # 64 rows

Given the same specification and seed, this reproduces the data the R package generates, to the last bit wherever the two share a maths library.

Try it without installing

A serverless build of the no-code app runs in your browser, with no installation required and no data uploaded.

Learn more

The Python documentation site walks through the quick start, the response families, power and design analysis, the specification format and the API reference. The project README describes the toolkit as a whole, including the R package, the no-code app and the specification format.

Citation

If pilotr contributes to published work, please cite it, with the version of the package you used (pilotr.__version__). The R and Python packages are released separately, so their version numbers can differ.

Bernabeu, P. (2026). pilotr: Simulate experimental and behavioural data from a portable design specification. https://doi.org/10.5281/zenodo.21266313

The About page gives the same citation, with the Python package's version and a BibTeX entry, and a short note on the developer. The repository also includes CITATION.cff, which GitHub's 'Cite this repository' button reads.

Licence

MIT. See LICENSE.

Contributing

Issues and pull requests are welcome. The contributing guide describes the development setup and the conventions the package follows, and everyone taking part is asked to honour the Code of Conduct.

Metadata

Release files for pilotr 0.4.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 pilotr 0.4.0
File Size Uploaded Provenance Actions
pilotr-0.4.0.tar.gz 234.8 kB With provenance Details for pilotr-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pilotr 0.4.0
File Interpreter ABI Platform Actions
pilotr-0.4.0-py3-none-any.whl Python 3 none any Details for pilotr-0.4.0-py3-none-any.whl

Total release size: 322.0 kB

Release files / pilotr-0.4.0.tar.gz

Download URL pilotr-0.4.0.tar.gz
Size 234.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d45844fa6cb356a345b2dd1af4b4fa7fc513635ab6093ac02673d0fa3f77a809
BLAKE2b-256 checksum
How to use checksums
c2dbde6796314eef64d0e43d015218bc34d3d17a55c8c0608a4e1eaa2336f479
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 Nov 22, 2026.

Transparency log

Release files / pilotr-0.4.0-py3-none-any.whl

Download URL pilotr-0.4.0-py3-none-any.whl
Size 87.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a75942e6193e18f4c5e841e7c11eaf57ae2b40f67c87906e1fddd2db3b57bec4
BLAKE2b-256 checksum
How to use checksums
ac416cde5a5e3769e2e2323a904ee635795abbd5fa7c1ed92d82db1852956dd8
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 Nov 22, 2026.

Transparency log

Security for pilotr 0.4.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pilotr-0.4.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 Nov 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.

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