pnps.extraction#

Reduction of the propagated state to the measured spectra.

The propagation state already lives in (ky, kx, omega), so extracting a spectrum needs no temporal FFT — only reductions over the transverse-momentum axes. Per collection window three observables are produced:

  • i_omega_win: the spectrum a spectrometer collecting all the windowed light would record, sum_k |W E|^2;

  • i_omega_reimaged: the on-axis re-imaged spectrum — the centre pixel of the 2-D inverse FFT of the windowed field, computed without any FFT via the exact identity (even grids) that the centre pixel equals the (-1)^(iy+ix)-weighted mean;

  • i_omega_full: the un-windowed spectrum of the signal region (pnps.geometry.signal_region(): in the TG boxcar the quadrant kx < 0, ky < 0, the second half of each FFT-ordered axis), so i_omega_win / i_omega_full is the exact per-frequency collection efficiency.

The collection windows use the same chromatic hole model as the input masks. A run evaluates them on the fly inside the fused host reduction (pnps.reduce_numba), so no window array is ever materialised; extract_observables() here is the plain NumPy statement of the same reductions, the reference that pass is tested against.

A window profile can enter in either of two ways, selected by WindowSpec.weighting. As an amplitude filter it models a hole whose transmission really is graded, and the collected energy carries the profile squared. As a quadrature weight, the default, the same profile is instead a rule for integrating over a genuinely hard hole, which is what the instrument actually has: one weight then serves both observables and reproduces the nominal aperture, at the cost of a small sampling ripple where the hole spans few k pixels. See WindowSpec.

Note the spectra inherit the unnormalised-FFT units of the state: at fixed physical grid extent they scale as the fourth power of the transverse sample count (i_omega_reimaged, a real-space sample, is grid-invariant).

Functions

extract_observables(e, ky, kx, omega, windows)

Reduce one saved state to the per-window spectra (the NumPy reference).

Classes

WindowSpec(holex, holey, holediam, zmask[, ...])

A physical collection aperture (hole in the output mask plane).

class pnps.extraction.WindowSpec(holex, holey, holediam, zmask, apod='rcos', apod_param=None, weighting='quadrature', achromatic_wavelength=None)[source]#

Bases: object

A physical collection aperture (hole in the output mask plane).

Attributes:
holex, holeyfloat

Hole centre in the mask plane in m: where the signal appears, pnps.geometry.signal_centre() (the TG signal corner is at (-d, -d)).

holediamfloat

Hole diameter in m.

zmaskfloat

Mask-plane distance from the focus in m.

apodstr

Edge profile, see pnps.beams.chromatic_mask(). The default, "rcos", is a raised cosine of compact support: the weight is exactly zero outside the hole, so no window tail reaches the input arms.

apod_paramfloat or None

Edge parameter; None selects the conventional width for the profile at setup time (three mask-plane pixels for "tanh", two for "rcos").

weightingstr

How the profile enters the observables.

  • "amplitude" treats the profile as a physical amplitude filter: the collected energy is sum |W E|^2 = sum W^2 |E|^2. Because W^2 is not antisymmetric about the hole edge it under-counts the aperture — for the smallest windows used here, by a quarter — while the re-imaged observable, linear in W, over-counts. The two observables therefore describe different effective apertures.

  • "quadrature" (default) treats the profile as a quadrature weight for the integral over a genuinely hard hole: sum w |E|^2 and |sum w E|^2. One weight serves both observables, the enclosed area is the nominal one to a part in ten thousand (see pnps.beams.quadrature_holediam()), and with a compact-support profile such as "rcos" the weight is exactly zero outside the hole, so no window tail can reach the input arms. The instrument’s holes are hard, so this is the physically faithful choice.

achromatic_wavelengthfloat or None

None (the default) for the physical hole, whose momentum-space footprint scales with frequency (chromatic vignetting). A wavelength in m freezes the footprint at that wavelength for every frequency: an achromatic window in momentum space, a diagnostic that separates the vignetting from the edge.

holex: float#
holey: float#
holediam: float#
zmask: float#
apod: str = 'rcos'#
apod_param: float | None = None#
weighting: Literal['amplitude', 'quadrature'] = 'quadrature'#
achromatic_wavelength: float | None = None#
pnps.extraction.extract_observables(e, ky, kx, omega, windows, region=None, *, admittance=None)[source]#

Reduce one saved state to the per-window spectra (the NumPy reference).

A run reduces its planes with the fused host pass of pnps.reduce_numba; this is the plain array expression of the same reductions, one window at a time, against which that pass is tested. It materialises one mask and one masked field per window, so it is for test grids.

Parameters:
enumpy.ndarray

Spectral state (n, n, nt).

ky, kx, omeganumpy.ndarray

Grid axes (FFT-ordered).

windowstuple of WindowSpec

Collection apertures with resolved (non-None) apod_param, sharing one apod and one weighting.

regionSignalRegion or None, optional

The momentum region i_omega_full sums; None for the TG quadrant kx, ky < 0.

admittancenumpy.ndarray or None, optional

The medium’s axial admittance at every element (pnps.flux): its real part weights |E|^2 and its conjugate forms the on-axis closure (the flux measure). None weights every element by 1 (the field measure).

Returns:
tuple of numpy.ndarray

(i_omega_win, i_omega_reimaged, i_omega_full) with shapes (n_windows, nt), (n_windows, nt) and (nt,).

Raises:
InstrumentError

If the windows do not share an edge profile and weighting, or if any apod_param is still unresolved.