Skip to content

Results

Results is the return value of Mission.run. It exposes three keyed views over GMAT's output files — reports, ephemerides, and contacts — each typed as Mapping[str, pandas.DataFrame] and keyed by the resource name as declared in the .script.

Parsing is lazy: a ReportFile listed in Results.reports is read from disk and converted to a DataFrame only on first access, then cached for the life of the instance.

When Mission.run was called without a working_dir, the artefacts live under a tempfile.TemporaryDirectory that is cleaned up when the Results is garbage-collected. Call Results.persist to copy the artefacts to a permanent location before the temp dir disappears.

Results

Results(
    *,
    output_dir: Path,
    log: str,
    report_paths: Mapping[str, Path] | None = None,
    ephemeris_paths: Mapping[str, Path] | None = None,
    contact_paths: Mapping[str, Path] | None = None,
)

Aggregate of every output file GMAT wrote during a single run.

Construct one per call to :meth:Mission.run. Each path mapping is keyed by the resource name declared in the .script ("ReportFile1", "EphemerisFile1", "ContactLocator1", …). Path mappings are defensively copied and re-exposed as read-only views, so callers cannot mutate the run record after the fact.

Parameters:

Name Type Description Default
output_dir Path

The working directory GMAT used for this run. Surfaced so callers can locate any output file gmat-run did not aggregate itself.

required
log str

GMAT's stdout and stderr captured during the run, joined into a single string.

required
report_paths Mapping[str, Path] | None

{name: path} for every ReportFile resource. Defaults to empty.

None
ephemeris_paths Mapping[str, Path] | None

{name: path} for every EphemerisFile resource. Defaults to empty.

None
contact_paths Mapping[str, Path] | None

{name: path} for every ContactLocator resource. Defaults to empty.

None

persist

persist(path: str | PathLike[str]) -> Results

Copy every output artefact under :attr:output_dir into path.

Mutates the :class:Results in place so future report/ephemeris/contact access reads from the persisted location instead of the (potentially soon-to-be-cleaned) workspace. The :class:tempfile.TemporaryDirectory backing a default-workspace run is released as part of the call. Run with an explicit working_dir: that directory is left intact — persist is a copy, never a move.

Path mappings are rewritten so any path that lived under the old output_dir now points at the matching file under path. Absolute filenames the user pinned outside the workspace via ReportFile.Filename = "/abs/elsewhere.txt" are kept as-is — the user chose that destination and we honour it. Already-parsed DataFrames stay cached; they are independent of the on-disk files.

Calling persist again later moves the artefacts to the new destination. A no-op fast path applies when the destination already equals the current output_dir.

Parameters:

Name Type Description Default
path str | PathLike[str]

Directory to copy artefacts into. Created if missing.

required

Returns:

Type Description
Results

self, so the call composes with Mission.run().persist(...).