pnps.runfile#
Run files: a configuration and its scan, in TOML, for the command line and records.
A run file holds two tables:
[config]: the fields ofpnps.setup.Config, with the beam as a table carrying itstype("HE11Beam","GaussianBeam"or"UniformBeam"), the collection windows as an array of tables (pnps.extraction.WindowSpecfields), and an optional injected input pulse as a recipe ([config.input_pulse]: the source file, its keys, and the spectral window, centring and normalisation to apply, aspnps.input_pulsedoes them);[scan]: the delay axistausand the save positionszsave(lists in s and m, or{start, stop, num}tables for evenly spaced ones), the steph_target, the scanname, the output directoryout_dirand the solpropbackend.
Paths in a run file are relative to the file’s own directory. Fields left out take
their defaults. dump_run() writes a run file load_run() reads back exactly.
Notes#
A small run file:
[config]
lam0 = 260e-9
tau_fwhm = 1e-15
energy = 1e-7
thickness = 40e-6
mask_diam = 1e-3
mask_spacing = 1e-3
lam_lims = [143e-9, 600e-9]
trange = 250e-15
r_max = 366e-6
n_transverse = 768
[config.beam]
type = "HE11Beam"
a = 125e-6
f_coll = 5.0
f_foc = 0.1
[[config.windows]]
holex = -1e-3
holey = -1e-3
holediam = 1e-3
zmask = 0.1
[scan]
name = "window_series"
taus = {start = -40e-15, stop = 40e-15, num = 161}
zsave = {start = 0.0, stop = 40e-6, num = 17}
h_target = 0.5e-6
Functions
|
Write a run file that |
|
Read a run file. |
Classes
|
How to build an injected input pulse from its source file. |
|
A configuration, its scan and the recipe of its input pulse. |
|
The scan a run file asks for. |
- class pnps.runfile.PulseRecipe(file, omega_key='ω', e_omega_key='Eω', window=None, wfrac_blue=0.05, wfrac_red=0.03, centre=True, normalise=True)[source]#
Bases:
objectHow to build an injected input pulse from its source file.
- Attributes:
- filestr
The source file, relative to the run file’s directory or absolute.
- omega_key, e_omega_keystr
Its frequency and complex-spectrum datasets.
- windowtuple of float or None
(lam_min, lam_max)in m forpnps.input_pulse.spectral_window(), or None for no window.- wfrac_blue, wfrac_redfloat
The window’s edge fractions.
- centrebool
Centre the pulse in time (
pnps.input_pulse.centre_pulse()).- normalisebool
Normalise its peak (
pnps.input_pulse.normalise_peak()).
- class pnps.runfile.RunFile(config, scan, input_pulse=None, base=PosixPath('.'))[source]#
Bases:
objectA configuration, its scan and the recipe of its input pulse.
- Attributes:
- configConfig
The configuration, with its input pulse built when there is a recipe.
- scanScanSpec
The scan.
- input_pulsePulseRecipe or None
How the input pulse was built, or None for the synthetic Gaussian.
- basepathlib.Path
The directory relative paths are taken from.
- input_pulse: PulseRecipe | None = None#
- class pnps.runfile.ScanSpec(name, taus, zsave, h_target, out_dir='.', backend='auto')[source]#
Bases:
objectThe scan a run file asks for.
- Attributes:
- namestr
The scan name; files are
<out_dir>/<name>_collected[.shard<i>].h5.- tausnumpy.ndarray
The delay axis in s.
- zsavenumpy.ndarray
The save positions in m.
- h_targetfloat
The largest step of the replayed schedule, m.
- out_dirstr
The output directory, relative to the run file’s directory or absolute.
- backendstr
The solprop backend registry name.
- taus: Float[ndarray, 'n_delays']#
- zsave: Float[ndarray, 'n_z']#
- pnps.runfile.dump_run(run, path)[source]#
Write a run file that
load_run()reads back exactly.- Parameters:
- runRunFile
The run; its configuration’s input pulse must come from its recipe.
- pathstr or pathlib.Path
The TOML file to write.
- Raises:
- ConfigError
If the configuration carries an input pulse without a recipe (its arrays have no place in a run file).
- pnps.runfile.load_run(path)[source]#
Read a run file.
- Parameters:
- pathstr or pathlib.Path
The TOML file.
- Returns:
- RunFile
The configuration (with its input pulse built), the scan and the recipe.
- Raises:
- ConfigError
If a table is missing, or holds an unknown key, a missing required field or an unreadable axis.