Skip to main content

parstudy

Parameter and variant studies for simulation models, independent of the simulation backend.

You describe each quantity to vary on its own as a ModelParameter - its name, the values to sweep, an optional default, and an optional list of model attributes it affects. Attributes a parameter affects are snapshotted at the start of the study, written for you before every serial run (verbatim, or combined with their baseline when mode="multiply" / "add"), and restored at the end - so evaluate only has to do what affects cannot. You give a Study one callable, evaluate(values), that does any remaining setup, runs the model and reduces one run to (scalars, raw). Study.run() sweeps the parameters, restores the model, and hands back a tidy MultiIndex table plus correlation / regression / Sobol / plotting helpers.

import parstudy as ps

# `affects` are written (and restored) for you; `mode="multiply"` sweeps a factor
speed = ps.ModelParameter("speed", ps.linspace(0.5, 2.0, 6), affects=[(model, "speed")])
drag = ps.ModelParameter("drag", [0.5, 1.0, 2.0], default=1.0, mode="multiply",
                         affects=[(model, "drag")])

def evaluate(values):
    raw = run(model)                       # model.speed / model.drag already set
    return {"range": raw.range, "peak": raw.peak}, raw

study = ps.Study([speed, drag], evaluate)

results = study.run(verbose=1)        # one-at-a-time: each parameter swept, others at default
results.evaluations                   # MultiIndex table: ("parameters", ...) and ("results", ...)
results.varied                        # Series: which parameter each run swept
results.correlation()                 # parameter x metric
results.regression(standardized=True) # comparable sensitivity coefficients
results.plot()                        # metric vs value, one panel per parameter
results.raw(3)                        # the full artefact of run 3

Switch the design with one argument: strategy="grid", ps.latin_hypercube(120), ps.sobol(256) (then results.sobol_indices()), or ps.from_design("design.csv"). run(raw_store="dir") streams raw results to disk and enables run(resume=True) and run(parallel=N).

Why not a for loop?

A hand-written sweep tangles parameter definitions, ranges, model mutation, running, collecting and restoring - and you rewrite it for every study. parstudy separates them: parameters are reusable objects, the pipeline is one callable, the affected model state is snapshotted and restored even on error, and the results arrive in one schema the analysis helpers understand. See the getting-started tutorial for the full argument and a worked example.

Install

pip install -e .                    # numpy + pandas only
pip install -e ".[viz]"             # + matplotlib (all plots)
pip install -e ".[sampling]"        # + scipy   (sobol strategy / indices)
pip install -e ".[parallel]"        # + joblib  (run(parallel=N))
pip install -e ".[all]"             # everything above

License

MIT, see LICENSE.

Release files for parstudy 0.2.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 parstudy 0.2.0
File Size Uploaded
parstudy-0.2.0.tar.gz 53.3 kB Details

Built distribution (wheel)

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

Total release size: 75.5 kB

Release files / parstudy-0.2.0.tar.gz

Download URL parstudy-0.2.0.tar.gz
Size 53.3 kB
Tags Source
SHA-256 checksum
How to use checksums
300947acc97e326730ace04a56eab797b7d04b02424e03c8f16a672f237624fe
BLAKE2b-256 checksum
How to use checksums
d0c945eb69c823d17f94f22cbd2686ca21d1041cec3061cca92a0cb652b00ddc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 14, 2026.

Transparency log

Release files / parstudy-0.2.0-py3-none-any.whl

Download URL parstudy-0.2.0-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68c3263f94cc7c7cf4e8407b3a3236288cde418662db5082026b13074175d1fe
BLAKE2b-256 checksum
How to use checksums
cdbbe51ce5124af143917d02d21d6ece94af0f290ae092be20f7cc0f2065e58d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

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