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

Fixes for mosaic output pixels not covered by inputs #413

Merged
merged 2 commits into from
Dec 8, 2023

Conversation

svank
Copy link
Contributor

@svank svank commented Nov 20, 2023

I noticed that, when using reproject_and_coadd with background matching and with combine_function='first', a bounding box around some of the input images can be filled, so that outputs look like this:
image
instead of this:
image

This happens because output pixels not covered by a given input image are set to zero after that image is reprojected, and those zero values get adjusted by the background matching. For the other combine_function options, those out-of-bounds pixels never get used, so their final value doesn't matter, but that wasn't the case for combine_function='first', which this PR rectifies.

While adding a test that works through the options and ensures the final output mosaics are zero outside the returned footprint and filled-in inside the footprint, I noticed an inconsistency in that all the combine_functions produce zeros for pixels not spanned by any input image, except for combine_function='mean', which outputs nans for those unsampled pixels (generated when dividing by sum-of-weight values of zero). This PR also changes those nans to 0, to ensure mean is consistent with the other modes.

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f9bcc9e) 93.60% compared to head (31c4205) 93.60%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #413   +/-   ##
=======================================
  Coverage   93.60%   93.60%           
=======================================
  Files          25       25           
  Lines         891      892    +1     
=======================================
+ Hits          834      835    +1     
  Misses         57       57           

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

@astrofrog astrofrog merged commit 3d85b24 into astropy:main Dec 8, 2023
26 checks passed
@astrofrog astrofrog added the bug label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants