Skip to content

Correct API implementations for all phases#152

Merged
mmaclay merged 14 commits into122-refactor-correction-package-epicfrom
151-api-correction-package-standardized-io-push-button-verifyrun_correction-and-consistent-naming
Apr 10, 2026
Merged

Correct API implementations for all phases#152
mmaclay merged 14 commits into122-refactor-correction-package-epicfrom
151-api-correction-package-standardized-io-push-button-verifyrun_correction-and-consistent-naming

Conversation

@mmaclay
Copy link
Copy Markdown
Collaborator

@mmaclay mmaclay commented Apr 8, 2026

This pull request introduces several improvements and refactors to the curryer.correction package, focusing on configuration, error statistics processing, and package exports. The changes modernize configuration handling (notably removing the need for a user-supplied Earth radius), clarify the API for error statistics and correction inputs, and enhance maintainability by deprecating legacy mechanisms. The most important changes are grouped below.

Configuration and API Improvements

  • Removed the need to specify earth_radius_m in CorrectionConfig; the WGS84 Earth radius from curryer.compute.constants is now used as the single source of truth. The field is deprecated and ignored if present in config files. [1] [2] [3] [4] [5]
  • Added a new RequirementsConfig class for specifying verification thresholds, which can be attached to CorrectionConfig or passed directly to verification routines. [1] [2] [3] [4]
  • Introduced CorrectionInput, a typed structure for correction loop inputs, replacing positional tuples with named fields for clarity and IDE support. [1] [2]
  • Added explicit support for direct calibration file paths (psf_file, los_vectors_file) in CorrectionConfig as an alternative to directory+filename patterns.
  • Deprecated the image_matching_func public property in favor of a private attribute _image_matching_override for test injection, with deprecation warnings.

Error Statistics Refactoring

  • Centralized the Earth radius constant in error statistics processing, removing it from configuration and using the value from curryer.compute.constants throughout. [1] [2]
  • Added compute_percent_below, a utility function for computing the percentage of errors below a custom threshold, and clarified that pass/fail logic is now the caller's responsibility. [1] [2] [3] [4]
  • Refactored ErrorStatsConfig and ErrorStatsProcessor to no longer require performance thresholds or Earth radius, and improved documentation to clarify their mission-agnostic role. [1] [2]

Package Structure and Exports

  • Updated __init__.py to re-export new and refactored classes/functions, including CorrectionInput, RequirementsConfig, compute_percent_below, calibration result types, and new pipeline entry points. [1] [2] [3] [4] [5]

Data Configuration

  • Added position_columns to DataConfig for explicit telemetry spacecraft-position column mappings, improving flexibility for different data sources.

These changes collectively modernize the configuration and error statistics APIs, clarify the separation of concerns between statistics and verification, and improve usability for downstream users and developers.
[Copilot is generating a summary...]

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes curryer.correction APIs around configuration, verification/error-statistics, and pipeline outputs by centralizing constants, introducing typed inputs/results, and adding unified path resolution (including S3 URIs).

Changes:

  • Refactors error-stats to use WGS84 constants internally and splits “per-measurement nadir-equivalent” computation from aggregate statistics; adds compute_percent_below.
  • Introduces structured models (CorrectionInput, CorrectionResult/ParameterSetResult, RequirementsConfig) and updates verification provenance fields + new verification input signatures (file-path modes stubbed as NotImplementedError).
  • Adds unified resolve_path() (local + S3) and updates pipeline/image loaders to use it; adds support for direct calibration file paths.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/test_correction/test_verification.py Updates verification tests for new override/provenance; adds tests for new NotImplemented input modes and pairing-summary logger (currently contains a broken import).
