solprop.driver.metadata#

The record that says what produced a run, and whether it may be resumed.

metadata_for() builds a run’s solprop.output.metadata.RunMetadata: its grid, modes, configuration, stepper, plane bases and recipe. The manual page is docs/guide/setup/running.md.

Functions

metadata_for(problem, request, grid, *[, ...])

Build the record that says what produced a run, and whether it may be resumed.

Classes

RecipeSource(*args, **kwargs)

What built a simulation from a recipe: it writes the record its output keeps.

class solprop.driver.metadata.RecipeSource(*args, **kwargs)[source]#

Bases: Protocol

What built a simulation from a recipe: it writes the record its output keeps.

solprop.recipe.core.Recipe is one (SEP 41, S2); the driver needs only this.

record(simulation)[source]#

Return the authored and resolved recipe of a run about to start.

Parameters:
simulationSimulation

The simulation, translated, with its settings at run start.

Returns:
solprop.output.records.RecipeRecord

The record its output keeps.

solprop.driver.metadata.metadata_for(problem, request, grid, *, modes=(), configuration=None, noise=None, modal=None, materials=None, quadrature=None, frame=None, noise_resolution=None, defaults=None)[source]#

Build the record that says what produced a run, and whether it may be resumed.

Everything that describes what is computed goes into the digest solprop.output.metadata.RunMetadata.configuration_hash() takes – the grid, the modes, the configuration, the noise and the stepper settings, plus the save planes and the statistics, which are read off the run’s request here – and nothing that describes when or with which build, so a resume survives an unrelated commit or a NumPy upgrade.

Parameters:
problemsolprop.translate.problem.PropagationProblem

The translated problem the run will step.

requestsolprop.translate.run_request.RunRequest

The request translation returned with it: its stepper settings, save planes and statistics enter the hash exactly as they did when the problem carried them.

gridsolprop.grid.TimeGrid

The grid the state lives on.

modescollections.abc.Sequence, optional

The propagated modes, in state order.

configurationcollections.abc.Mapping, optional

The physics objects that built the run – responses, the input, profiles, boundaries – recorded by solprop.output.serialisation.serialise(). Nothing is dropped: a callable is recorded as its repr and marked unreproducible, which also makes the digest unstable across processes, so prefer objects that carry their data (docs/guide/setup/running.md).

noisesolprop.noise.NoiseRealisation or None, optional

The realisation the run carries, recorded with its seed.

modalcollections.abc.Mapping or None, optional

The general modal identity, as solprop.translate.general.modal_identity() writes it: the channel labels, the table, metric, response and guide identities, the frame, the active band and the accessors the basis admits. None for every other route. It is part of the resume key.

materialssolprop.physdata.selection.MaterialManifest or None, optional

The run’s material manifest (solprop.driver.material_output.material_manifest()); None is the empty manifest of a run of solprop’s own materials. Its identities and policies are part of the resume key.

quadraturesolprop.modes.quadrature.TransverseQuadrature or None, optional

The transverse rule of a resolved modal run, recorded with its nodes and physical weights on the first mode’s cross-section and part of the resume key (SEP 19). None for every other route.

framesolprop.linear.Frame or None, optional

The run’s frame, whose reference frequency is the origin of the linear frame term on an envelope grid; None is the grid’s co-moving frame. It enters the plane-reference record (SEP 31), not the hash.

noise_resolutionsolprop.output.records.NoiseResolution or None, optional

How the noise model was chosen (SEP 37). Outside the hash.

defaultssolprop.output.records.DefaultsResolution or None, optional

Which stepping choices took the route’s default. Outside the hash.

Returns:
solprop.output.metadata.RunMetadata

The record, ready for solprop.output.store.Output.open().

Examples

>>> from solprop.driver.metadata import metadata_for
>>> from solprop.grid import EnvelopeGrid
>>> from solprop.nonlinear.gnlse import problem_from
>>> from solprop.pulses import SechPulse
>>> from solprop.stepper import PIController
>>> from solprop.translate.problem import assemble
>>> grid = EnvelopeGrid.from_limits(0.01, 835e-9, (500e-9, 2e-6), 1e-12)
>>> gnlse = problem_from([0.0, 0.0, -1.2e-26], omega_ref=grid.omega0, gamma=0.11)
>>> start = SechPulse(wavelength=835e-9, width=1e-13, peak_power=1.0).build(grid)
>>> problem, request = assemble(grid, gnlse.mode, [gnlse.kerr], start,
...                    controller=PIController(rtol=1e-8, atol=1e-14),
...                    save_planes=[0.01], dz_max=0.01, dz_init=1e-3,
...                    density=1.0, shock=False, prefactor_index=1.0)
>>> metadata = metadata_for(problem, request, grid, modes=[gnlse.mode])
>>> metadata.simulation_kind, len(metadata.configuration_hash())
('mode_averaged', 64)