Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for specifying output projection as APE 14 WCS with array_shape defined #345

Merged
merged 9 commits into from
Mar 6, 2023

Conversation

astrofrog
Copy link
Member

This also refactors output_projection tests to use a fixture.

Fixes #309

@codecov
Copy link

codecov bot commented Mar 3, 2023

Codecov Report

Merging #345 (d3477f2) into main (bdadcb7) will increase coverage by 0.05%.
The diff coverage is 93.33%.

@@            Coverage Diff             @@
##             main     #345      +/-   ##
==========================================
+ Coverage   92.39%   92.44%   +0.05%     
==========================================
  Files          24       24              
  Lines         802      821      +19     
==========================================
+ Hits          741      759      +18     
- Misses         61       62       +1     
Impacted Files Coverage Δ
reproject/adaptive/high_level.py 100.00% <ø> (ø)
reproject/interpolation/high_level.py 100.00% <ø> (ø)
reproject/spherical_intersect/high_level.py 100.00% <ø> (ø)
reproject/mosaicking/coadd.py 91.42% <80.00%> (-1.00%) ⬇️
reproject/utils.py 84.61% <95.65%> (+1.51%) ⬆️
reproject/mosaicking/wcs_helpers.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@astrofrog astrofrog requested a review from Cadair March 4, 2023 22:55
@@ -142,9 +142,11 @@ def parse_output_projection(output_projection, shape_in=None, shape_out=None, ou
"Need to specify shape since output header "
"does not contain complete shape information"
)
elif isinstance(output_projection, BaseHighLevelWCS):
elif isinstance(output_projection, (BaseLowLevelWCS, BaseHighLevelWCS)):
Copy link
Member

Choose a reason for hiding this comment

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

oh man this change is needed, been meaning to raise an issue for this for ages.

wcs_out = output_projection
if shape_out is None:
if getattr(wcs_out, "array_shape") is not None:
shape_out = wcs_out.array_shape
Copy link
Member

Choose a reason for hiding this comment

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

The issue is that not all HighLevelWCS classes also implement the low level API (notably the wrapper doesn't). So I think you might not be able to get to array_shape if the output_projection is an instance of wrapper. (You would have to go through low_level_wcs.

It might be worth standardising on low level?

Copy link
Member Author

Choose a reason for hiding this comment

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

We've been allowing high level WCS for a little while so I think we just have to support both (in fact we rely on the high level API internally). I've expanded the test suite and made sure things work for both now.

@astrofrog astrofrog force-pushed the output-projection-ape14-wcs branch from 69acba0 to c2b09db Compare March 6, 2023 11:31
@astrofrog astrofrog merged commit 2145448 into astropy:main Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make shape_out optional if input WCS has array_shape
2 participants