pnps.setup#

The run configuration and everything built from it once, before any delay point.

Config describes the instrument and the run; build_setup() turns it into a Setup: the grids, the beamlets and their chromatic masks, the formed-input machinery, the resolved collection windows and the absorber rates. A setup holds no engine state; pnps.bridge puts one on solprop, and pnps.simulate runs delay points through it.

Functions

build_setup(cfg)

Build grids, input tables, absorber and resolved windows.

rescale_delivered_energy(setup, energy)

Return the setup with its input rescaled to a stated delivered energy.

Classes

Config(lam0, tau_fwhm, energy, thickness, ...)

Complete description of one TG-FROG (or self-diffraction FROG) simulation.

Setup(cfg, tgrid, sgrid, windows, ...)

Everything precomputed once per configuration; nothing field-sized.

class pnps.setup.Config(lam0, tau_fwhm, energy, thickness, mask_diam, mask_spacing, beam, windows, lam_lims, trange, r_max, n_transverse, material='SiO2', geometry='tg', input_pulse=None, apod='area', apod_param=4.0, gdd=0.0, tod=0.0, raman=False, fftsize='smooth', gamma_max=5000000.0, transverse_absorber=True, transverse_fraction=0.1, time_headroom=4e-14, absorption=False, node_budget=1073741824, edge_diagnostic=False, transverse_monitor=True, stepper='rk4ip', reduction='auto', exact_windows=False)[source]#

Bases: object

Complete description of one TG-FROG (or self-diffraction FROG) simulation.

Attributes:
lam0float

Carrier wavelength in m.

tau_fwhmfloat

Intensity FWHM of the transform-limited input pulse in s. With input_pulse set it is nominal metadata only — the injected field defines the duration — and is recorded unchanged so a declared instrument keeps its identity.

energyfloat

Pre-mask pulse energy (all the arms together) in J: the beam’s axial flux in air before the mask.

thicknessfloat

Slab thickness in m.

mask_diam, mask_spacingfloat

Input-mask hole diameter and edge-to-edge spacing in m.

beamHE11Beam, GaussianBeam or UniformBeam

Input beam geometry (UniformBeam is the ideal-instrument control).

windowstuple of WindowSpec

Collection apertures (a series of hole diameters in the examples), centred where the layout’s signal appears (pnps.geometry.signal_centre()).

lam_limstuple of float

Wavelength limits of the simulation window in m.

trangefloat

Requested time-window extent in s. There is no temporal apodisation: walked-off light is carried exactly on the periodic window, and only frequencies that would wrap a full period back onto the pulse are absorbed (the lap budget, see pnps.absorber.spectral_absorber()). A larger window keeps more of the extreme-DUV spectrum.

r_maxfloat

Transverse containment radius in m.

n_transverseint

Transverse samples per axis (even).

materialstr

Only "SiO2" is supported.

geometry{“tg”, “sd”}

The beam layout (pnps.geometry): "tg" (the default) is the four-hole transient-grating boxcar, three inputs with the signal in the fourth corner; "sd" is self-diffraction, two holes on the x axis with the signal 2 k_E - k_G one slot further out on the probe’s side. It sets the input holes and the signal region i_omega_full sums; place the windows at pnps.geometry.signal_centre(). solprop’s statistics express both signal regions (the SD one as a half-plane of the mask, pnps.geometry.signal_half_plane()).

apodstr

Input-hole edge profile, see pnps.beams.chromatic_mask(). The default, "area", is the instrument’s exact hard aperture, each momentum pixel weighted by the fraction of it inside the hole (supersampled apod_param times per axis, only where the hole edge crosses the pixel).

apod_paramfloat

Input-hole edge parameter: the supersampling factor for "area" (default 4), the supergaussian order, or an edge width in m.

gdd, todfloat

Input chirp: group-delay dispersion (s^2), third-order dispersion (s^3). Must both be zero when input_pulse is set: the injected field carries its own phase.

input_pulseInputPulse or None

A stored complex spectrum to use as the source field instead of the synthetic Gaussian, prepared as described in pnps.input_pulse. The illumination profile and the chromatic input holes are real amplitude factors on one 1-D reference spectrum, so an arbitrary field composes exactly; everything downstream — vignetting, the recorded beamlet truth, the propagation — is unchanged.

ramanbool

Include the delayed Raman response of fused silica (off by default): the Hollenbeck and Cantrell shape of optmat’s silica nonlinear bundle, carrying the bundle’s fraction f_R of chi3 while the instantaneous Kerr response keeps 1 - f_R (pnps.materials.silica_raman_fraction()). Off, the whole Kerr index is instantaneous.

fftsizestr

Temporal sample-count rounding, "smooth" or "pow2".

gamma_maxfloat

Peak amplitude rate of the spectral edge absorber in 1/m.

transverse_absorberbool

Whether the transverse-wavevector safety ramp is on (solprop’s safety ramp, its SpatialAbsorber without a real-space collar; pnps.absorber.transverse_rate()). Its strength is solprop’s design, not a setting: content in the ramp’s upper half loses about 10.5 nepers over the grid’s half-width (pnps.absorber.transverse_strength()). It damps content that reaches the outer band of a grid too small for the mixing products, keeping it from folding back; on a grid sized by pnps.grids.optimal_spatial_grid() it does no measurable work.

transverse_fractionfloat

The ramp’s width as a fraction of the largest wavenumber, in (0, 1).

time_headroomfloat

Protected half-width around t = 0 holding the pulse and the delay scan, in s. Frequencies whose group-delay walk-off over the slab exceeds the lap budget (window length minus twice this) are absorbed (see pnps.absorber.spectral_absorber()). Delays within 75% of it are always admitted; a longer one is admitted when light that wraps the window cannot act at it (pnps.absorber.wrap_coupling()).

absorptionbool

Keep the material loss of optmat’s index, its imaginary part (off by default: the slab is lossless, with optmat’s real index unchanged). Silica absorbs strongly below about 160 nm (5e6 /m at 131 nm); with it on, certify the step on this model, since the interaction-picture march is pre-asymptotic in those bins until h << 1/alpha.

node_budgetint

solprop’s memory budget per transform chunk, in bytes (see solprop’s resource guide); larger chunks are faster and hold more memory.

edge_diagnosticbool

Compute the time-window edge fraction at every save position (one blocked inverse transform along omega per plane). Off by default, when edge_fraction is reported as NaN.

transverse_monitorbool

Watch the transverse grid’s edge in real space with solprop’s boundary monitor (pnps.bridge.BOUNDARY_CHECK): a launch or a field that puts more than 1e-6 of its energy in the outer 5 % of the grid warns, and more than 1e-4 stops the run, since that light would wrap round the periodic grid. On by default; off only for a grid known to be too small, such as the test suite’s.

stepper{‘dopri5’, ‘rk4ip’}

solprop’s march: 'dopri5' replays the fifth-order Runge-Kutta pair on the fixed schedule (fifteen field volumes, the most accurate per step); 'rk4ip' is solprop’s low-storage interaction-picture RK4, this package’s own stencil, in four field volumes.

reduction{‘auto’, ‘host’, ‘solprop’}

Where each save plane is reduced to the observables: 'host' copies the field out of solprop and reduces it here (pnps.reduce_numba); 'solprop' keeps no field and reads solprop’s far-field statistics (pnps.statistics), which every in-tree solprop backend forms (numpy_ref and native), and needs windows solprop can express. The two agree to rounding and cost the same on a CPU; the solprop path saves the field copy, a field volume per plane, which is the expensive part on a device. 'auto' (the default) takes 'solprop' whenever solprop accepts the windows without a warning (pnps.statistics.statistics_unavailable()) and 'host' otherwise.

exact_windowsbool

Collect the windowed spectra (i_omega_win, i_omega_reimaged) through each window’s exact hard disc instead of its rendering on the momentum grid, which misses the hard disc by up to a few 1e-3 of the trace’s peak for windows spanning a few bins (docs/windows.md). The exact disc applies to the nonlinear part of each plane, the field less the input carried by the linear flow, whose support is compact. With the solprop reduction (what 'auto' resolves to) solprop forms both on its backend (its exact aperture profile on the nonlinear field, SEP 53): no field leaves the device, and the masks are built there once. With 'host' this package does it (pnps.exact_windows.ExactWindows): it holds the input state for the subtraction and one mask per window and band frequency, n_windows * n_band * n^2 doubles. The window’s rendering (apod, weighting) then plays no part. Off by default.

lam0: float#
tau_fwhm: float#
energy: float#
thickness: float#
mask_diam: float#
mask_spacing: float#
beam: HE11Beam | GaussianBeam | UniformBeam#
windows: tuple[WindowSpec, ...]#
lam_lims: tuple[float, float]#
trange: float#
r_max: float#
n_transverse: int#
material: str = 'SiO2'#
geometry: Literal['tg', 'sd'] = 'tg'#
input_pulse: InputPulse | None = None#
apod: str = 'area'#
apod_param: float = 4.0#
gdd: float = 0.0#
tod: float = 0.0#
raman: bool = False#
fftsize: str = 'smooth'#
gamma_max: float = 5000000.0#
transverse_absorber: bool = True#
transverse_fraction: float = 0.1#
time_headroom: float = 4e-14#
absorption: bool = False#
node_budget: int = 1073741824#
edge_diagnostic: bool = False#
transverse_monitor: bool = True#
stepper: Literal['dopri5', 'rk4ip'] = 'rk4ip'#
reduction: Literal['auto', 'host', 'solprop'] = 'auto'#
exact_windows: bool = False#
class pnps.setup.Setup(cfg, tgrid, sgrid, windows, e_omega_input, former, beamlets, gamma_omega, gamma_lap, gd_band, chi3, n2, n2_extrapolated, raman_fraction, signal_region)[source]#

Bases: object

Everything precomputed once per configuration; nothing field-sized.

Built by build_setup(). The input state is formed on the fly for each delay (delayed_input()), so the setup holds only separable tables: it can be built at production grid sizes on any machine.

Attributes:
cfgConfig

The configuration.

tgrid, sgridTimeGrid, SpaceGrid

The simulation grids.

windowstuple of WindowSpec

Collection apertures with their edge parameters resolved.

e_omega_inputnumpy.ndarray

The band-limited 1-D input spectrum, (nt,).

formerInputFormer

The tables the input state is formed from.

beamletsBeamlets

The beamlet spectra and delivered energy recorded in scan files.

gamma_omeganumpy.ndarray

The spectral absorber’s amplitude rate, (nt,), 1/m.

gamma_lapnumpy.ndarray

The lap budget’s share of it, (nt,), 1/m (pnps.absorber.SpectralRates).

gd_bandnumpy.ndarray

Indicator of the bins the lap budget absorbs, (nt,).

chi3float

Fused-silica chi3 in m^2/V^2 (pnps.materials.chi3_sio2()), the total: a Raman run gives 1 - raman_fraction of it to the instantaneous response.

n2float

The total Kerr index behind it, m^2/W.

n2_extrapolatedbool

Whether n2 is the optmat fit evaluated outside its validated range.

raman_fractionfloat

The Raman fraction f_R of the delayed response, 0.0 when cfg.raman is off.

signal_regionSignalRegion

The momentum region i_omega_full sums (pnps.geometry.signal_region()).

cfg: Config#
tgrid: TimeGrid#
sgrid: SpaceGrid#
windows: tuple[WindowSpec, ...]#
e_omega_input: Complex[ndarray, 'n_omega']#
former: InputFormer#
beamlets: Beamlets#
gamma_omega: Float[ndarray, 'n_omega']#
gamma_lap: Float[ndarray, 'n_omega']#
gd_band: Float[ndarray, 'n_omega']#
chi3: float#
n2: float#
n2_extrapolated: bool#
raman_fraction: float#
signal_region: SignalRegion#
pnps.setup.build_setup(cfg)[source]#

Build grids, input tables, absorber and resolved windows.

Parameters:
cfgConfig

The configuration.

Returns:
Setup

The grids, input tables, absorber and resolved windows of cfg.

Raises:
ConfigError

For an unsupported material or layout, an empty window list, an injected input pulse combined with a configured chirp, or an input spectrum the window cannot carry.

pnps.setup.rescale_delivered_energy(setup, energy)[source]#

Return the setup with its input rescaled to a stated delivered energy.

Config.energy is the pre-mask energy; what the slab receives is what the holes pass, which depends on the beam model and the grid. A control run that must deliver the same post-hole energy as a reference (the ideal uniform-illumination instrument, say) rescales the input instead: the amplitude scale of the former and the recorded beamlet diagnostics change together, nothing else does.

Parameters:
setupSetup

The configuration.

energyfloat

Post-hole energy of all the arms to deliver, J, positive.

Returns:
Setup

A new setup delivering energy.

Raises:
ConfigError

If energy is not positive and finite.