curryer.correction.results ========================== .. py:module:: curryer.correction.results .. autoapi-nested-parse:: Structured result models for the correction pipeline. Provides :class:`CorrectionResult` and :class:`ParameterSetResult`, returned by :func:`~curryer.correction.pipeline.run_correction`. Attributes ---------- .. autoapisummary:: curryer.correction.results.logger Classes ------- .. autoapisummary:: curryer.correction.results.ParameterSetResult curryer.correction.results.CorrectionResult Functions --------- .. autoapisummary:: curryer.correction.results.build_correction_result Module Contents --------------- .. py:data:: logger .. py:class:: ParameterSetResult(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Results for a single parameter set in a correction sweep. .. attribute:: index Zero-based index of this parameter set in the sweep. :type: int .. attribute:: parameter_values Parameter name → sampled value for this set. :type: dict[str, float] .. attribute:: mean_rms_m Mean RMS geolocation error across all GCP pairs (meters). :type: float .. attribute:: best_pair_rms_m RMS error of the best-performing GCP pair (meters). :type: float .. attribute:: worst_pair_rms_m RMS error of the worst-performing GCP pair (meters). :type: float .. py:attribute:: index :type: int .. py:attribute:: parameter_values :type: dict[str, float] .. py:attribute:: mean_rms_m :type: float .. py:attribute:: best_pair_rms_m :type: float .. py:attribute:: worst_pair_rms_m :type: float .. py:class:: CorrectionResult(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Structured result from :func:`~curryer.correction.pipeline.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 .. attribute:: best_parameter_set Parameter values that produced the lowest aggregate RMS. :type: dict[str, float] .. attribute:: best_rms_m Best aggregate RMS achieved across all parameter sets (meters). :type: float .. attribute:: best_index Index of the best parameter set (for cross-referencing with NetCDF output). :type: int .. attribute:: worst_rms_m Worst aggregate RMS across all parameter sets (meters). :type: float .. attribute:: mean_rms_m Mean of all aggregate RMS values (meters). :type: float .. attribute:: n_parameter_sets Number of parameter sets tested in the sweep. :type: int .. attribute:: n_gcp_pairs Number of GCP pairs used. :type: int .. attribute:: all_parameter_sets All tested parameter sets sorted by mean RMS (ascending). :type: list[ParameterSetResult] .. attribute:: met_threshold Whether the best parameter set met the mission performance requirements. :type: bool .. attribute:: recommendation Human-readable next-step guidance for the instrument engineer. :type: str .. attribute:: summary_table Human-readable ASCII table of the top results. :type: str .. attribute:: netcdf_path Path to the saved NetCDF output file. :type: Path or None .. attribute:: config_snapshot Key config values used, for reproducibility records. :type: dict .. attribute:: elapsed_time_s Total wall-clock processing time in seconds. :type: float .. attribute:: timestamp UTC time when the run completed. :type: datetime .. attribute:: results Raw per-iteration result dicts from :func:`~curryer.correction.pipeline.loop`. Excluded from JSON serialisation. :type: list .. attribute:: netcdf_data Raw NetCDF numpy arrays from :func:`~curryer.correction.pipeline.loop`. Excluded from JSON serialisation. :type: dict .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: best_parameter_set :type: dict[str, float] .. py:attribute:: best_rms_m :type: float .. py:attribute:: best_index :type: int .. py:attribute:: worst_rms_m :type: float .. py:attribute:: mean_rms_m :type: float .. py:attribute:: n_parameter_sets :type: int .. py:attribute:: n_gcp_pairs :type: int .. py:attribute:: all_parameter_sets :type: list[ParameterSetResult] .. py:attribute:: met_threshold :type: bool .. py:attribute:: recommendation :type: str .. py:attribute:: summary_table :type: str .. py:attribute:: netcdf_path :type: pathlib.Path | None :value: None .. py:attribute:: config_snapshot :type: dict :value: None .. py:attribute:: elapsed_time_s :type: float :value: 0.0 .. py:attribute:: timestamp :type: datetime.datetime :value: None .. py:attribute:: results :type: list :value: None .. py:attribute:: netcdf_data :type: dict :value: None .. py:function:: 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 :class:`CorrectionResult` from raw :func:`~curryer.correction.pipeline.loop` outputs. :param setup: The durable mission setup used for the run (requirements/thresholds). :type setup: GeolocationSetup :param sweep: The parameter-variation experiment (parameters, search strategy, seed). :type sweep: Sweep :param netcdf_config: Resolved NetCDF metadata config (for parameter variable names). :type netcdf_config: NetCDFConfig :param results: Per-iteration result dicts from :func:`~curryer.correction.pipeline.loop`. :type results: list :param netcdf_data: Raw NetCDF data dict from :func:`~curryer.correction.pipeline.loop`. :type netcdf_data: dict :param netcdf_path: Path to the saved NetCDF file, if any. :type netcdf_path: Path or None :param elapsed_time_s: Total wall-clock time of the run in seconds. :type elapsed_time_s: float :rtype: CorrectionResult