Examples¶
End-to-end Jupyter notebooks that exercise the gmat-sweep API against a
local GMAT install. Each notebook is committed with cleared cell outputs
and re-executed in CI on every push, so the rendered docs always reflect
the current code.
You can run them locally after pip install gmat-sweep[examples] (the extra
pulls in matplotlib, distributed, and ray so the cluster-backend
notebooks run on a laptop too).
- Single-axis SMA scan — fifty runs across
np.linspace(7000, 8000, 50)ofSat.SMA, parallel-dispatched through the defaultLocalJoblibPool, overlaid on a single altitude-vs-time plot. - Two-axis epoch × time-of-flight grid — a
cartesian product over
Sat.Epochand a script-levelVariable TOF, reshaped into a 2D matrix and contoured by per-run miss distance. - Surviving a kill — launch a sweep as a
subprocess, send
SIGINTmid-run, walk through inspecting the partial manifest withgmat-sweep showand reloading the partial DataFrame from disk, then complete the sweep with a programmaticSweep.from_manifest(...).resume()call. - Monte Carlo dispersion — 1000-run Monte
Carlo around a nominal injection burn over a four-axis perturbation cube
(parking-orbit coast time and the three VNB delta-V components). Histogram
of arrival miss distances, 3-sigma covariance ellipse in the (X, Y) plane,
and a recipe demonstrating the determinism contract via
expand_monte_carlo_to_run_specs. - Latin hypercube vs Monte Carlo — 64-run Latin hypercube alongside a 64-run plain Monte Carlo against the same four-axis injection perturbation. Pair plot of the unit-cube samples to make the stratification visible, and a side-by-side miss-distance histogram for the variance-reduction case.
- Dask cluster recipe — 100-run
Sat.SMAgrid sweep dispatched through adistributed.LocalClusterwithDaskPool. Same client API, same dashboard, same submit/await flow as a realdask.distributedcluster. - Ray autoscaling recipe — 100-run Monte
Carlo against the notebook 04 fixture, dispatched through
RayPoolagainst a localray.init(). Same task model as a real autoscaling Ray cluster. - Sobol sensitivity — Saltelli/Sobol design
built by
sobol_sample, dispatched throughsweep(samples=...)against the notebook 04 fixture, then reduced to first/total-order indices viasobol_analyzewith bootstrap confidence intervals. - Archive bundle — pack a finished sweep
(script, manifest, per-run Parquet files) into a single
.zipviaSweep.archive(), inspect the bundle's layout, and re-aggregate the per-run DataFrame from the unzipped tree without re-running. - Extending a Monte Carlo — anchor a
100-run
monte_carlowithout=, append 200 more runs viamonte_carlo_extend(n=200), and assert that the original 100run_ids are preserved bit-for-bit in the 300-run aggregated frame. - Solver convergence — sweep a LEO→GEO
Hohmann transfer targeted by a
DifferentialCorrector, aggregate the per-run targeter iteration history into a(run_id, solver, iteration)frame withlazy_solver_runs, plot the residual trajectories, and show aMaximumIterations-capped run stayingstatus="ok"whilelazy_solver_convergencereports it unconverged. - Downstream-consumer pipeline — a
per-run postprocess hook that derives orbital-radius metrics GMAT never
wrote directly, aggregated with
lazy_extra_outputsbeside the GMATReportFile, a mid-sweep kill resumed against a separate scratch tree via a caller-suppliedoutput_dir, and a sensitivity variant that reuses the same hook.