pnps.simulate#
The per-delay-point simulation driver.
One delay point is: form the superposed gate pair and delay-phased test beamlet
(pnps.form_input), let solprop propagate the 3-D envelope UPPE through the slab
on a replayed fixed schedule (pnps.bridge), and at every save position reduce
the state on the host to the per-window spectra (pnps.reduce_numba). One
bridge serves every delay point of a configuration: run_delay_point() takes a
built bridge, simulate_delay_point() builds and closes one around a single
point.
The delay convention is “gate”: the test (probe) beamlet is multiplied by
exp(+1j omega tau) (advanced by tau), equivalent to delaying the gate pair by
+tau. Downstream readers must not reverse the delay axis.
Module Attributes
A visitor of |
|
The per-window and signal-region spectra every save position yields. |
|
The per-save spectral diagnostics: the whole beam's spectrum. |
|
The per-save scalar diagnostics. |
Functions
|
Form the superposed beamlets of one delay. |
|
Simulate one delay point on a built bridge and extract all observables. |
|
Simulate one delay point and extract all observables. |
|
Propagate one delay point and hand each plane on with its nonlinear part. |
- pnps.simulate.DIAGNOSTICS = ('energy', 'absorb_omega', 'absorb_lap', 'absorb_k', 'gd_band_power', 'alias_fraction', 'edge_fraction')#
The per-save scalar diagnostics.
- pnps.simulate.OBSERVABLES = ('i_omega_win', 'i_omega_reimaged', 'i_omega_full')#
The per-window and signal-region spectra every save position yields.
- pnps.simulate.SPECTRAL_DIAGNOSTICS = ('i_omega_beam',)#
The per-save spectral diagnostics: the whole beam’s spectrum.
- pnps.simulate.NonlinearVisitor#
A visitor of
visit_nonlinear(): the position in m, the field there and its nonlinear part, each(n, n, nt)and valid only during the call.alias of
Callable[[float,Complex[ndarray, 'n_y n_x n_omega'],Complex[ndarray, 'n_y n_x n_omega']],None]
- pnps.simulate.delayed_input(setup, tau, out=None)[source]#
Form the superposed beamlets of one delay.
The test arm is advanced by tau (
exp(+1j omega tau), “gate” delay convention); the gate pair is delay-free.- Parameters:
- setupSetup
The configuration, as built by
build_setup().- taufloat
Delay in s.
- outnumpy.ndarray or None
A C-contiguous complex128
(n, n, nt)array to write into, or None to allocate one.
- Returns:
- numpy.ndarray
The input state
(n, n, nt), complex128, C-contiguous.
- pnps.simulate.run_delay_point(bridge, tau)[source]#
Simulate one delay point on a built bridge and extract all observables.
Correctness guards: light that wraps the periodic time window must not reach the other pulse strongly enough to act there (the delay lies within 75 % of
time_headroom, or its wrap coupling is withinpnps.absorber.WRAP_COUPLING_LIMIT;pnps.absorber.wrap_coupling()), and the total field energy must never grow (the propagation is lossy-or-conservative by construction, so growth means numerical trouble). Per-save diagnostics report what the absorbers remove and how much field power sits in the group-delay-absorbed band.- Parameters:
- bridgeBridge
The configuration on solprop (
pnps.bridge.build_bridge()).- taufloat
The delay in s.
- Returns:
- dict of numpy.ndarray
i_omega_winandi_omega_reimagedwith shape(nz, n_windows, nt),i_omega_fullandi_omega_beamwith(nz, nt),z, the per-save diagnostics ofDIAGNOSTICSwith shape(nz,), andlap_lostwith(nt,): the energy per bin the lap budget removed between the first and the last save position (pnps.absorber.lap_lost(); include 0.0 inzsaveto cover the whole slab, andpnps.absorber.lap_loss_share()turns it into a band’s share). The spectra are in the state’s unnormalised-DFT units (scaling as the fourth power of the transverse sample count at fixed extent).
- Raises:
- DelayError
If
tauis not a scalar.- ConfigError
If light that wraps the time window could act at the delay (
pnps.absorber.wrap_coupling()).- EngineError
If the field energy grows during propagation.
- pnps.simulate.simulate_delay_point(setup, tau, zsave, *, h_target, backend='auto')[source]#
Simulate one delay point and extract all observables.
Builds a bridge, runs
run_delay_point()and closes it. Building a bridge translates the problem and allocates the solprop backend, so a scan builds one and reuses it (pnps.scan.run_scan()).- Parameters:
- setupSetup
The configuration, as built by
build_setup().- taufloat
One delay in s.
- zsavenumpy.ndarray
Strictly increasing save positions in m; include 0.0 to record the input. Every positive position is an edge of the replayed schedule.
- h_targetfloat
Largest step in m. Choose it with
pnps.calibrate.- backendstr
The solprop backend registry name (
"auto", which is"native";"native";"numpy_ref").
- Returns:
- dict of numpy.ndarray
See
run_delay_point().
- Raises:
- DelayError
If
tauis not a scalar.- ConfigError
If light that wraps the time window could act at the delay (
pnps.absorber.wrap_coupling()), or the save positions are invalid.- EngineError
If the field energy grows during propagation.
- pnps.simulate.visit_nonlinear(bridge, tau, visitor)[source]#
Propagate one delay point and hand each plane on with its nonlinear part.
The nonlinear part is
N(z) = E(z) - exp(L z) E(0): the field minus the input carried by the configured linear operator alone (pnps.bridge.bridge_tables()withpnps.reference.apply_linear(), the operator solprop applies, equal to its march to about 1e-12 of the peak;tests/test_ladder.py, rung (i)). It is everything the nonlinear polarisation has generated: the four-wave-mixing signal and the Kerr changes of the arms. Linear propagation in the homogeneous slab keeps each component’s transverse wavevector, so wherever the input is exactly zero in momentum, such as a signal window behind compact input holes,Nis the field itself.The planes are streamed (
pnps.bridge.Bridge.visit()): the input and one plane with its nonlinear part are held at a time, three field volumes.- Parameters:
- bridgeBridge
The configuration on solprop, with
reduction="host".- taufloat
The delay in s.
- visitorcallable
Called at every save position with the position in m, the field and its nonlinear part, each
(n, n, nt); both arrays are reused after the call.
- Raises:
- ConfigError
If light that wraps the time window could act at the delay (
pnps.absorber.wrap_coupling()).- DelayError
If
tauis not a scalar.- EngineError
If the bridge reduces with solprop’s statistics.