Conversation
First, we find the optimal reference using the wcs's find_optimal_celestial_wcs We pass the inputs_fits_list, optimized_wcs, and optimized shape to get the arrays and footprints using wcs's reproject_adaptive Then, we pass the arrays and footprints to get the cropped data using prepare_for_sum Which returns the largest interior rectangle found in the stacked images
jnation3406
reviewed
Feb 18, 2026
Contributor
jnation3406
left a comment
There was a problem hiding this comment.
A few questions and comments but in general looks good. I think we will want to add reprojection as an option to other operations as well, so its probably worth moving all the helper functions into there own utils file. We should make another story and check in with Rachel on what other operations she wants to have the option to reproject on.
| c0, c1 = cols[0], cols[-1] + 1 | ||
|
|
||
| # now shrink until the *edges* are fully valid | ||
| while True: |
Contributor
There was a problem hiding this comment.
This iterative approach seems like it'll be slow, but I can't immediately think of a more efficient way
…3.11. everything runs smoothly
… since they don't work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FEATURE: Stacking - reprojection
Background
Users could only do simple stacking. So when the input data was intended to track objects in our Solar System, the stacked output would be blurry. Now, with reprojection, the users can stack input data with moving objects and the output shows the movement of the object with the alignment being in the background.
Implementation
We obtain the
optimized_wcsandotpimized_shapeby using wcs'sfind_optimal_celestial_wcs.We then pass these two values to
reproject_images_to_referencealong with the list ofinput_fitsand we get anarrayand afootprint.These are then used to crop the data correctly. Because some values are
NaNand therefore return jagged edges, we must remove them and find the largest internal rectangle in the footprint.This is done through
prepare_for_sumwhich takes the arrays (images) and footprints. We find thecommon_b(oundary)boxby cropping the boundary box from the footprint.crop_bbox_from_footprinttakes the footprints and returns the coordinates of rows and columns with the largest internal rectangle in the footprint per each footprint.Then, we find where the boundary boxes intersect (
intersect_bboxes) and return those coordinates.Lastly, we crop the intersected boundary box.
Note: there is a library that would take care of the logic to find the largest internal rectangle, but it would mean adding another dependency @jnation3406 let me know what you think https://github.com/OpenStitching/lir
VISUALS
Screen.Recording.2026-02-17.at.2.30.02.PM.mov