Examples#

Choose an example by the question you want to explore. The introductory tutorials explain a complete calculation step by step; the focused examples explore data preparation, retrieval choices, instrument effects, and analysis. Use the user guide for the underlying methods and assumptions.

The Python scripts and example datasets are supplied in the repository. Follow installation from a clone, then run the commands below from the repository root. Download links provide the source for inspection; some scripts also need the neighbouring helper or data files from the checkout.

Getting started#

Your first retrieval

Generate a synthetic SHG-FROG trace, retrieve the pulse, and interpret the plots.

Your first retrieval
Dispersive retrieval

Explore the effect of propagation through a nonlinear medium.

Dispersive retrieval
Experimental workflow

Load, clean, retrieve, plot, and save using a synthetic measurement file.

The experimental workflow

Retrieval across shapes and interactions explores pulse shapes, interactions, noise, and dispersion. A standalone workflow provides a runnable load-to-save script corresponding to the introductory tutorial.

uv run python examples/example_retrieval.py
uv run python examples/example_workflow.py

Preparing data#

  • Fringe removal: worked fringe removal applies delay-domain filtering to a synthetic DUV trace and plots the result.

  • Baseline removal: worked baseline removal combines fringe removal with an asymmetric baseline estimate.

Both use synthetic_duv_trace.py to generate their input. See preparing and checking data for the physical meaning of the corrections and the checks to make afterwards.

uv run python examples/example_defringe.py
uv run python examples/example_arpls_baseline.py

Comparing retrieval approaches#

The algorithm comparison explores convergence using several solvers. Read it alongside retrieval and numerical methods: solver comparisons depend on the model, objective, initialisation, and stopping criteria as well as the optimisation method.

Instrument effects and validation#

Example

What it explores

Background

Geometric smearing

Arrival-time differences in a crossed-beam geometry and their effect on retrieval

Geometric smearing

Substrate thickness

Retrievals from reduced 3D instrument simulations at several substrate thicknesses

The forward model

Simulated RDW pulse

A structured pulse from a simulated resonant-dispersive-wave source

Loading simulated traces

The two simulation scripts use datasets in examples/data/; their dataset descriptions explain the stored quantities. Both use simulated, noise-free scans and simpler settings than the papers’ validation.

uv run python examples/example_geometric_smearing.py
uv run python examples/example_paper_thickness.py
uv run python examples/example_paper_rdw.py

See modelling the measurement for model selection and interpreting results for comparisons with known fields.

Analysing and transforming pulses#

The dispersion tuning example shows how to explore compression and calculate peak power. Read propagation and dispersion tuning before applying these operations to a retrieved field at a particular reference plane.

Thickness uncertainty#

Thickness uncertainty propagates a measured substrate-thickness uncertainty to the retrieved duration and compares it with a statistical estimate. The example generates its own data. The uncertainty chapter explains how to choose and interpret the estimators.

uv run python examples/example_thickness_uncertainty.py