solprop.driver.summary#

The block a run shows before its first step: what is about to be computed, and how.

Every route reaches solprop.driver.run.run_problem(), which builds this summary from the translated KernelProblem, the run’s RunMetadata (whose configuration holds the physics objects the problem was built from: the responses, the medium, the profiles), the backend’s own execution record and the output. It hands the text to the progress reporter, so it follows the progress choice exactly as the progress lines do, and records it on a plane store as the RUN_SUMMARY_ANNOTATION.

The rows are descriptions for a person, not a record: everything in them is also in the run’s metadata, which is what a program should read. Nothing here evaluates physics.

The manual page is docs/guide/performance/progress.md.

Module Attributes

RUN_SUMMARY_ANNOTATION

Name of the annotation holding the start-of-run summaries of a plane store.

Functions

run_summary(problem, metadata, *, backend, ...)

Describe a run before its first step.

Classes

RunSummary(title, rows)

What a run is about to compute, as one aligned block.

solprop.driver.summary.RUN_SUMMARY_ANNOTATION = 'run_summary'#

Name of the annotation holding the start-of-run summaries of a plane store.

A list with one mapping per start, {"title": str, "rows": [[key, value], ...]}: a run that is resumed adds the summary of its continuation to the first one’s.

class solprop.driver.summary.RunSummary(title, rows)[source]#

Bases: Displayed

What a run is about to compute, as one aligned block.

Attributes:
titlestr

The first line: where the run starts and ends.

rowstuple of tuple of str

(key, value) pairs, one per aspect of the run, in a fixed order.

Examples

>>> from solprop.driver.summary import RunSummary
>>> print(RunSummary("Starting propagation", (("noise", "off"),)))
Starting propagation
  noise: off
record()[source]#

Return the summary as plain JSON values, for a store’s annotation.

Returns:
dict

{"title": ..., "rows": [[key, value], ...]}.

rows: tuple[tuple[str, str], ...]#
text()[source]#

Return the block, as the reporter shows it.

Returns:
str

The title and one line per row, without a trailing newline.

title: str#
solprop.driver.summary.run_summary(problem, metadata, *, backend, execution, output, start_plane=0, z_start=0.0)[source]#

Describe a run before its first step.

Parameters:
problemsolprop.translate.problem.KernelProblem

The translated problem.

metadatasolprop.output.schema.RunMetadata

The run’s record; its configuration supplies what the problem holds only as compiled tables (the medium and the response models).

backendstr

The backend’s name.

executioncollections.abc.Mapping

The backend’s metadata(), which says how it sized its thread pools and which propagator it chose.

outputsolprop.output.schema.Output

Where the planes go.

start_planeint, optional

Index of the first save plane beyond the loaded state; above zero the run is a resume.

z_startfloat, optional

Where the run starts, m.

Returns:
RunSummary

The title and the rows.

Examples

>>> from solprop.driver.simulation import metadata_for
>>> from solprop.driver.summary import run_summary
>>> from solprop.grid import EnvelopeGrid
>>> from solprop.nonlinear.gnlse import problem_from
>>> from solprop.output import MemoryOutput
>>> 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.183e-26], omega_ref=grid.omega0,
...                      gamma=0.11, shock=False)
>>> start = SechPulse(wavelength=835e-9, width=100e-15, peak_power=9.8).build(grid)
>>> problem = assemble(grid, gnlse.mode, [gnlse.kerr], start,
...                    controller=PIController(rtol=1e-6, atol=1e-16),
...                    save_planes=[0.005, 0.01], dz_max=0.01, dz_init=1e-3,
...                    density=1.0, shock=False, prefactor_index=1.0)
>>> summary = run_summary(problem, metadata_for(problem, grid), backend="numpy_ref",
...                       execution={}, output=MemoryOutput())
>>> dict(summary.rows)["shot noise"]
'off'