# pnps **Simulated PNPS traces of a real instrument, from first principles.** pnps is a forward model of PNPS (parametrized nonlinear process spectrum) pulse measurements in bulk media: transient-grating and self-diffraction FROG. It takes the instrument as it is built, not an idealised thin nonlinear medium: - a beam is cut into beamlets by the chromatic holes of an input mask; - they cross in a thin fused-silica slab; - the full 3-D envelope propagation equation carries them through it; - the four-wave-mixing signal *emerges* in its own corner of momentum space; - chromatic collection windows reduce it to the spectra a spectrometer records. The phase matching, the walk-off, the geometric delay smearing and the vignetting of every aperture are part of the propagation, not corrections applied to it. The propagation is integrated by [solprop](https://github.com/LupoLab/solprop), on a CPU or a GPU. pnps defines the instrument, forms the delayed input and reduces every saved plane. It writes HDF5 scan files in the layout the [Croak](https://github.com/LupoLab/croak) retrieval package reads. The error is controlled on the measured trace itself, by Richardson calibration of a fixed step. The model is validated against an exact linear propagator and a semi-analytic first-Born computation of the signal ({doc}`accuracy`). ```python import numpy as np from pnps import Config, HE11Beam, WindowSpec, signal_centre from pnps.scan import run_scan x, y = signal_centre("tg", mask_diam=1e-3, mask_spacing=1e-3) cfg = Config( lam0=260e-9, tau_fwhm=1e-15, energy=0.1e-6, thickness=40e-6, mask_diam=1e-3, mask_spacing=1e-3, beam=HE11Beam(a=125e-6, f_coll=5.0, f_foc=0.1), windows=(WindowSpec(holex=x, holey=y, holediam=1e-3, zmask=0.1),), lam_lims=(143e-9, 600e-9), trange=250e-15, r_max=366e-6, n_transverse=192, ) taus = np.linspace(-20e-15, 20e-15, 41) path = run_scan( cfg, taus, "example", zsave=np.array([0.0, 20e-6, 40e-6]), h_target=0.5e-6 ) ``` ```{toctree} :caption: User guide :maxdepth: 2 installation trace-simulation input-pulses windows separation model accuracy engine clusters performance examples roadmap ``` ```{toctree} :caption: Reference :maxdepth: 1 api/index changelog dev/index ```