solprop.backends.records#
The run records: what one run’s march, session and monitor read (SEP 52 §5.1).
Each record is a frozen dataclass formed once per run by the shared builders here, from
the PropagationProblem, the
RunRequest and the
Start, so that every number either backend uses has
one source. run_records() forms them all:
the method’s policy:
MarchPolicyfor the Adams march (adams_policy()),RungeKuttaPolicyfor the Runge-Kutta march and the low-storage replay (runge_kutta_policy()), and the low-storage march’sLowStorageSettings;the schedule, when one is fixed (a
FixedSchedule);the
PlanePlan: the planes, step planes, statistics cadence, replay length and the native session’s capacities;the boundary monitor’s
MonitorRecords: itsMonitorConfig, a transverse edge’sEdgeConfig, and a resumed run’sMonitorContinuation.
The native adapter converts them into what its extension reads; the reference reads
them where it would otherwise derive the same facts. Notice and
EdgeNotice are the backend-neutral form of a session’s boundary verdicts.
The statistics lowering stays each backend’s own: the native plan is lowered in C++,
and the reference evaluates the StatsSpec directly.
Nothing here imports a backend, so the records are available without the native package installed.
Module Attributes
A march call's most attempts, as the native marches bound them (SEP 39). |
|
A march call's most wall time, s. |
|
The most attempts the native session holds between two events; a full buffer yields a progress event carrying them (SEP 47 section 5.3). |
|
The most periodic rows it holds between two events, likewise. |
|
The monitor record's plane rows, in the native order ( |
|
The transverse statuses in the native order ( |
Functions
|
Return the Adams march's policy of one run (SEP 39 section 4.2). |
|
Return whether a run's stages may leave a quiet temporal collar out (SEP 21). |
|
Return whether a run declares content above |
|
Return a fresh transverse edge's configuration for its launch's arguments. |
|
Return what a resume reads of an earlier execution's transverse edge record. |
|
Return the low-storage replay's settings, or |
|
Return a fresh monitor's configuration for a run. |
|
Return a monitored resume's continuation records. |
|
Return a run's boundary records, or |
|
Return a run's plane plan. |
|
Return what a resume reads of an earlier execution's monitor record. |
|
Return one run's records. |
|
Return the Runge-Kutta march's policy of one run. |
Classes
|
A session's transverse edge's configuration ( |
|
A transverse edge's verdict ( |
|
A transverse edge's notice's kind ( |
|
What a resume reads of an earlier edge record ( |
|
What the low-storage replay reads beside the Runge-Kutta policy (SEP 24). |
|
A session's boundary monitor's configuration ( |
|
A monitored resume's continuation, as a session reads it. |
|
A monitored run's boundary records. |
|
A boundary monitor's verdict ( |
|
A boundary monitor's notice's kind ( |
|
Where a run is observed and how its session buffers (SEP 47 section 5.3). |
|
What a resume reads of an earlier monitor record ( |
|
Every record of one run, formed once by |
|
Every number the Runge-Kutta march reads and never changes during a run (SEP 45). |
- solprop.backends.records.ATTEMPT_CAPACITY = 4096#
The most attempts the native session holds between two events; a full buffer yields a progress event carrying them (SEP 47 section 5.3).
- solprop.backends.records.CALL_ATTEMPTS = 256#
A march call’s most attempts, as the native marches bound them (SEP 39).
- solprop.backends.records.CALL_SECONDS = 0.1#
A march call’s most wall time, s.
- class solprop.backends.records.EdgeConfig(faces, warn, stop, length, guard, k_min, k_floor, reads, backstop_reads, reach_growth, noise_factor, columns, kappa, kappa_order, design, ramp_rate, collar, collar_rate, declared, reads_edge, longest_step, noise_share, noise_modes)[source]#
Bases:
objectA session’s transverse edge’s configuration (
transverse::Config, SEP 40).Every threshold is formed as
TransverseEdgeforms it, so that a session compares the same numbers. Equality is by identity (eq=False) because it holds arrays.- Attributes:
- facestuple of str
The faces judged, in the edge’s order.
- warn, stopfloat
budget ** 2and(stop_factor * budget) ** 2.- lengthfloat
The run’s length, m.
- guardfloat
The guard’s width.
- k_minfloat
The safety ramp’s least transverse wavenumber, 1/m.
- k_floorfloat
- reads, backstop_reads, reach_growth, noise_factorfloat
solprop.transverse_monitor’s constants of those names.- columnsnumpy.ndarray
The spectral columns’ weights, shape
(n_columns,).- kappanumpy.ndarray
Each column’s transverse wavenumber, 1/m, shape
(n_kappa,).- kappa_ordernumpy.ndarray
Its ascending order,
uint64, shape(n_kappa,).- designbool
Whether a safety ramp is designed.
- ramp_ratenumpy.ndarray
The ramp’s rate by column, 1/m; empty without a design.
- collar, collar_ratebool
Whether the design has a collar, and a collar rate.
- declaredbool
Whether the run declares content above
discard_above(declared()).- reads_edgebool
Whether the backend reads the edge.
- longest_stepfloat or None
A fixed schedule’s longest step, m;
Nonewithout one.- noise_sharefloat
The input noise’s share of the weights on the first face.
- noise_modesfloat
The input noise’s count of modes.
- columns: Float[ndarray, 'n_columns']#
- kappa: Float[ndarray, 'n_kappa']#
- kappa_order: UInt[ndarray, 'n_kappa']#
- ramp_rate: Float[ndarray, 'n_ramp']#
- class solprop.backends.records.EdgeNotice(kind, stop, face, value, z, spacing, warned_at)[source]#
Bases:
objectA transverse edge’s verdict (
transverse::Notice): a warning or a stop.- Attributes:
- kindEdgeNoticeKind
What it is.
- stopbool
Whether it stops the run.
- faceint
The face it names, by index.
- valuefloat
The share, allowance or step it names.
- zfloat
Where, m.
- spacingfloat
A coarse schedule’s read spacing, m.
- warned_atfloat
Where the edge first warned, for a face’s stop, m; NaN where it did not.
- kind: EdgeNoticeKind#
- class solprop.backends.records.EdgeNoticeKind(*values)[source]#
Bases:
IntEnumA transverse edge’s notice’s kind (
transverse::Notice::Kind).- Attributes:
- NONEint
No notice.
- RAMP_BANDint
The launch’s share in the safety ramp’s band.
- UNWATCHEDint
The backend does not read the edge.
- CLIPint
A face’s clip of the launch.
- INSENSITIVEint
The input noise’s allowance exceeds the warning.
- COARSEint
A fixed schedule’s longest step outruns the read spacing.
- FACEint
A face’s judged share.
- RETURNEDint
A requested collar’s returned share.
- RAMP_REMOVALint
The safety ramp’s removal.
- CLIP = 3#
- COARSE = 5#
- FACE = 6#
- INSENSITIVE = 4#
- NONE = 0#
- RAMP_BAND = 1#
- RAMP_REMOVAL = 8#
- RETURNED = 7#
- UNWATCHED = 2#
- class solprop.backends.records.EdgeResumption(record, numbers=<factory>, edge_baseline=None, edge_max=None, edge_max_raw=None, reads=None, transverse_status=None)[source]#
Bases:
objectWhat a resume reads of an earlier edge record (
transverse::Resumption).- Attributes:
- recordbool
Whether there is a record at all.
- numberscollections.abc.Mapping
Each number present in the record, by field.
- edge_baseline, edge_max, edge_max_rawtuple of float or None
The per-face lists, once the record’s launch energy and baseline make the resume read them; each
Noneotherwise or without a value per face.- readsint or None
The reads, made whole, under the same condition.
- transverse_statusstr or None
The record’s status, when it names one.
- class solprop.backends.records.LowStorageSettings(flows, separable, origin)[source]#
Bases:
objectWhat the low-storage replay reads beside the Runge-Kutta policy (SEP 24).
- Attributes:
- flowsint
The flow volumes a step holds on a CPU (
low_storage_flows()): 0 recomputes each flow, 1 holds a constant operator’s tableexp(h_t D / 2), 2 a varying operator’sPandQ.- separablebool
Whether the operator is a separable geometry’s, whose increments are the distances themselves.
- originfloat
The operator’s origin,
linear.z_span[0], m, from which a table is built.
- class solprop.backends.records.MonitorConfig(policy, floor_share, floor_margin, budget, rate, can_rest)[source]#
Bases:
objectA session’s boundary monitor’s configuration (
watch::Config).Equality is by identity (
eq=False) becauserateis an array.- Attributes:
- policycollections.abc.Mapping
The predictions’ policy (
watch_policy()’s fields), its floor regions and launch floor zero: they are formed at the launch.- floor_sharefloat
No light is judged below this share of the launch energy.
- floor_marginfloat
- budgetfloat
The budget the finish’s removal is judged against.
- ratenumpy.ndarray
The collar’s power rate on the coarse axis, 1/m, shape
(n_t,).- can_restbool
Whether the route’s stages may leave a quiet collar out (
collar_rests()).
- rate: Float[ndarray, 'n_t']#
- class solprop.backends.records.MonitorContinuation(record, edge, plane, unwatched)[source]#
Bases:
objectA monitored resume’s continuation, as a session reads it.
- Attributes:
- recordResumption
The earlier monitor record’s resumption.
- edgeEdgeResumption
Its transverse edge record’s.
- planebool
Whether the run resumes at a saved plane.
- unwatchedtuple of tuple of float
The
(start, end)stretches, m, run since without a monitor.
- edge: EdgeResumption#
- record: Resumption#
- class solprop.backends.records.MonitorRecords(config, edge, continuation)[source]#
Bases:
objectA monitored run’s boundary records.
- Attributes:
- configMonitorConfig
The temporal monitor’s configuration.
- edgeEdgeConfig or None
A free-space run’s transverse edge’s, or
Nonewithout one.- continuationMonitorContinuation or None
A monitored resume’s continuation, or
Nonewhen the start carries none (a session may still be continued before it watches).
- config: MonitorConfig#
- continuation: MonitorContinuation | None#
- edge: EdgeConfig | None#
- class solprop.backends.records.Notice(kind, launch, z, value, cap, step)[source]#
Bases:
objectA boundary monitor’s verdict (
session::Notice): a warning or a stop.- Attributes:
- kindNoticeKind
What it is.
- launchbool
For a guard: whether it is the launch’s judgement.
- zfloat
Where, m.
- valuefloat
A guard’s amplitude, or the removed fraction.
- capfloat
A crossing’s cap, m.
- stepfloat
A crossing’s longest step before the next check, m.
- kind: NoticeKind#
- class solprop.backends.records.NoticeKind(*values)[source]#
Bases:
IntEnumA boundary monitor’s notice’s kind (
session::Notice::Kind).- Attributes:
- NONEint
No notice.
- GUARDint
A guard occupancy, at the launch or at a check.
- REMOVALint
The collar’s removal at the end of a run.
- CROSSINGint
A replay’s step passes the split collar’s cap.
- READINGint
The split found nothing where the state holds light.
- DIVISIONint
Light after a launch that held none, which the monitor divides by.
- TRANSVERSEint
The transverse edge’s verdict (
EdgeNotice).
- CROSSING = 3#
- DIVISION = 5#
- GUARD = 1#
- NONE = 0#
- READING = 4#
- REMOVAL = 2#
- TRANSVERSE = 6#
- solprop.backends.records.PLANE_COLUMNS = ('z', 'collar_occupancy', 'guard_low', 'guard_high', 'removed_fraction')#
The monitor record’s plane rows, in the native order (
watch::plane_columns).
- class solprop.backends.records.PlanePlan(z, planes, next_plane, launch_pending, step_planes, dense, period, replay_steps, replay_length, attempt_capacity, row_capacity, call_attempts, call_seconds)[source]#
Bases:
objectWhere a run is observed and how its session buffers (SEP 47 section 5.3).
Equality is by identity (
eq=False) becauseplanesis an array.- Attributes:
- zfloat
Where the run starts, m.
- planesnumpy.ndarray
The save planes, m, shape
(n_z,).- next_planeint
The first save plane strictly beyond z.
- launch_pendingbool
Whether the plane at z is owed.
- step_planesint
Save every this many accepted steps; 0 for none.
- densebool
Whether the planes are interpolated rather than landed on.
- periodint
Accepted steps between the periodic statistics rows; 0 without rows.
- replay_stepsint
A fixed schedule’s steps; 0 without one.
- replay_lengthfloat
A fixed schedule’s total length, m; 0.0 without one.
- attempt_capacity, row_capacityint
The most attempts and periodic rows the native session holds between two events (
ATTEMPT_CAPACITY,ROW_CAPACITY).- call_attemptsint
A march call’s most attempts (
CALL_ATTEMPTS).- call_secondsfloat
A march call’s most wall time, s (
CALL_SECONDS).
- property fixed_positions: tuple[float, ...] | None[source]#
Every position a plane is observed at, m, when the plan fixes them all.
The start and the save planes;
Nonewith step planes or interpolated planes, whose positions the march decides.
- planes: Float[ndarray, 'n_z']#
- solprop.backends.records.ROW_CAPACITY = 1024#
The most periodic rows it holds between two events, likewise.
- class solprop.backends.records.Resumption(record, collar_quiet=False, numbers=<factory>, unwatched=None, resumed_at=None, planes=None)[source]#
Bases:
objectWhat a resume reads of an earlier monitor record (
watch::Resumption).Only the record’s types are read: which numbers are restored, their defaults and the fallbacks are the session’s.
- Attributes:
- recordbool
Whether there is a record at all.
- collar_quietbool
bool(record.get("collar_quiet", False)).- numberscollections.abc.Mapping
Each number present in the record, by field; the counts already whole.
- unwatchedtuple or None
The record’s
unwatchedstretches, when it lists them.- resumed_attuple or None
The record’s
resumed_at, when it lists them.- planestuple or None
The record’s plane rows by
PLANE_COLUMNS(NaN forNone), when they have those five columns.
- class solprop.backends.records.RunRecords(policy, low_storage, schedule, planes, monitor)[source]#
Bases:
objectEvery record of one run, formed once by
run_records()(SEP 52 §5.1).- Attributes:
- policysolprop.stepper.multistep.MarchPolicy or RungeKuttaPolicy
The method’s policy: the Adams march’s, or the Runge-Kutta march’s, which the low-storage replay reads too.
- low_storageLowStorageSettings or None
The low-storage replay’s settings;
Nonefor another march.- schedulesolprop.stepper.schedule.FixedSchedule or None
The fixed schedule, when the run replays one.
- planesPlanePlan
The plane plan.
- monitorMonitorRecords or None
The boundary records;
Nonewithout a monitor.
- low_storage: LowStorageSettings | None#
- monitor: MonitorRecords | None#
- policy: MarchPolicy | RungeKuttaPolicy#
- schedule: FixedSchedule | None#
- class solprop.backends.records.RungeKuttaPolicy(controller, dz_min, dz_max, auto_init, stretch, z_end, save_planes, interpolate, hard_kinks, breakpoints, landing_ulps, start_growth, quiet_interval)[source]#
Bases:
objectEvery number the Runge-Kutta march reads and never changes during a run (SEP 45).
The controller’s decisions read the controller, the floor, the cap and the start-up flag (
solprop.backends.rk_core); the landings read the rest, the fields ofMarchPolicyof the same names. The native march receives it whole, with the controller’s fields, and holds no default of its own.- Attributes:
- controllersolprop.stepper.controller.PIController
The controller, whose gains, factors, lag, estimator order, tolerances and acceptance rule the decisions read.
- dz_min, dz_maxfloat
The floor and the cap on a proposal, m.
- auto_initbool
Whether the first accepted step takes the start-up rule.
- stretch, z_endfloat
The landing stretch (a ratio) and the run’s end, m.
- save_planestuple of float
The planes to land on, m; empty when the planes are interpolated.
- interpolatebool
Whether the save planes are observed densely.
- hard_kinkstuple of float
The operator’s hard kinks, m.
- breakpointstuple of float
The edges whose intervals cap a step, m: the operator’s breakpoints with the interval cap, otherwise only its first and last.
- landing_ulpsint
- start_growthfloat
- quiet_intervalfloat or None
The boundary monitor’s interval, m, which caps a step while the collar rests;
Nonefor a session, whose monitor holds its own.
- controller: PIController#
- solprop.backends.records.STATUSES: tuple[TransverseStatus, ...] = ('clear', 'warned', 'stopped', 'insensitive', 'coarse', 'unwatched')#
The transverse statuses in the native order (
transverse::Status).
- solprop.backends.records.adams_policy(problem, stepper, method, *, carrier)[source]#
Return the Adams march’s policy of one run (SEP 39 section 4.2).
- Parameters:
- problemsolprop.translate.problem.PropagationProblem
The problem: the operator’s breakpoints and kinks, and the in-stage temporal collar, whose largest rate bounds each order’s stable step in the exponential formulation.
- steppersolprop.translate.problem.StepperSettings
The run’s stepper settings.
- methodsolprop.stepper.multistep.Multistep
The method.
- carrierbool
Whether the engine’s carrier frame is active (
CarrierReference).
- Returns:
- solprop.stepper.multistep.MarchPolicy
The record, with no quiet interval.
- solprop.backends.records.collar_rests(problem, stepper)[source]#
Return whether a run’s stages may leave a quiet temporal collar out (SEP 21).
One rule for every backend: a modal or radial stage with the in-stage (
"nonlinear") scheme and a temporal collar alone. The low-storage march, coupled flows, the general modal route, a real-space collar sharing the term, and the Cartesian, line and planar routes keep the collar in every stage (SEP 21 D15).- Parameters:
- problemsolprop.translate.problem.PropagationProblem
The problem.
- steppersolprop.translate.problem.StepperSettings
The run’s stepper settings.
- Returns:
- bool
True when the term may be left out while the collar is quiet.
- solprop.backends.records.declared(problem)[source]#
Return whether a run declares content above
discard_above.- Parameters:
- problemsolprop.translate.problem.PropagationProblem
The problem.
- Returns:
- bool
True when its transverse specification sets
discard_above.
- solprop.backends.records.edge_config(edge, *, steps, declared, reads=True)[source]#
Return a fresh transverse edge’s configuration for its launch’s arguments.
- Parameters:
- edgesolprop.transverse_monitor.TransverseEdge
The run’s fresh edge.
- stepsnumpy.ndarray or None
A fixed schedule’s steps, m;
Nonefor an adaptive run.- declaredbool
Whether the run declares content above
discard_above.- readsbool, optional
Whether the backend reads the edge.
- Returns:
- EdgeConfig
The configuration.
- solprop.backends.records.edge_resumption(record, faces)[source]#
Return what a resume reads of an earlier execution’s transverse edge record.
Read as
resume()reads it: each number present, and, once the record’s launch energy and baseline make that resume read further, each per-face maximum that has a value per face and the reads, made whole as it makes them.- Parameters:
- recordobject
The
transverseentry of the earlier monitor record, or anything else when there is none.- facesint
The edge’s face count.
- Returns:
- EdgeResumption
What the session restores from.
- solprop.backends.records.low_storage_settings(problem, stepper)[source]#
Return the low-storage replay’s settings, or
Nonefor another march.- Parameters:
- problemsolprop.translate.problem.PropagationProblem
The problem.
- steppersolprop.translate.problem.StepperSettings
The run’s stepper settings.
- Returns:
- LowStorageSettings or None
The settings, when the run’s integrator is the low-storage march.
- solprop.backends.records.monitor_config(monitor, crossing, *, can_rest)[source]#
Return a fresh monitor’s configuration for a run.
The predictions’ policy is the monitor’s own with the split collar’s crossing limit the run gives it.
- Parameters:
- monitorsolprop.monitor.BoundaryMonitor
The run’s fresh monitor.
- crossingsolprop.boundaries.SplitCrossing or None
The split collar’s crossing limit, under the split scheme.
- can_restbool
Whether the route’s stages may leave a quiet collar out.
- Returns:
- MonitorConfig
The configuration.
- solprop.backends.records.monitor_continuation(monitor, continuation)[source]#
Return a monitored resume’s continuation records.
- Parameters:
- monitorsolprop.monitor.BoundaryMonitor
The run’s fresh monitor, whose transverse edge gives the face count.
- continuationcollections.abc.Mapping
- Returns:
- MonitorContinuation
The records.
- solprop.backends.records.monitor_records(problem, request, start)[source]#
Return a run’s boundary records, or
Nonewithout a monitor.- Parameters:
- problemsolprop.translate.problem.PropagationProblem
The problem: the split collar’s crossing limit, the quiet-collar rule and a declared transverse specification.
- requestsolprop.translate.run_request.RunRequest
The run’s request, with its fresh monitor.
- startsolprop.backends.session.Start
Where the run starts, with any monitor continuation.
- Returns:
- MonitorRecords or None
The records.
- solprop.backends.records.plane_plan(request, start)[source]#
Return a run’s plane plan.
- Parameters:
- requestsolprop.translate.run_request.RunRequest
The run’s request.
- startsolprop.backends.session.Start
Where the run starts.
- Returns:
- PlanePlan
The plan, with the native session’s capacities.
- solprop.backends.records.resumption(record)[source]#
Return what a resume reads of an earlier execution’s monitor record.
Read as
resume()reads it: each number present, the lists, and the plane rows when they have the five columns. A count that is not whole is refused as that resume refuses it, once the record’s launch energy makes it read the counts.- Parameters:
- recordcollections.abc.Mapping or None
The
boundary_monitorrecord of the latest earlier execution, orNone.
- Returns:
- Resumption
What the session restores from.
- solprop.backends.records.run_records(problem, request, start)[source]#
Return one run’s records.
- Parameters:
- problemsolprop.translate.problem.PropagationProblem
The translated problem.
- requestsolprop.translate.run_request.RunRequest
The run’s request.
- startsolprop.backends.session.Start
Where the run starts; its field is not read.
- Returns:
- RunRecords
The records.
Examples
>>> from solprop.backends.records import run_records >>> from solprop.backends.session import Start >>> 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.assembly import assemble >>> grid = EnvelopeGrid.from_limits(1.0, 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) >>> launch = SechPulse(wavelength=835e-9, width=100e-15, peak_power=9.8) >>> problem, request = assemble(grid, gnlse.mode, [gnlse.kerr], launch.build(grid), ... controller=PIController(rtol=1e-8, atol=1e-16), ... save_planes=[0.01], dz_max=0.01, dz_init=1e-3, ... density=1.0, shock=False, prefactor_index=1.0) >>> records = run_records(problem, request, Start.entrance(problem)) >>> type(records.policy).__name__, records.planes.planes.tolist() ('RungeKuttaPolicy', [0.01]) >>> records.low_storage is None, records.monitor is None (True, True)
- solprop.backends.records.runge_kutta_policy(problem, stepper)[source]#
Return the Runge-Kutta march’s policy of one run.
- Parameters:
- problemsolprop.translate.problem.PropagationProblem
The problem, whose operator’s breakpoints and hard kinks the landings read.
- steppersolprop.translate.problem.StepperSettings
The run’s stepper settings.
- Returns:
- RungeKuttaPolicy
The record, with no quiet interval.