[AstroPy] Rotating a FITS image (or just its WCS)

Steve Crawford crawford@saao.ac...
Wed Jun 12 12:02:45 CDT 2013

Hi Eric,

For transforming 2D arrays,  there are some useful tools under scipy.ndimage.interpoloate:

There is a rotate task  as well as more complex transformations, but they would probably meet your needs for rotating the image.


----- Original Message -----
> From: "Eric L. N. Jensen" <ejensen1@swarthmore.edu>
> To: "astropy" <astropy@scipy.org>
> Sent: Wednesday, 12 June, 2013 6:47:50 PM
> Subject: [AstroPy] Rotating a FITS image (or just its WCS)
> Hi all,
> I'm creating some model disk images which are computationally
> intensive.  It occurs to me that, for one of my parameters, the
> position angle of the disk projected on the sky, there is no need to
> recompute an image each time, as the image at different PAs is just
> a rotated version of the same image at zero PA.
> So I'd like to be able to take an existing FITS image, with WCS info
> in the header, and either keep the WCS the same while rotating the
> image pixels, or simply modify the image WCS to indicate a rotated
> reference frame for the image, to be interpreted by CASA when it
> reads the image.
> My first approach was to simply add a rotation matrix to the FITS
> header, using the PC_i_j keywords that specify the image's rotation;
> ds9 viewed the image OK, but it appears that this is not supported
> by CASA.
> So, I'm wondering about rotating the image itself and leaving the WCS
> unchanged.  So, is there a straightforward way to rotate an image by
> an arbitrary angle?  (Ideally with handling things like padding the
> image so it remains rectangular.)
> Thanks in advance for your help with this,
> Eric
> _______________________________________________
> AstroPy mailing list
> AstroPy@scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
> !DSPAM:51b8a65431151747570720!

More information about the AstroPy mailing list