Mission¶
Mission is the main entry point. Construct one via
Mission.load, which discovers a local GMAT install,
bootstraps gmatpy, and parses a .script into the live GMAT object graph.
Field access uses dotted-path keys against that graph
(mission["Sat.SMA"]); Mission.run executes the
mission sequence headlessly and returns a Results.
See Getting started → Quick start for the full load → override → run → plot flow.
Mission
¶
Mission(
*,
gmat: ModuleType,
install: GmatInstall,
script_path: Path,
)
A loaded GMAT .script with dotted-path field access.
Construct via :meth:load. Reads return Python-typed values; writes
coerce to the GMAT-expected type and reject the rest with
:class:~gmat_run.errors.GmatFieldError.
attitude_input_paths
property
¶
Resolved paths of every CCSDS-AEM file consumed by the loaded script.
Walks every Spacecraft resource on first access; selects those with
Attitude == "CCSDS-AEM"; reads AttitudeFileName and resolves
relative paths against :attr:script_path's parent directory (the
same convention GMAT itself uses, since LoadScript is invoked
with the script's full path). Absolute paths are kept as-is.
The returned mapping is keyed by Spacecraft resource name and is a read-only view. Discovery is cached for the life of the Mission.
Returns an empty mapping when no Spacecraft uses CCSDS-AEM, when the
gmat module does not expose a SPACECRAFT enum, or when the
registry walk raises (defensive: an obscure plugin failure should
not block the rest of the Mission's surface).
attitude_inputs
property
¶
Parsed CCSDS-AEM attitude files consumed by the loaded script.
Lazy: each entry is parsed on first __getitem__ via
:func:gmat_run.parsers.aem_ephemeris.parse, then cached. Iterating
the mapping or calling len is free — only access materialises a
DataFrame.
Keyed by Spacecraft resource name. Use :attr:attitude_input_paths
to recover the raw path without parsing.
gmat
property
¶
The bootstrapped gmatpy module.
Escape hatch for callers that need raw SWIG access. Not part of the
stable public surface — the documented contract is the dotted-path
__getitem__ / __setitem__ interface.
load
classmethod
¶
load(
path: str | PathLike[str],
*,
gmat_root: str | PathLike[str] | None = None,
) -> Mission
Load a GMAT .script and return a :class:Mission handle.
Discovers GMAT via :func:~gmat_run.install.locate_gmat (honouring
gmat_root / GMAT_ROOT), bootstraps gmatpy via
:func:~gmat_run.runtime.bootstrap, and parses the script via
gmat.LoadScript.
Raises:
| Type | Description |
|---|---|
GmatNotFoundError
|
No usable GMAT install was found. |
GmatLoadError
|
gmatpy could not be loaded, or
|
run
¶
run(
*, working_dir: str | PathLike[str] | None = None
) -> Results
Execute the loaded mission sequence and return a :class:Results.
Redirects every relative ReportFile, EphemerisFile, and
ContactLocator output and the GMAT log into working_dir (or an
isolated temp directory when None), runs gmat.RunScript(), and
builds a :class:Results populated with the resolved output paths and
the captured log.
Filename rewrite. A relative Filename on an output subscriber
is rewritten to an absolute path inside working_dir before the
run, so a stock script's outputs land in the per-run workspace
instead of the GMAT install's default output directory (the charter's
"no pollution of the user's cwd" rule). Absolute filenames in the
script are left alone — the user has a specific destination in mind
and the run honours it. The rewrite is the only mechanism GMAT
actually consults at write time; FileManager.OUTPUT_PATH is
cached per-subscriber at Initialize time and ignored thereafter.
After :meth:run returns, reading mission["RF.Filename"] yields
the resolved absolute path, which points at the file on disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
working_dir
|
str | PathLike[str] | None
|
Directory GMAT writes its outputs into. |
None
|
Raises:
| Type | Description |
|---|---|
GmatRunError
|
|