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

reproject_exact failure with rotation? #256

Open
ebachelet opened this issue Oct 29, 2021 · 0 comments
Open

reproject_exact failure with rotation? #256

ebachelet opened this issue Oct 29, 2021 · 0 comments

Comments

@ebachelet
Copy link

ebachelet commented Oct 29, 2021

Hello

Following the reproject examples, I am trying to do the same using reproject_exact (i.e. drizzle). The resampling seems to work only for multiple of pi/2, it returns an array full of nan for other angles. Not sure what is wrong.

Here is a workable example:

import numpy as np
from astropy.wcs import WCS
import matplotlib.pyplot as plt
from reproject import reproject_interp, reproject_adaptive,reproject_exact
from astropy.io import fits
import copy

mydata = fits.open('mydata.fits')
data = mydata[0].data

angle = np.pi/6
shift = 38.8

input_wcs = WCS(mydata[0].header)

output_wcs = copy.deepcopy(input_wcs)
output_wcs.wcs.crpix += shift

roti = [[np.cos(angle),-np.sin(angle)],[np.sin(angle),np.cos(angle)]]
output_wcs.wcs.cd = np.dot(output_wcs.wcs.cd,roti)

result_drizzle, _ = reproject_exact((data.astype(float), input_wcs),output_wcs, shape_out=data.shape)

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

No branches or pull requests

1 participant