curryer.correction.results

Structured result models for the correction pipeline.

Provides CorrectionResult and ParameterSetResult, returned by run_correction().

Attributes

Classes

ParameterSetResult

Results for a single parameter set in a correction sweep.

CorrectionResult

Structured result from run_correction().

Functions

_fmt_rms(→ str)

Format an RMS value for display; returns 'N/A' for non-finite values.

_format_correction_summary_table(→ str)

Generate a human-readable correction sweep summary table.

build_correction_result(→ CorrectionResult)

Build a CorrectionResult from raw loop() outputs.

Module Contents

curryer.correction.results.logger
class curryer.correction.results.ParameterSetResult(/, **data: Any)

Bases: pydantic.BaseModel

Results for a single parameter set in a correction sweep.

index

Zero-based index of this parameter set in the sweep.

Type:

int

parameter_values

Parameter name → sampled value for this set.

Type:

dict[str, float]

mean_rms_m

Mean RMS geolocation error across all GCP pairs (meters).

Type:

float

best_pair_rms_m

RMS error of the best-performing GCP pair (meters).

Type:

float

worst_pair_rms_m

RMS error of the worst-performing GCP pair (meters).

Type:

float

index: int
parameter_values: dict[str, float]
mean_rms_m: float
best_pair_rms_m: float
worst_pair_rms_m: float
class curryer.correction.results.CorrectionResult(/, **data: Any)

Bases: pydantic.BaseModel

Structured result from run_correction().

Provides the instrument engineer with a clear answer: what is the best parameter set, does it meet requirements, and what should they do next.

Serialisation

Most fields are JSON-serialisable via model_dump() / model_dump_json(). The results and netcdf_data fields are excluded from serialisation by default because they contain non-JSON-serialisable types (xr.Dataset, numpy arrays). Access them directly on the object when raw data is needed:

result = run_correction(setup, sweep, inputs, work_dir)
result.best_parameter_set   # dict[str, float] — use this
result.results              # raw per-iteration dicts — advanced use only
result.netcdf_data          # raw numpy arrays — advanced use only
best_parameter_set

Parameter values that produced the lowest aggregate RMS.

Type:

dict[str, float]

best_rms_m

Best aggregate RMS achieved across all parameter sets (meters).

Type:

float

best_index

Index of the best parameter set (for cross-referencing with NetCDF output).

Type:

int

worst_rms_m

Worst aggregate RMS across all parameter sets (meters).

Type:

float

mean_rms_m

Mean of all aggregate RMS values (meters).

Type:

float

n_parameter_sets

Number of parameter sets tested in the sweep.

Type:

int

n_gcp_pairs

Number of GCP pairs used.

Type:

int

all_parameter_sets

All tested parameter sets sorted by mean RMS (ascending).

Type:

list[ParameterSetResult]

met_threshold

Whether the best parameter set met the mission performance requirements.

Type:

bool

recommendation

Human-readable next-step guidance for the instrument engineer.

Type:

str

summary_table

Human-readable ASCII table of the top results.

Type:

str

netcdf_path

Path to the saved NetCDF output file.

Type:

Path or None

config_snapshot

Key config values used, for reproducibility records.

Type:

dict

elapsed_time_s

Total wall-clock processing time in seconds.

Type:

float

timestamp

UTC time when the run completed.

Type:

datetime

results

Raw per-iteration result dicts from loop(). Excluded from JSON serialisation.

Type:

list

netcdf_data

Raw NetCDF numpy arrays from loop(). Excluded from JSON serialisation.

Type:

dict

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

best_parameter_set: dict[str, float]
best_rms_m: float
best_index: int
worst_rms_m: float
mean_rms_m: float
n_parameter_sets: int
n_gcp_pairs: int
all_parameter_sets: list[ParameterSetResult]
met_threshold: bool
recommendation: str
summary_table: str
netcdf_path: pathlib.Path | None = None
config_snapshot: dict = None
elapsed_time_s: float = 0.0
timestamp: datetime.datetime = None
results: list = None
netcdf_data: dict = None
curryer.correction.results._fmt_rms(value: float) str

Format an RMS value for display; returns 'N/A' for non-finite values.

curryer.correction.results._format_correction_summary_table(top_sets: list[ParameterSetResult], total_sets: int, n_gcp_pairs: int, met_threshold: bool) str

Generate a human-readable correction sweep summary table.

Uses the same box-drawing and ljust/rjust pattern as _format_summary_table().

Parameters:
  • top_sets (list[ParameterSetResult]) – Top-ranked parameter sets to display (typically all_parameter_sets[:10]).

  • total_sets (int) – Total number of parameter sets evaluated in the sweep.

  • n_gcp_pairs (int) – Number of GCP pairs used.

  • met_threshold (bool) – Whether any parameter set met performance requirements.

Returns:

Multi-line box-drawn ASCII table.

Return type:

str

curryer.correction.results.build_correction_result(setup: curryer.correction.config.GeolocationSetup, sweep: curryer.correction.config.Sweep, netcdf_config: curryer.correction.config.NetCDFConfig, results: list, netcdf_data: dict, netcdf_path: pathlib.Path | None, elapsed_time_s: float) CorrectionResult

Build a CorrectionResult from raw loop() outputs.

Parameters:
  • setup (GeolocationSetup) – The durable mission setup used for the run (requirements/thresholds).

  • sweep (Sweep) – The parameter-variation experiment (parameters, search strategy, seed).

  • netcdf_config (NetCDFConfig) – Resolved NetCDF metadata config (for parameter variable names).

  • results (list) – Per-iteration result dicts from loop().

  • netcdf_data (dict) – Raw NetCDF data dict from loop().

  • netcdf_path (Path or None) – Path to the saved NetCDF file, if any.

  • elapsed_time_s (float) – Total wall-clock time of the run in seconds.

Return type:

CorrectionResult