tests/test_correction/test_results.py New test suite for structured correction/verification results and formatting utilities.
tests/test_correction/test_pipeline.py Updates image matching override usage; adds coverage for position_columns extraction helper.
tests/test_correction/test_parameters.py Removes earth_radius_m from config construction in tests.
tests/test_correction/test_kernel_ops.py Adds coverage for direct calibration file-path behavior and missing-file errors.
tests/test_correction/test_io.py New tests for resolve_path() and S3 temp download/cleanup behavior.
tests/test_correction/test_geolocation_error_stats.py Removes legacy large error-stats test module (replacement appears incomplete/missing).
tests/test_correction/test_config.py Updates config tests for deprecations, CorrectionInput, and JSON-loading behavior w/ deprecated earth_radius_m.
tests/test_correction/clarreo/test_clarreo_config.py Updates CLARREO config tests to stop expecting earth_radius_m.
tests/test_correction/clarreo/clarreo_data_loaders.py Clarifies docstring around preprocessing scripts and deprecations.
tests/test_correction/clarreo/clarreo_config.py Updates docs/code to use _image_matching_override; removes earth_radius_m from generated config.
tests/test_correction/clarreo/_pipeline_helpers.py Updates helpers to use _image_matching_override; removes earth_radius_m usage.
scripts/example_verification_minimal.py Updates example to use _image_matching_override and removes earth_radius_m.
curryer/correction/verification.py Adds provenance fields, pairing-summary logger, file-path-based verify signature (stubbed), and compare_results().
curryer/correction/results.py Adds structured CorrectionResult/ParameterSetResult and summary-table builder + factory.
curryer/correction/pipeline.py Adds run_correction() API, position_columns extraction, calibration direct-path support, S3-aware file loading, and revised per-pair error computation.
curryer/correction/io.py New unified path resolver with S3 download-to-temp support + atexit cleanup.
curryer/correction/image_io.py Updates MAT loaders to accept `str
curryer/correction/error_stats.py Centralizes Earth radius, adds compute_percent_below(), adds “nadir-only” compute method, and makes stats mission-agnostic (no pass/fail).
curryer/correction/config.py Removes earth_radius_m usage, adds RequirementsConfig, deprecates image_matching_func in favor of _image_matching_override, adds position_columns, adds CorrectionInput.
curryer/correction/init.py Re-exports new APIs and utilities (also exports an underscore-prefixed helper).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mmaclay mmaclay force-pushed the 122-refactor-correction-package-epic branch from 0a09d1c to d6bb926 Compare April 9, 2026 17:15
@mmaclay mmaclay force-pushed the 151-api-correction-package-standardized-io-push-button-verifyrun_correction-and-consistent-naming branch from 6638b56 to ae447ac Compare April 9, 2026 20:37
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 92.96482% with 70 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.93%. Comparing base (d6bb926) to head (60e39e4).
⚠️ Report is 1 commits behind head on 122-refactor-correction-package-epic.

Files with missing lines Patch % Lines
curryer/correction/pipeline.py 52.63% 34 Missing and 2 partials ⚠️
tests/test_correction/test_error_stats.py 81.05% 18 Missing ⚠️
curryer/correction/io.py 83.33% 9 Missing ⚠️
tests/test_correction/test_io.py 96.77% 1 Missing and 2 partials ⚠️
curryer/correction/results.py 99.06% 0 Missing and 1 partial ⚠️
tests/test_correction/clarreo/_pipeline_helpers.py 0.00% 1 Missing ⚠️
tests/test_correction/test_config.py 98.83% 1 Missing ⚠️
tests/test_correction/test_pipeline.py 97.77% 1 Missing ⚠️

❌ Your project status has failed because the head coverage (86.87%) is below the target coverage (95.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@                           Coverage Diff                            @@
##           122-refactor-correction-package-epic     #152      +/-   ##
========================================================================
+ Coverage                                 76.52%   77.93%   +1.40%     
========================================================================
  Files                                        90       94       +4     
  Lines                                     12303    13145     +842     
  Branches                                   1331     1370      +39     
========================================================================
+ Hits                                       9415    10244     +829     
- Misses                                     2388     2398      +10     
- Partials                                    500      503       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mmaclay and others added 3 commits April 10, 2026 13:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… _log_pairing_summary from package exports

Agent-Logs-Url: https://github.com/lasp/curryer/sessions/928b19d7-06dc-4719-b7a7-938ba4030f6d

Co-authored-by: mmaclay <21048535+mmaclay@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mmaclay mmaclay marked this pull request as ready for review April 10, 2026 20:56
@mmaclay mmaclay merged commit 771c7ca into 122-refactor-correction-package-epic Apr 10, 2026
9 of 13 checks passed
@mmaclay mmaclay deleted the 151-api-correction-package-standardized-io-push-button-verifyrun_correction-and-consistent-naming branch April 10, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants