pnps.form_input#

Form the delayed input state on the fly, with no stored beamlets.

The input of one delay point is the gate pair plus the delay-phased test arm (or, in the self-diffraction layout, the probe plus the delay-phased gate; see pnps.geometry), each the separable illumination (a transverse far-field profile times the 1-D pulse spectrum, normalised once) cut by one chromatic hole and carried into the slab at constant axial flux (pnps.flux.launch_factor()). Nothing about it is intrinsically 3-D, so it is never stored: form_input() evaluates the hole transmissions per element and writes the superposed state straight into the output array, and beamlet_diagnostics() computes the beamlet spectra and the delivered energy a scan file records, in one pass and without a field-sized buffer.

The reference rendering, which materialises the three arms with NumPy, is pnps.beams.build_beamlet_fields() (with pnps.beams.beamlets_from_fields()); the two agree to rounding.

The result is handed to solprop verbatim: both codes store the unnormalised DFT in the same sign convention, and solprop’s Cartesian column index ix + n_x * iy is exactly the C-order flattening of this package’s [iy, ix] axes, so the state (n, n, nt) reshapes without a copy to solprop’s (n * n, 1, nt).

Module Attributes

ARMS

The three beamlets, in the order the former sums them: the two gates (which share the delay-free phase) and the test arm (which carries the delay).

Functions

beamlet_diagnostics(former, tgrid, sgrid)

Compute the beamlet spectra and the delivered energy in one pass.

build_input_former(tgrid, sgrid, beam, ...)

Build the tables of the input former.

form_arm(former, arm[, out])

Form one beamlet alone, at zero delay.

form_input(former, tau[, out, arms])

Form the input state of one delay point.

Classes

InputFormer(transverse, e_omega, scale, kx, ...)

The separable tables that define the input state; nothing field-sized.

pnps.form_input.ARMS = ('gate1', 'gate2', 'test')#

The three beamlets, in the order the former sums them: the two gates (which share the delay-free phase) and the test arm (which carries the delay). The self-diffraction layout puts its probe in the first slot and its gate in the last, and has no second gate.

class pnps.form_input.InputFormer(transverse, e_omega, scale, kx, omega, k2, factor, delta_k, holes, weights, mask_diam, apod_code, apod_param, sub)[source]#

Bases: object

The separable tables that define the input state; nothing field-sized.

Built once per configuration by build_input_former().

Attributes:
transversenumpy.ndarray

Transverse factor of the unmasked beam, (n, n) complex, indexed [iy, ix] (pnps.beams.transverse_factor()).

e_omeganumpy.ndarray

Band-limited 1-D input spectrum, (nt,) complex.

scalefloat

Real factor normalising transverse * e_omega to the pre-mask energy.

kxnumpy.ndarray

Momentum axis shared by x and y, rad/m.

omeganumpy.ndarray

Absolute angular frequency, FFT-ordered, rad/s.

k2numpy.ndarray

The slab’s material wavenumber squared (n omega / c)^2, (nt,), complex, rad^2/m^2, zero off the band.

factornumpy.ndarray

Angle-to-position mapping f_foc c / omega of the input holes, zero at non-positive frequencies.

delta_kfloat

Momentum pixel pitch, rad/m.

holesnumpy.ndarray

Hole centres (3, 2) in the mask plane, m, for gate 1, gate 2 and the test arm (pnps.geometry.input_layout()).

weightsnumpy.ndarray

Arm weights (3,), each 1.0 or 0.0; an arm of weight zero is not part of the layout.

mask_diamfloat

Hole diameter, m.

apod_codeint

Edge-profile code (pnps.kernels.APOD_CODES).

apod_paramfloat

Edge parameter.

subint

Supersampling factor of the "area" rendering (1 otherwise).

transverse: Complex[ndarray, 'n_y n_x']#
e_omega: Complex[ndarray, 'n_omega']#
scale: float#
kx: Float[ndarray, 'n_x']#
omega: Float[ndarray, 'n_omega']#
k2: Complex[ndarray, 'n_omega']#
factor: Float[ndarray, 'n_omega']#
delta_k: float#
holes: Float[ndarray, 'n_arms 2']#
weights: Float[ndarray, 'n_arms']#
mask_diam: float#
apod_code: int#
apod_param: float#
sub: int#
property shape: tuple[int, int, int][source]#

The state shape (n, n, nt).

Returns:
tuple of int

(n_y, n_x, n_omega).

pnps.form_input.beamlet_diagnostics(former, tgrid, sgrid)[source]#

Compute the beamlet spectra and the delivered energy in one pass.

Each is measured as the run’s observables are, by the slab’s axial flux.

Parameters:
formerInputFormer

The configuration’s input tables.

tgrid, sgridTimeGrid, SpaceGrid

The simulation grids.

Returns:
Beamlets

The gate-1 beamlet’s (the self-diffraction probe’s) k-integrated and on-axis spectra, and the delivered energy of all the arms.

pnps.form_input.build_input_former(tgrid, sgrid, beam, e_omega, energy, mask_diam, mask_spacing, apod, apod_param, geometry='tg', *, k2)[source]#

Build the tables of the input former.

Parameters:
tgrid, sgridTimeGrid, SpaceGrid

The simulation grids.

beamHE11Beam, GaussianBeam or UniformBeam

Input beam geometry.

e_omeganumpy.ndarray

Band-limited 1-D input spectrum on tgrid.omega (arbitrary scale).

energyfloat

Pre-mask pulse energy (all arms together), J.

mask_diam, mask_spacingfloat

Hole diameter and edge-to-edge spacing in m.

apodstr

Input-hole edge profile, see pnps.beams.chromatic_mask().

apod_paramfloat

Input-hole edge parameter.

geometry{“tg”, “sd”}, optional

The beam layout (pnps.geometry).

k2numpy.ndarray

The slab’s material wavenumber squared, (nt,), complex, zero off the band (pnps.materials.silica_k2()).

Returns:
InputFormer

The separable tables of the input state.

Raises:
InstrumentError

For an unknown edge profile.

ConfigError

For an unknown layout.

pnps.form_input.form_arm(former, arm, out=None)[source]#

Form one beamlet alone, at zero delay.

For diagnostics of the input (its focal spot, its edge, its coverage of the grid); a run forms the superposed input with form_input().

Parameters:
formerInputFormer

The configuration’s input tables.

arm{“gate1”, “gate2”, “test”}

Which beamlet (see ARMS).

outnumpy.ndarray or None

A C-contiguous complex128 (n, n, nt) array to write into, or None to allocate one.

Returns:
numpy.ndarray

The beamlet (n, n, nt), complex128, C-contiguous.

Raises:
InstrumentError

For an unknown arm, an arm the layout does not have, or an out of the wrong shape, type or layout.

pnps.form_input.form_input(former, tau, out=None, *, arms=None)[source]#

Form the input state of one delay point.

The test arm is advanced by tau (exp(+1j omega tau), the “gate” delay convention); the gate pair is delay-free. In the self-diffraction layout the gate is advanced and the probe is delay-free.

Parameters:
formerInputFormer

The configuration’s input tables.

taufloat

Delay in s.

outnumpy.ndarray or None

A C-contiguous complex128 (n, n, nt) array to write into, or None to allocate one.

armscollection of str or None, optional

Form only these beamlets (names from ARMS), each exactly as it is in the whole input, for a separation over the arms (pnps.separation); None forms every arm of the layout.

Returns:
numpy.ndarray

The state (n, n, nt), complex128, C-contiguous (out when given).

Raises:
InstrumentError

If out has the wrong shape, type or layout, or arms is empty or names an unknown arm or one the layout does not have.

Examples

>>> from pnps.form_input import ARMS
>>> sorted(ARMS)
['gate1', 'gate2', 'test']