Skip to content

TST: New api 2#662

Draft
nden wants to merge 7 commits into
spacetelescope:mainfrom
nden:new-api-2
Draft

TST: New api 2#662
nden wants to merge 7 commits into
spacetelescope:mainfrom
nden:new-api-2

Conversation

@nden
Copy link
Copy Markdown
Collaborator

@nden nden commented Dec 15, 2025

JWST regression tests: https://github.com/spacetelescope/RegressionTests/actions/runs/20268196432
Roman regression tests: https://github.com/spacetelescope/RegressionTests/actions/runs/20270632739/job/58206279655
The failing Roman test matches the failure on main.

The romanisim failure is due to a mixup of units in romanisim and galsim. This PR enforces unit conversion and revealed the issue. Fix is in spacetelescope/romanisim#290

This is an alternative to #660. #660 ensures the return type is the same as the input type but does not allow using high level objects (HLO) with the legacy functions. This PR removes the restriction. A summary:

type of inputs #660 #662
numerical Return numbers Return numbers.
quantities Return quantities Return quantities
HLO. Raise an error Return HLO.

A typical example showing the difference between the two PRs is below. Note that HLO is by definition the type defined in wcs.world_axis_object_components.

from gwcs import examples
w=examples.gwcs_with_pipeline_celestial()
w.forward_transform.uses_quantity
Out[3]: True

sky=w.pixel_to_world(1,1)
print(sky) # HLO is defined as Quantities
[<Quantity 3620. arcsec>, <Quantity 61200. arcsec>]

With #660

w.invert(*sky)
TypeError: High Level objects are not supported with the native API.                        
Please use the `world_to_pixel` method.

With #662

w.invert(*sky)
(<Quantity 1. pix>, <Quantity 1. pix>)

Example 2:

w=examples.gwcs_spec_cel_time_4d()
w.forward_transform.uses_quantity
Out[16]: False

world=w.pixel_to_world(1,1,1,1)
print(world)
[<SpectralCoord 5.2 m>, <SkyCoord (ICRS): (ra, dec) in deg
    (5.62930741, -72.0499035)>, <Time object: scale='utc' format='isot' value=2010-01-01T00:00:01.000>]

With #660

w.invert(*sky)
TypeError: High Level objects are not supported with the native API.                        
Please use the `world_to_pixel` method.

With #662

w.invert(*world)
Out[19]: (<Quantity 1. pix>, <Quantity 1. pix>, <Quantity 1. pix>, <Quantity 1. pix>)

@nden nden requested a review from a team as a code owner December 15, 2025 23:44
@nden nden marked this pull request as draft December 15, 2025 23:44
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 89.77273% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.19%. Comparing base (07a7538) to head (26f031e).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
gwcs/wcs/_wcs.py 90.14% 7 Missing ⚠️
gwcs/coordinate_frames/_base.py 66.66% 1 Missing ⚠️
gwcs/utils.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #662   +/-   ##
=======================================
  Coverage   86.18%   86.19%           
=======================================
  Files          39       39           
  Lines        4111     4150   +39     
=======================================
+ Hits         3543     3577   +34     
- Misses        568      573    +5     

☔ 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.

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.

1 participant