Quick Start
Installation
pip install emout
For 3D visualization with PyVista:
pip install "emout[pyvista]"
Loading Simulation Data
import emout
data = emout.Emout("output_dir")
Emout scans the directory for HDF5 files and the parameter file (plasma.inp or plasma.toml).
Variable names are resolved from the EMSES filename convention:
Attribute |
Source file pattern |
Description |
|---|---|---|
|
|
Electrostatic potential |
|
|
Species-1 number density |
|
|
Species-1 current density (x) |
|
|
Electric field (x) |
|
|
Magnetic field (z) |
|
relocated from |
Relocated electric field (x) |
|
|
2D vector (auto-combined) |
|
|
3D vector (auto-combined) |
|
|
Current data (pandas DataFrame) |
|
|
Conductor data (pandas DataFrame) |
Each attribute is a time-series object. Indexing by timestep returns a NumPy-compatible array:
len(data.phisp) # Number of timesteps
data.phisp[0].shape # (nz, ny, nx)
data.phisp[-1] # Last timestep
Your First Plot
# 2D color map of potential on the xz-plane (y = ny/2) at the last timestep
data.phisp[-1, :, data.inp.ny // 2, :].plot()
Slicing follows the axis order (t, z, y, x). After slicing out a 2D or 1D array, call .plot() to visualize it with SI unit labels.
Appended Simulation Outputs
If the simulation continued into additional directories:
# Automatic detection
data = emout.Emout("output_dir", ad="auto")
# Manual specification
data = emout.Emout("output_dir", append_directories=["output_dir_2", "output_dir_3"])
Particle Data
EMSES particle outputs are automatically grouped by species:
p4 = data.p4 # Species 4
p4.x, p4.y, p4.z # Position time series
p4.vx, p4.vy, p4.vz # Velocity time series
p4.tid # Trace ID
# Convert to pandas Series
data.p4.vx[0].val_si.to_series().hist(bins=200)