A python package for running parallel experiments across parameter grids with MPI.
Project description
A python package for running parallel experiments across parameter grids with MPI.
Features
- Flexible Experimentation with Parameter Grids: SweepExp simplifies running experiments over a grid of parameter combinations. Results are stored in an xarray dataset for easy access and analysis.
- Parallelization: Support for parallelization using multiprocessing, or MPI for high-performance computing.
- User-Friendly API: Define the function to be tested, set up parameter sweeps, and specify return types effortlessly.
Installation
SweepExp can be installed via pip:
pip install sweepexp
Usage
The followin example shows how to setup a simple experiment that is run on a grid of parameters. Where each parameter combination is run in parallel on separate processes.
from sweepexp import SweepExpParallel
# Define a function to be tested
def my_custom_experiment(x: float, y: float) -> dict:
"""Add and multiply two numbers."""
return {"addition": x + y, "multiplication": x * y}
sweep = SweepExpParallel(
func = my_custom_experiment,
parameters = { "x": [1, 2], "y": [3, 4, 5] },
)
sweep.run()
print(sweep.data)
with the output:
<xarray.Dataset> Size: 160B
Dimensions: (x: 2, y: 3)
Coordinates:
* x (x) int64 16B 1 2
* y (y) int64 24B 3 4 5
Data variables:
status (x, y) <U1 24B 'C' 'C' 'C' 'C' 'C' 'C'
addition (x, y) float64 48B 4.0 5.0 6.0 5.0 6.0 7.0
multiplication (x, y) float64 48B 3.0 4.0 5.0 6.0 8.0 10.0
For more information on how to use the package, please refer to the documentation
How to cite
@software{Rosenau_sweepexp_2025,
author = {Rosenau, Silvano Gordian},
doi = {10.5281/zenodo.14779187},
month = jan,
title = {{SweepExp: A python package for running parallel experiments across parameter grids.}},
url = {https://github.com/Gordi42/sweepexp},
version = {1.0.2},
year = {2025}
}
Author
License
SweepExp is licensed under the MIT License. See LICENSE for more information.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sweepexp-1.1.1.tar.gz.
File metadata
- Download URL: sweepexp-1.1.1.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
991ac44f538a27a71ad5ad0b80b0de72490db93708855c2a43017403be532835
|
|
| MD5 |
f73379370399956e786ae7db028bafe6
|
|
| BLAKE2b-256 |
0d720b8fbe0e8ce49b650905b49f62af962d236c36d3fd52e4a78a155d550ec6
|
Provenance
The following attestation bundles were made for sweepexp-1.1.1.tar.gz:
Publisher:
publish-to-test-pypi.yml on Gordi42/sweepexp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sweepexp-1.1.1.tar.gz -
Subject digest:
991ac44f538a27a71ad5ad0b80b0de72490db93708855c2a43017403be532835 - Sigstore transparency entry: 377233475
- Sigstore integration time:
-
Permalink:
Gordi42/sweepexp@17ce722ac301ce4e7034ff954299c6e1aca9c705 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/Gordi42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@17ce722ac301ce4e7034ff954299c6e1aca9c705 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sweepexp-1.1.1-py3-none-any.whl.
File metadata
- Download URL: sweepexp-1.1.1-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
231138ae756d714a579e3c0c3c2981abbea406f61a8c7b7d0e4e06fcc89597ef
|
|
| MD5 |
594ccc4cc37ef0276437001d2310d73c
|
|
| BLAKE2b-256 |
fd8bf765804783aa93067726855b7b1de9463801657c37f660753ce1ccdac0d2
|
Provenance
The following attestation bundles were made for sweepexp-1.1.1-py3-none-any.whl:
Publisher:
publish-to-test-pypi.yml on Gordi42/sweepexp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sweepexp-1.1.1-py3-none-any.whl -
Subject digest:
231138ae756d714a579e3c0c3c2981abbea406f61a8c7b7d0e4e06fcc89597ef - Sigstore transparency entry: 377233488
- Sigstore integration time:
-
Permalink:
Gordi42/sweepexp@17ce722ac301ce4e7034ff954299c6e1aca9c705 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/Gordi42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@17ce722ac301ce4e7034ff954299c6e1aca9c705 -
Trigger Event:
push
-
Statement type: