astropy / astropy/reproject

reproject_exact failure with rotation?

Open
#256 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
127
Forks
74
Avg merge
1d 11h
Merged PRs (30d)
2

Description

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)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the reproject_exact entry point and reproduce the provided example with angle = np.pi/6, comparing it with reproject_interp and reproject_adaptive. Investigate why the rotated output is entirely NaN while multiples of pi/2 work; done means the example produces valid output for non-right-angle rotations without regressing the working cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.