pnps.observables#
What one save plane yields, and the slot layout of the fused reduction that fills it.
solprop propagates the field and hands back each saved plane (pnps.bridge);
this package reduces the plane on the host to the measured spectra and the
diagnostics, in one traversal of the state (pnps.reduce_numba). That traversal
fills an agreed set of accumulators – the slots below – and
assemble_observation() turns them into the Observation the driver
records. The collection windows must be holes in a single mask, so the mask-plane
radius is computed once per element and shared across them
(check_windows_share_a_mask()).
Everything here is in the state’s units: the unnormalised 3-D DFT of the field in V/m,
so the spectra scale as the fourth power of the transverse sample count at fixed
extent, and energy_prefactor converts summed eta |E|^2 to joules. Every sum is
weighted by the medium’s axial admittance eta (pnps.flux).
Functions
|
Turn one reduction's slots into the driver's observation. |
|
Require one physical mask, which the fused reduction assumes. |
|
Return the half-width of the momentum box the aliasing reading counts inside. |
|
Return the angle-to-position mapping |
|
Return the accumulators the fused reduction needs for |
Classes
|
Everything one save plane yields, as host values. |
- class pnps.observables.Observation(i_omega_win, i_omega_reimaged, i_omega_full, i_omega_beam, energy, absorb_omega, absorb_lap, absorb_k, gd_band_power, alias_fraction, edge_fraction)[source]#
Bases:
NamedTupleEverything one save plane yields, as host values.
- Attributes:
- i_omega_winnumpy.ndarray
Windowed spectra,
(n_windows, nt).- i_omega_reimagednumpy.ndarray
On-axis re-imaged spectra,
(n_windows, nt): the same-frequency pairingRe(A conj(G))of the on-axis amplitude with its magnetic closure.- i_omega_fullnumpy.ndarray
Un-windowed spectrum of the signal region (
pnps.geometry),(nt,).- i_omega_beamnumpy.ndarray
Spectrum of the whole beam, every column,
(nt,), in the units ofi_omega_full.- energyfloat
Pulse energy in J: the axial flux through the plane.
- absorb_omega, absorb_lap, absorb_kfloat
Instantaneous measured absorption rates of the three loss channels: the band edges’ spectral absorber, the group-delay lap budget and the transverse-wavevector ramp.
- gd_band_powerfloat
Fraction of the energy in the group-delay-absorbed bins.
- alias_fractionfloat
Fraction of the energy outside the inner momentum box, half of each axis’s largest wavenumber (
pnps.statistics.inner_box_region()): where a cubic product of the field can fold back into its own band.- edge_fractionfloat
Fraction of energy in the outer 5 % of the time window, or NaN when the diagnostic was not requested (
Config.edge_diagnostic).
- i_omega_win: Float[ndarray, 'n_windows n_omega']#
Alias for field number 0
- i_omega_reimaged: Float[ndarray, 'n_windows n_omega']#
Alias for field number 1
- i_omega_full: Float[ndarray, 'n_omega']#
Alias for field number 2
- i_omega_beam: Float[ndarray, 'n_omega']#
Alias for field number 3
- pnps.observables.assemble_observation(reduced, n_windows, cells, energy_prefactor, edge_fraction, *, gamma_omega, gamma_lap, gd_band)[source]#
Turn one reduction’s slots into the driver’s observation.
- Parameters:
- reducednumpy.ndarray
The reduced slots, shape
(n_slots(n_windows), nt).- n_windowsint
Collection windows the reduction covered.
- cellsint
Transverse samples
n * n, the divisor turning the signed sum into the on-axis mean.- energy_prefactorfloat
Converts summed
eta |E|^2to joules.- edge_fractionfloat
The time-window edge diagnostic, which needs a transform and so is computed by the caller (NaN when not requested).
- gamma_omega, gamma_lapnumpy.ndarray
The spectral absorber’s amplitude rate and the lap budget’s share of it,
(nt,), 1/m.- gd_bandnumpy.ndarray
The lap budget’s 0/1 indicator,
(nt,).
- Returns:
- Observation
The per-window traces, the full-plane spectrum and the scalar diagnostics of this reduction.
Require one physical mask, which the fused reduction assumes.
- Parameters:
- windowssequence of WindowSpec
The collection apertures, with resolved edge parameters.
- Raises:
- ReductionError
If the windows differ in anything but their diameter, or an edge parameter is unresolved.
- pnps.observables.inner_half_width(kx, fraction=0.5)[source]#
Return the half-width of the momentum box the aliasing reading counts inside.
A cubic product of a band
|k| <= Kreaches3Kand is stored at3K - 2 k_max, inside the band onceK >= k_max / 2(solprop’s Cartesian guide, “Reading the risk of aliasing”). So the box isfractionof the largest stored wavenumber, half a sample short, so that a column on the limit counts as outside and none sits on the box’s half-open edges.- Parameters:
- kxnumpy.ndarray
The stored momentum axis, shared by x and y, rad/m.
- fractionfloat, optional
The box’s share of the largest wavenumber: 1/2 for cubic products.
- Returns:
- float
The half-width, rad/m.
Examples
>>> import numpy as np >>> inner_half_width(2 * np.pi * np.fft.fftfreq(8, 1.0 / 8)) 9.42477796076938
- pnps.observables.mapping_factor(omega, zmask, achromatic_wavelength=None)[source]#
Return the angle-to-position mapping
zmask c / omega, zero off the band.Hoisted out of the transverse loops, where it is constant.
- Parameters:
- omeganumpy.ndarray
Absolute angular frequency, rad/s.
- zmaskfloat
Mask-plane distance from the focus, m.
- achromatic_wavelengthfloat or None, optional
Map every positive frequency as this wavelength, m (an achromatic window); None for the physical, frequency-dependent mapping.
- Returns:
- numpy.ndarray
The factor in m/(rad/m); zero at non-positive frequencies, where the mapping diverges.