Skip to main content

A Python package to easily read input + output data from dHybridR.

Project description

dhybridrpy

PyPI version Documentation Status

dhybridrpy allows you to easily load and plot data from dHybridR simulations. It provides programmatic access to simulation input and output data and the ability to quickly visualize that data.

Features

  • Efficiently access simulation input data and output data like timesteps, fields (e.g., magnetic field), phases (e.g., distribution functions), and particle tracks.
  • Quickly plot 1D, 2D, and 3D output data.
  • Compute FFT power spectra and 1D spatial averages.
  • Follow individual particle trajectories across a simulation.
  • Lazily load large datasets using dask.
  • Perform arithmetic operations on data objects directly.

Installation

The latest package version can be installed via pip:

pip install dhybridrpy

Usage

Basic usage of the package:

from dhybridrpy import DHybridrpy

# Enter your input file and output folder paths here
input_file = "examples/data/inputs/input"
output_folder = "examples/data/Output"

dpy = DHybridrpy(input_file=input_file, output_folder=output_folder)

# Print simulation timesteps
print(dpy.timesteps())

# Access an input variable
print(f"Timestep = {dpy.inputs['time']['dt']}")

# Access data at a specific timestep
ts = 1
Bx = dpy.timestep(ts).fields.Bx()
print(Bx.data)

# Plot data
import matplotlib.pyplot as plt
Bx.plot()
plt.show()

Further examples can be found in the examples folder and in the online documentation.

CLI Tool: dplot

dplot is a command-line tool for visualizing dHybridR simulation fields and phases across all timesteps, saving PNG images and optionally creating MP4 videos. It is included when you install dhybridrpy.

Discover available data

dplot -i path/to/input

Plot specific fields

dplot -i path/to/input --fields Bx --fields By

Plot phase-space distributions

dplot -i path/to/input --phases p1x1 --species 3

Plot all fields with video output

dplot -i path/to/input --all-fields --video

Key options: --video, --fps, --colormap, --dpi, --vmin/--vmax, --type, --plots-dir, -j (parallel processes), -v (verbose). Large datasets are automatically downsampled to 1080p. See the dplot documentation for full details.

Documentation

Full documentation is available at dhybridrpy.readthedocs.io.

License

Project licensed under the GNU Affero General Public License v3.0. See the LICENSE file for details.

Authors

  • Bricker Ostler
  • Miha Cernetic

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

dhybridrpy-1.9.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dhybridrpy-1.9-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file dhybridrpy-1.9.tar.gz.

File metadata

  • Download URL: dhybridrpy-1.9.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dhybridrpy-1.9.tar.gz
Algorithm Hash digest
SHA256 ac13b8c6c1a09912dd18ebe3fda68f512ed59714d372da901cb3e884ea67f283
MD5 8379a2e6d242f54ffb96fe3ad1f783bc
BLAKE2b-256 6e03aed072225ff5f4d138b769ba3902bc6ec7ba6bc4cf429c9e412f8b92506b

See more details on using hashes here.

File details

Details for the file dhybridrpy-1.9-py3-none-any.whl.

File metadata

  • Download URL: dhybridrpy-1.9-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dhybridrpy-1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d03945cbd00787a2f268619f7ea4aa518b5b68e38045642b69f2a743fb78f9bf
MD5 42fabe0006c4077304f6e0725b24ff82
BLAKE2b-256 6635e8e5afee1f77a2f390063d0b1335a762b78c46c4743fda8add811f1ebf88

See more details on using hashes here.

Supported by

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