Skip to main content

shephex

coverage Website

A Python package for managing and executing computational experiments.

Features

  • Easy management of parameter sweeps
  • Execution of python function or scripts with input sets.
  • Simple SLURM Scheduling from Python.
  • Extendable execution class to adapt to other job management systems.

The example show how easy it is to submit an arbitrary Python function for execution on Slurm. The function in this case is a biased-random walk in 2D for which 50 different parameterizations are submitted and executed.

import numpy as np
import shephex

@shephex.hexperiment()
def biased_random_walk_2d(steps: int, bias_x: float, bias_y: float) -> tuple:
    """
    Simulate a 2D biased random walk and return the final position.
    """    
    # Movement choices: (-1, 1) for left/right (x) and down/up (y)
    moves_x = np.random.choice([-1, 1], size=steps, p=[1 - bias_x, bias_x])
    moves_y = np.random.choice([-1, 1], size=steps, p=[1 - bias_y, bias_y])
    
    final_x = np.sum(moves_x)
    final_y = np.sum(moves_y)
    
    return final_x, final_y  # Return final (x, y) position

if __name__ == '__main__':

    experiments = []
    for steps in [10, 100, 250, 500, 1000]:
        for bias_x in [0.5, 0.6]:
            for repeat in range(5):
                experiments += [biased_random_walk_2d(steps=steps, 
                                                    bias_x=bias_x, 
                                                    bias_y=0.5)]

    executor = shephex.SlurmExecutor(ntasks=1, partition='q48', time='00:10:00')
    executor.execute(experiments)

BEEP

Metadata

Release files for shephex 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 shephex 0.4.0
File Size Uploaded Provenance Actions
shephex-0.4.0.tar.gz 78.9 kB Without provenance Details for shephex-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 139.3 kB

Release files / shephex-0.4.0.tar.gz

Download URL shephex-0.4.0.tar.gz
Size 78.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5d6d2312f6673f4e8558c9a4f28e6a5a13ba2541e0b38e06e5f44f7e5143f454
BLAKE2b-256 checksum
How to use checksums
c2cb8efec6b0db2fed604916ac35d1a413269a70916edf781b4b85900706bb66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.17

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

Download URL shephex-0.4.0-py3-none-any.whl
Size 60.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95064ffbece6d0e852815f9cfeff67b4dd95246f64c4aa7f569633841551a8ec
BLAKE2b-256 checksum
How to use checksums
4ac802bf81c80a50c0695bd2af5b10aea0c7b8b3744dd9bcd686dbe8cab40280
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.17

Security for shephex 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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