pnps.beams#
Beamlet construction: HE11 far field cut by chromatic boxcar-mask holes.
The transverse-momentum plane of the simulation is the collimated
mask plane: a k-space sample (kx, ky) at frequency omega maps to the
mask-plane position x = kx * zmask * c / omega (the focusing geometry’s
angle-to-position mapping), so one physical hole is a different k-space
aperture at every frequency. This chromatic mapping is the entire vignetting
model, for the input holes here and for the collection windows in
pnps.extraction.
The input beam is the HE11 capillary mode imaged onto the focus; its far
field is the closed-form Hankel transform of the J0 core profile. Three
beamlets are cut at the corners (+d, +d) (gate 1), (+d, -d) (gate 2)
and (-d, +d) (test) of the boxcar, with d = spacing/2 + diam/2; the
four-wave-mixing signal emerges at (-d, -d). The two gates always share
one delay, so they are summed once here.
Module Attributes
Second radial moment of each antisymmetric edge profile, |
|
The illuminating beam: an HE11 capillary mode, a Gaussian focus, or the ideal-instrument control of uniform illumination. |
Functions
|
Compute the beamlet diagnostics from materialised arms. |
|
Materialise the three beamlet slots in the spectral state layout. |
|
Hole mask on the |
|
Closed-form far field of the HE11 (J0) mode profile. |
|
Energy normalisation of the separable illumination, without the 3-D array. |
|
Edge diameter whose weight encloses exactly the nominal hole area. |
|
Raised-cosine edge half-width, in mask-plane m, for |
|
Conventional tanh smoothing width: 3 mask-plane pixels at the carrier. |
|
Transverse factor of the unmasked input beam, |
Classes
|
Diagnostics of the input beamlets, recorded in every scan file. |
|
A Gaussian beam focused to a waist, cut by the same mask holes. |
|
HE11 capillary output collimated and refocused. |
|
Ideal-instrument control: uniform illumination of the mask plane. |
- pnps.beams.EDGE_SECOND_MOMENT: dict[str, float] = {'area': 0.0, 'hard': 0.0, 'rcos': 0.04735763271532445, 'tanh': 0.2056167583560283}#
Second radial moment of each antisymmetric edge profile,
Int_0^inf t phi(t) dt / w^2with t the distance past the nominal edge in units of the profile parameter w. A profile with phi(t) + phi(-t) = 1 enclosespi R^2 + 4 pi m2 w^2instead ofpi R^2(the outward ring is longer than the inward one), so this is exactly the correctionquadrature_holediam()removes."hard"and"area"have no transition and need no correction;"supergauss"is not antisymmetric and has no such expansion, so it cannot be used as a quadrature weight.
- pnps.beams.Beam = pnps.beams.HE11Beam | pnps.beams.GaussianBeam | pnps.beams.UniformBeam#
The illuminating beam: an HE11 capillary mode, a Gaussian focus, or the ideal-instrument control of uniform illumination.
- class pnps.beams.Beamlets(i_omega_beamlet, i_omega_beamlet_reimaged, delivered_energy)[source]#
Bases:
NamedTupleDiagnostics of the input beamlets, recorded in every scan file.
The beamlet fields are never stored: the input state is formed on the fly for each delay (
pnps.form_input.form_input()), so a setup holds only what the scan file records about them.pnps.form_input.beamlet_diagnostics()computes these in one pass without a field-sized buffer, andbeamlets_from_fields()computes the same numbers from materialised arms – the reference the fast pass is tested against.- Attributes:
- i_omega_beamletnumpy.ndarray
k-integrated power spectrum of one gate beamlet,
sum eta |E|^2 / n^2, shape(nt,)– the vignetted “pulse that is retrieved” (the mask and the launch factor are real, so its spectral phase is the input phase).- i_omega_beamlet_reimagednumpy.ndarray
On-axis power spectrum of the same beamlet: the focal-centre pixel of its 2-D inverse FFT paired with its magnetic closure,
Re(A conj(G))withA = sum (-1)^(iy+ix) E / n^2andGthe same sum ofconj(y) E, shape(nt,). This is the partner ofi_omega_reimagedinpnps.extraction, and it is not proportional toi_omega_beamlet: the focal spot area scales asomega^-2, so the two differ by a factoromega^2– nearly an order of magnitude across a DUV band. Compare a re-imaged trace against this one and a k-integrated trace againsti_omega_beamlet.- delivered_energyfloat
Three-arm post-hole pulse energy in J, see
pnps.io_h5.delivered_energy().
- i_omega_beamlet: Float[ndarray, 'n_omega']#
Alias for field number 0
- i_omega_beamlet_reimaged: Float[ndarray, 'n_omega']#
Alias for field number 1
- class pnps.beams.GaussianBeam(w0, f_foc)[source]#
Bases:
objectA Gaussian beam focused to a waist, cut by the same mask holes.
The illumination is the far field of a focal-plane Gaussian of 1/e^2 intensity radius
w0:exp(-r^2 / w0^2)in field, whose transverse spectrum isexp(-k^2 w0^2 / 4). LikeHE11Beamit is the same in momentum for every frequency (one focal spot), and the chromatic mask holes cut the three beamlets from it.It is not three mask-free Gaussian beams tilted by one achromatic wavevector: the instrument stays the physical one, a single beam behind a boxcar mask.
- Attributes:
- w0float
1/e^2 intensity radius of the focal spot in m.
- f_focfloat
Focusing focal length in m (sets the chromatic mask mapping).
- class pnps.beams.HE11Beam(a, f_coll, f_foc)[source]#
Bases:
objectHE11 capillary output collimated and refocused.
- Attributes:
- afloat
Capillary core radius in m.
- f_collfloat
Collimating focal length in m.
- f_focfloat
Focusing focal length in m.
- class pnps.beams.UniformBeam(f_foc)[source]#
Bases:
objectIdeal-instrument control: uniform illumination of the mask plane.
The far-field profile is frequency-independent and flat, so each arm’s delivered focal k-content is exactly the (apodised) hole disc itself — the ideal top-hat that idealised collection models assume. Tilt geometry, native phases and the chromatic hole mapping are unchanged. With this beam the “pre-mask energy” normalisation of
pnps.form_input.build_input_former()is box-limited rather than physical; control runs should rescale to a recorded delivered energy.- Attributes:
- f_focfloat
Focusing focal length in m (sets the chromatic mask mapping).
- pnps.beams.beamlets_from_fields(e_g1, e_g2, e_test, tgrid, sgrid, *, k2)[source]#
Compute the beamlet diagnostics from materialised arms.
The reference for
pnps.form_input.beamlet_diagnostics(). Every quantity is measured by the slab’s axial flux:|E|^2is weighted by the admittance’s real parteta, and the on-axis spectrum pairs the amplitude with its magnetic closure.- Parameters:
- e_g1, e_g2, e_testnumpy.ndarray
The arms from
build_beamlet_fields().- tgrid, sgridTimeGrid, SpaceGrid
The simulation grids.
- k2numpy.ndarray
The slab’s material wavenumber squared,
(nt,), complex.
- Returns:
- Beamlets
The power spectra of gate 1 and the three-arm delivered energy.
- pnps.beams.build_beamlet_fields(tgrid, sgrid, beam, e_omega, energy, mask_diam, mask_spacing, apod='area', apod_param=4.0, geometry='tg', *, k2)[source]#
Materialise the three beamlet slots in the spectral state layout.
This is the NumPy reference rendering of the input, used by the tests to check the on-the-fly former (
pnps.form_input), which is what a run uses. It allocates three field-sized arrays, so it is for small grids.The full (unmasked) HE11 beam is the separable product of the far-field profile, the 1-D pulse spectrum, and the phase ramps that centre the beam on the spatial grid; it is normalised to
energybefore masking, soenergyis the pre-mask energy of all the arms together (inherited convention – each beamlet carries whatever its hole passes). That energy is the beam’s axial flux in air, and the masked arms are carried into the slab at constant flux (pnps.flux.launch_factor()).- Parameters:
- tgrid, sgridTimeGrid, SpaceGrid
The simulation grids.
- beamHE11Beam, GaussianBeam or UniformBeam
Input beam geometry (UniformBeam gives the flat-illumination ideal-instrument control).
- e_omeganumpy.ndarray
1-D input pulse spectrum on
tgrid.omega(arbitrary scale).- energyfloat
Pre-mask pulse energy in J.
- mask_diam, mask_spacingfloat
Hole diameter and edge-to-edge spacing in m.
- apodstr
Input-hole apodisation, see
chromatic_mask().- apod_paramfloat
Apodisation parameter for the input holes.
- geometry{“tg”, “sd”}, optional
The beam layout (
pnps.geometry.input_layout()).- k2numpy.ndarray
The slab’s material wavenumber squared,
(nt,), complex, zero off the band (pnps.materials.silica_k2()).
- Returns:
- tuple of numpy.ndarray
(e_g1, e_g2, e_test), each(n, n, nt)complex, at zero delay: for TG gate 1 at(+d, +d), gate 2 at(+d, -d)and the test arm at(-d, +d); for SD the probe, zeros, and the gate.
- pnps.beams.chromatic_mask(ky, kx, omega, holex, holey, holediam, zmask, apod, apod_param)[source]#
Hole mask on the
(ky, kx, omega)grid.Each sample maps to the mask-plane position
x = kx * zmask * c / omega(likewise y); the mask is the hole transmission at that position. Non-positive frequencies get zero transmission (the mapping diverges there and those bins carry no physical field).A hole is a discontinuous function of position, so how its edge is rendered onto the k grid is a modelling choice with measurable consequences.
"hard"point-samples the discontinuity: by the sampling/periodisation duality that is exactly the wrapped focal field, and the Airy tails that wrap round the periodic grid show up as a percent-level ripple. The smooth profiles suppress the wrap by making the focal field decay before the grid edge, at the price of no longer being the nominal aperture."area"is the middle course: it is the exact hard aperture averaged over each pixel, so it is unbiased and parameter-free.- Parameters:
- ky, kx, omeganumpy.ndarray
Grid axes: transverse momenta in rad/m, absolute angular frequency in rad/s.
"area"additionally requires both momentum axes to be uniformly spaced (the pixel size is taken from the first two samples); every other profile accepts arbitrary sample positions.- holex, holeyfloat
Hole centre in the mask plane in m.
- holediamfloat
Hole diameter in m.
- zmaskfloat
Distance from the mask plane to the focus in m (the focal length of the focusing optic for input and collection masks alike).
- apodstr
Edge profile, with
rthe mask-plane radius andDthe hole diameter:"hard":r <= D/2;"supergauss":exp(-(2r/D)^p);"tanh":(1 - tanh((r - D/2)/w))/2;"rcos": raised cosine(1 - sin(pi t / 2))/2witht = clip((r - D/2)/w, -1, 1)— like"tanh"but of compact support, so the mask is exactly zero beyondD/2 + w;"planck": 1 insideD/2and falling to 0 atD/2 + wwith the C-infinity Planck taper (pnps.pulse.planck_taper()): an edge outside the nominal hole (a padding of1 + 2w/Don the diameter), so it is not a quadrature weight;"area": the fraction of each k pixel lying inside the hole, evaluated byp x psupersampling. Parameter-free and unbiased, butp^2times the arithmetic of the others — intended for the input holes, which are built once per setup, not for collection windows evaluated inside the propagation loop.
- apod_paramfloat
Supergaussian order
p; tanh, raised-cosine or Planck widthwin m; or, for"area", the supersampling factorp(a positive integer, 4 is ample). Seetanh_apod_default()andrcos_edge_default()for the conventional widths.
- Returns:
- numpy.ndarray
Real mask of shape
(len(ky), len(kx), len(omega))in [0, 1].
- Raises:
- InstrumentError
For an unknown
apod, or a non-integral"area"supersampling factor.
Examples
The raised cosine has compact support, unlike the tanh it replaces:
>>> import numpy as np >>> from scipy.constants import c >>> omega = np.array([2 * np.pi * c / 260e-9]) >>> k = np.array([0.0, 4e5]) >>> m = chromatic_mask(k, k, omega, 0.0, 0.0, 1e-3, 0.1, "rcos", 1e-5) >>> float(m[0, 0, 0]), float(m[1, 1, 0]) (1.0, 0.0)
- pnps.beams.he11_far_field(k_perp, a_scaled)[source]#
Closed-form far field of the HE11 (J0) mode profile.
The Hankel transform of
J0(u11 r / a)truncated atr = a:A(k) = -a^2 u11 J1(u11) J0(a k) / (a^2 k^2 - u11^2)The singularity of the denominator at
a k = u11is removable (J0(u11) = 0); the limita^2 J1(u11)^2 / 2is substituted where a grid sample lands on it.- Parameters:
- k_perpnumpy.ndarray
Transverse momentum magnitude in rad/m.
- a_scaledfloat
Effective core radius in m.
- Returns:
- numpy.ndarray
Real far-field amplitude (arbitrary scale), same shape as
k_perp.
- pnps.beams.illumination_scale(tgrid, sgrid, transverse, e_omega, energy)[source]#
Energy normalisation of the separable illumination, without the 3-D array.
build_beamlet_fields()gets the same number from the assembled 3-D array; this computes it from the two factors, so the on-the-fly input former, which never forms the array, can still normalise. The pre-mask beam is in air, so its energy is its axial flux in air,sum_omega |e|^2 sum_k cos(theta_air) |t|^2, one pass over the momentum plane per frequency the spectrum occupies.- Parameters:
- tgrid, sgridTimeGrid, SpaceGrid
The simulation grids.
- transversenumpy.ndarray
The
(n, n)factor fromtransverse_factor().- e_omeganumpy.ndarray
1-D input spectrum on
tgrid.omega(arbitrary scale).- energyfloat
Target pre-mask energy in J, all three arms together.
- Returns:
- float
The real factor normalising
transverse * e_omegatoenergy.
- pnps.beams.quadrature_holediam(holediam, apod, apod_param)[source]#
Edge diameter whose weight encloses exactly the nominal hole area.
An antisymmetric edge profile (
phi(t) + phi(-t) = 1) samples the aperture without bias in one dimension, but in two dimensions the ring just outside the nominal radius is longer than the ring just inside, so a profile of widthwenclosespi R^2 + 4 pi m2 w^2withm2fromEDGE_SECOND_MOMENT. Shrinking the edge radius tosqrt(R^2 - 4 m2 w^2)cancels that term exactly, leaving an error of order(w/R)^4.- Parameters:
- holediamfloat
Nominal hole diameter in m.
- apodstr
Edge profile; must be antisymmetric (not
"supergauss").- apod_paramfloat
Edge width in m (ignored for
"hard"and"area").
- Returns:
- float
Corrected diameter in m, to pass to
chromatic_mask().
- Raises:
- InstrumentError
If the profile has no antisymmetric expansion, or the correction would consume the whole aperture (edge far too wide for the hole).
Examples
>>> round(quadrature_holediam(1e-3, "hard", 0.0), 12) 0.001
- pnps.beams.rcos_edge_default(tgrid, sgrid, zmask, pixels=2.0)[source]#
Raised-cosine edge half-width, in mask-plane m, for
pixelsk pixels.Two pixels is the recommended collection-window setting: wide enough that the sampled profile is smooth (so the quadrature carries no Gauss-circle staircase) and narrow enough that the compact support clears the input arms across the whole simulation band.
- Parameters:
- tgrid, sgridTimeGrid, SpaceGrid
The simulation grids.
- zmaskfloat
Mask-plane distance from the focus in m.
- pixelsfloat
Edge half-width in k pixels at the carrier.
- Returns:
- float
Half-width in m.
- pnps.beams.tanh_apod_default(tgrid, sgrid, zmask)[source]#
Conventional tanh smoothing width: 3 mask-plane pixels at the carrier.
3 * delta_k * zmask * c / omega0, withomega0snapped to the nearest grid frequency (inherited convention).- Parameters:
- tgrid, sgridTimeGrid, SpaceGrid
The simulation grids.
- zmaskfloat
Mask-plane distance from the focus in m.
- Returns:
- float
Tanh edge width
win m, forchromatic_mask().
- pnps.beams.transverse_factor(sgrid, beam)[source]#
Transverse factor of the unmasked input beam,
(n, n)complex.The far-field profile of the illumination times the phase ramps that move the beam from the FFT corner (DC at index 0) to the centre of the real-space grid. The full illumination is this times the 1-D pulse spectrum times one energy normalisation — it is never intrinsically 3-D, which is what lets
pnps.form_inputform the input state on the fly instead of storing the masked beamlet fields.- Parameters:
- sgridSpaceGrid
The transverse grid.
- beamHE11Beam, GaussianBeam or UniformBeam
Input beam geometry.
- Returns:
- numpy.ndarray
Complex
(ky, kx)factor.