Repository navigation
Description
What is missing
SHG FROG cannot model the nonlinear crystal. The forward models refuse dispersive propagation for SHG (
Lines 150 to 159 in 73c72ba
| # The slab propagation phase β(ω) is built at the *fundamental* carrier, | |
| # but the SHG signal lives near 2ω0 — propagating it with β(ω) is | |
| # physically inconsistent. Dispersive propagation is only meaningful for | |
| # interactions whose signal stays at the fundamental (PG, SD). | |
| if material is not None and thickness and self.interaction.omega0_scale != 1.0: | |
| raise ValueError( | |
| f"dispersive propagation is not supported for the " | |
| f"{self.interaction.name.upper()} interaction (its signal is not at " | |
| f"the fundamental frequency); use a thin medium (material=None)" | |
| ) |
Lines 155 to 162 in 73c72ba
| # Same physical guard as ForwardModel: a slab built at the fundamental | |
| # cannot consistently propagate an SHG signal that lives near 2*omega0. | |
| if material is not None and thickness and inter.omega0_scale != 1.0: | |
| raise ValueError( | |
| f"dispersive propagation is not supported for the " | |
| f"{inter.name.upper()} interaction (its signal is not at the " | |
| f"fundamental frequency); use a thin medium (material=None)" | |
| ) |
Lines 161 to 173 in 73c72ba
| # Work internally in DFT-bin order. | |
| self.omega_bin = scipy.fft.ifftshift(self.omega) | |
| beta = materials.beta(material, self.omega, omega0) | |
| beta_bin = scipy.fft.ifftshift(beta) | |
| nodes, weights = quadrature_nodes_weights(self.thickness, npoints, quadrature) | |
| self.nodes = nodes | |
| self.weights = weights | |
| self.q = nodes.size | |
| # Propagation phase matrices, shape (N, Q), in DFT-bin order. | |
| self.input_prop = np.exp(1j * np.outer(beta_bin, nodes)) | |
| self.signal_prop = np.exp(1j * np.outer(beta_bin, self.thickness - nodes)) |
Lines 341 to 344 in 73c72ba
| raise ValueError( | |
| f"geometrical smearing is not supported for the {inter.name.upper()} " | |
| f"interaction; only PG (TG) and SD have the required three-arm form" | |
| ) |
Lines 180 to 186 in 73c72ba
| if smearing is not None: | |
| if self.interaction.name not in ("pg", "sd"): | |
| raise ValueError( | |
| f"geometrical smearing is not supported for the " | |
| f"{self.interaction.name.upper()} interaction; only PG (TG) and SD " | |
| f"have the required three-arm form" | |
| ) |
Why it matters
Few-cycle SHG FROG in a crystal of tens of µm is shaped by phase matching (a frequency- and pair-dependent sinc² response), by group-velocity mismatch and by delay smearing from the crossing angle (Baltuška et al., IEEE J. Quantum Electron. 35, 459 (1999), doi:10.1109/3.753651). Without them, retrievals of such traces are biased, and the only remedy is the optional marginal correction, which is approximate.
Approach (agreed with the maintainer)
- Separate β for the fundamental (o-ray; longitudinal wavevector
$\sqrt{k_o^2-(\omega\sin\alpha/c)^2}$ with the external crossing half-angle α) and the signal (e-ray at the internal angle θ). Becausematerials.betakeeps the carrier wavevector, the depth sum then carries the exact Δk = k_s(ω1+ω2) − k_z(ω1) − k_z(ω2). Generation prefactor ω_s/n_s; other spectral factors via the existingR_omega. - Type I (oo→e) only. The crystal is specified as manufacturer cut angle θ_c plus an external tilt γ, or "tilt tuned to phase-match at λ_pm"; path L/cos γ_int. Nothing is derived from the grid.
- The fundamental polarisation relative to the crossing plane decides whether the crossing plane is the principal plane; in that case a neglected first-order signal-tilt term is estimated and warned about.
- One
TwoBeamGeometry(beam separation, focal length, beam diameter) is the single source of the crossing angle for both Δk and the delay-smearing kernel (σ_δ for Gaussian beams). - Depth quadrature resolution chosen from max|Δk|L/2.
- BBO dispersion from Tamošauskas et al., Opt. Mater. Express 8, 1410 (2018), doi:10.1364/OME.8.001410, added to optmat first.
To do
- optmat: BBO o/e models from Tamošauskas 2018 (separate repository), then raise croak's optmat pin.
- Crystal numerics and both forward models (NumPy and JAX), with the marginal identity, an L→0 limit, a quadrature-convergence test and a brute-force (ω1, ω2) reference.
- Solver, uncertainty, session, scripting and GUI threading ("Nonlinear crystal" and "Beam geometry" groups); synthetic traces with a crystal.
- Two-beam SHG delay smearing.
- Refuse a crystal model on a marginal-corrected trace (double counting).
- Docs (forward model, interactions, new how-to, smearing) and changelog fragments.
- Follow-ups to open once the model lands: a crystal-aware marginal-check prediction; fitting thickness/tilt for SHG with a crystal; an exact (ω1, ω2) option if the in-plane approximation matters in practice.
Done when
A synthetic SHG trace of a 5 fs, 800 nm pulse in 10 µm and 100 µm BBO, with smearing, is retrieved correctly by the crystal-aware model and is visibly biased with the ideal model; the BBO Type I angle at 800 nm reproduces the paper's 29.2° cut; uv run poe check passes with coverage at 100 %.
Drafted with Claude Code.
Activity
chrisbrahms commentedon Nov 12, 2026
Progress note for the session/GUI part (PR 3b), from the crystal-core work on
feature/shg-crystal-core(not yet pushed):CrystalSetup.delayed_beamsets the sign, which cannot be read off a real crystal; flipping it mirrors the trace in delay.croak.crystals.check_tiltfrom the session pipeline before a retrieval with a principal-plane crystal (amplitude from the independent spectrum, delays from the measured axis). Nothing incroak/calls it yet.delayed_beamand keeps the better fit, reporting both errors.croak.crystals.depth_pointsto choosenpointsfor a crystal.Drafted with Claude Code.
chrisbrahms commentedon Nov 13, 2026
Follow-ups opened: #25 (crystal-aware marginal check), #26 (fitting the crystal's thickness and angle), #27 (residuals against a full-field simulation), #28 (time-zero reference of the principal-plane drift). Drafted with Claude Code.
chrisbrahms commentedon Nov 13, 2026
The crystal model in the forward models is up as #31 (also closes #28). Threading through the solvers, session and GUI with BBO from optmat, and two-beam SHG delay smearing, follow as stacked PRs once #31 is in and optmat with BBO (LupoLab/optmat#48) is released. Drafted with Claude Code.