Output.jl

Amalthea.Output.HDF5OutputMethod

Calling the output handler writes data to the file Arguments: y: current function value t: current propagation point dt: current stepsize yfun: callable which returns interpolated function value at different t Note that from RK45.jl, this will be called with yn and tn as arguments.

source
Amalthea.Output.MemoryOutputMethod

Calling the output handler saves data in the arrays Arguments: y: current function value t: current propagation point dt: current stepsize yfun: callable which returns interpolated function value at different t Note that from RK45.jl, this will be called with yn and tn as arguments.

source
Amalthea.Output.ScanHDF5OutputMethod
ScanHDF5Output(scan, scanidx, args...; fname=nothing, fdir=nothing, kwargs...)

Create an HDF5Output for the given scan at the current scanidx and automatically save the scan arrays and current values of the scan variables in the file. If given, fdir is used as a directory in which to store the scan output. fname can be used to manually name files. The running scan index will be appended to fname for each file.

source
Amalthea.Output.check_cacheMethod
check_cache(o::HDF5Output, y, t, dt)

Check for an existing cached propagation in the output o and return this cache if present.

source
Amalthea.Output.scansaveMethod
scansave(scan, scanidx; grid, stats, fpath, script, kwargs...)

While running the given scan, save the variables given as keyword arguments into the scan grid as determined from the variables of the scan. Special keyword arguments are:

  • grid::AbstractGrid: Save the simulation grid in a dictionary (but only once)
  • stats: The statistics dictionary from a simulation is saved in scan grid and NaN-padded to account for variable lengths in the output arrays
  • fpath: Path to the file. Defaults to the scan name plus "_collected"
  • script: Path to the Julia scrpt file running the scan. Can be grabbed automatically using the macro @scansave.

Another keyword argument lock_stale_age sets the time in seconds after which the function ignores the lock on the file and writes to it anyway. Defaults to 300 s (5 min). (Note that if the PID of the locking process appears valid, this is automatically increased 25x.)

source
Amalthea.Output.scansave_stats_arrayMethod
scansave_stats_array(stats_dict)

Convert the statistics dictionary created by scansave into a dictionary containing arrays of arrays. This removes unused elements in the arrays and the need to use valid_length to avoid including NaNs.

source
Amalthea.Output.write_scan_point_nativeMethod
write_scan_point_native(fpath, y, z; yname="Eω", tname="z", lockpath=nothing)

Opt-in backend (BACKLOG.md S6 item 2): write one completed scan point's output arrays directly to the HDF5 file at fpath via the native Rust writer (scan_write_point_ffi), bypassing HDF5.jl for the large field array y.

y is the complex field array (any shape; its last dimension indexes the propagation coordinate) and z the propagation coordinates. The resulting file matches the on-disk layout HDF5Output produces (groups stats/meta, a complex yname dataset, and an f64 tname dataset), so it reads back through HDF5Output/HDF5.read unchanged.

If lockpath is given, the create+write is performed while holding the same process-level file lock the scan queue uses — for concurrent workers writing a shared file. Per-scanidx files (the usual case) can leave it nothing.

This is a deliberate opt-in: the default Julia HDF5Output path is unchanged.

source
Base.getindexMethod

getindex works interchangeably so when switching from one Output to another, subsequent code can stay the same

source
Amalthea.Output.@ScanHDF5OutputMacro
@ScanHDF5Output(scan, scanidx, args...)

Create an HDF5Output for the given scan at the current scanidx and automatically save the running script, scan arrays, and current values of the scan variables in the file. All arguments, including keyword arguments, after scanidx are identical to HDF5Output.

source