Solution (source code)

= Solution

<Frequency-resolved optical gating> characterizes an ultrashort pulse using a nonlinear gate and a measured two-dimensional <spectrogram>. In <second-harmonic frequency-resolved optical gating>, split the pulse into two replicas, vary their relative delay, overlap them noncollinearly in a thin second-harmonic crystal, and spectrally resolve the cross-generated beam. Its propagation direction separates it from the individual beams' self-generated harmonics. For complex pulse envelope $E(t)$, the ideal trace is
$$
\boxed{I_{\rm FROG}(\Omega,\tau)\propto\left|\int E(t)E(t-\tau)e^{-i\Omega t}\,dt\right|^2,}
$$
where $\Omega$ denotes the output <frequency> offset in the envelope convention. An iterative <phase retrieval> algorithm seeks a pulse consistent with both this measured Fourier magnitude and the nonlinear product relation. The delay axis provides timing structure, while the resolved spectrum adds information missing from a plain intensity <autocorrelation>.<Characterization of arbitrary femtosecond pulses using frequency-resolved optical gating by Daniel J. Kane and Rick Trebino>[1993, nonlinear-gating spectrogram and pulse reconstruction]{ref}

The measured trace does not fix absolute optical phase or absolute time origin. SHG FROG also has a conjugate time-reversal ambiguity: $E(t)$ and $E^*(-t)$ produce the same trace. Extra information, such as a known dispersion change and a second measurement, can resolve that direction-of-time ambiguity. Finite phase-matching bandwidth, <group-velocity mismatch>, spatial chirp, <spectrometer> calibration, delay error, noise and instability over the scan must be controlled. A thin gate helps avoid temporal blurring, but trades against signal. FROG therefore reconstructs a pulse under an explicit instrument model rather than reading optical phase directly from a single intensity image.