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

Bug in argument clip=True in sunkit_image.coalignment.apply_shift() #192

Open
yjzhu-solar opened this issue Mar 30, 2024 · 0 comments
Open

Comments

@yjzhu-solar
Copy link

Provide a general description of the issue or problem.

By default, we set clip=True in apply_shift(). However, in lines 357-363 of coalignment.py, it shifts the reference pixel using the x and y shifts that are just applied to the data array instead of the clipped part of the image. As a result, if the shifted data array is plotted with the new WCS, they cancel each other!!!

        if clip:
            shifted_data = _clip_edges(shifted_data, yclips, xclips)
            new_meta["naxis1"] = shifted_data.shape[1]
            new_meta["naxis2"] = shifted_data.shape[0]
            # Add one to go from zero-based to one-based indexing
            new_meta["crpix1"] = m.reference_pixel.x.value + 1 + xshift[i].value - xshift[0].value
            new_meta["crpix2"] = m.reference_pixel.y.value + 1 + yshift[i].value - yshift[0].value

Solution:
Either set clip=False and clip the Mapsequence later or use

new_meta["crpix1"] = m.reference_pixel.x.value + 1 - int(xclips[0].value)
new_meta["crpix2"] = m.reference_pixel.y.value + 1 - int(yclips[0].value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants