Skip to main content

Create campaigns of EPOCH plasma PIC code runs over a given parameter space using various sampling methods.

Project description

epyscan

Create campaigns of EPOCH runs over a given parameter space using various sampling methods

Installation

Install from PyPI with:

pip install epyscan

or from a local checkout:

git clone https://github.com/PlasmaFAIR/epyscan.git
cd epyscan
pip install .

We recommend switching to uv to manage packages.

Usage

Parameter space to be sampled is described by a dict where keys should be in the form of block_name:parameter, and values should be dicts with the following keys:

  • "min": minimum value of the parameter
  • "max": maximum value of the parameter
  • "log": (optional) bool, if True then grid is done in log space for this parameter
import pathlib
import epyscan
import epydeck

# Define the parameter space to be sampled. Here, we are varying the intensity
# and density
parameters = {
  # Intensity varies logarithmically between 1.0e22 and 1.0e24
  "constant:intens": {"min": 1.0e22, "max": 1.0e24, "log": True},
  # Density varies logarithmically between 1.0e20 and 1.0e24
  "constant:nel": {"min": 1.0e20, "max": 1e24, "log": True},
}

# Load a deck file to use as a template for the simulations
with open("template_deck_filename") as f:
  deck = epydeck.load(f)

# Create a grid scan object that will generate 4 different sets of parameters 
# within the specified ranges
grid_scan = epyscan.GridScan(parameters, n_samples=4)

# Define the root directory where the simulation folders will be saved. 
# This directory will be created if it doesn't exist
run_root = pathlib.Path("example_campaign")

# Initialize a campaign object with the template deck and the root directory. 
# This will manage the creation of simulation cases
campaign = epyscan.Campaign(deck, run_root)

# Generate the folders and deck files for each set of parameters in the
# grid scan
paths = [campaign.setup_case(sample) for sample in grid_scan]

# Save the paths of the generated simulation folders to a file
with open("paths.txt", "w") as f:
  [f.write(f"{path}\n") for path in paths]

# Opening paths.txt
# example_campaign/run_0_1000000/run_0_10000/run_0_100/run_0
# example_campaign/run_0_1000000/run_0_10000/run_0_100/run_1
# example_campaign/run_0_1000000/run_0_10000/run_0_100/run_2
# example_campaign/run_0_1000000/run_0_10000/run_0_100/run_3

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

epyscan-0.1.0.tar.gz (77.2 kB view details)

Uploaded Source

Built Distribution

epyscan-0.1.0-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file epyscan-0.1.0.tar.gz.

File metadata

  • Download URL: epyscan-0.1.0.tar.gz
  • Upload date:
  • Size: 77.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for epyscan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c81c9fb78ad7c99390153810e4264815c292f71db339ac3c13fe6fdd5479c43e
MD5 637b5e663d4d4d8875d552ae05454a92
BLAKE2b-256 4f1b60ff52b30a68cc44a9c1c03f799a6459736f8f978e31b5f1b5873ace209a

See more details on using hashes here.

Provenance

The following attestation bundles were made for epyscan-0.1.0.tar.gz:

Publisher: build_publish.yml on PlasmaFAIR/epyscan

Attestations:

File details

Details for the file epyscan-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: epyscan-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for epyscan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c56fe5f47eccf4fa24318da96240ff380c3a7fa74a69f8dc6b2182d0d686d213
MD5 47602e6b3dd28e2cbbdd45f7c596bbd2
BLAKE2b-256 31ebe5490226220a9ecddd8b7b3de268c2e67b75e88b7a650499d6248e4fb642

See more details on using hashes here.

Provenance

The following attestation bundles were made for epyscan-0.1.0-py3-none-any.whl:

Publisher: build_publish.yml on PlasmaFAIR/epyscan

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page