[AstroPy] Rotate an image and create new FITS header with updated astrometry

Marcio Melendez marcio.melendez at gmail.com
Wed Nov 16 10:55:23 EST 2016


Hi Simon,
It looks like a very nice software, thanks for sharing. I started to play
around with it but  a simple read an image and then rotate, got me an error
(see below). I need to open a ticket for this issue in the MPDAF webpage,
however it seems very inconvenient as you need to create an account with
CRAL first.

  File "<stdin>", line 1, in <module>

  File
"/Users/<username>/anaconda/lib/python3.4/site-packages/mpdaf/obj/image.py",
line 1272, in rotate

    cutoff=cutoff)

  File
"/Users/<username>/anaconda/lib/python3.4/site-packages/mpdaf/obj/image.py",
line 1161, in _rotate

    self.wcs.set_cd(newcd)

  File
"/Users/<username>/anaconda/lib/python3.4/site-packages/mpdaf/obj/coords.py",
line 1303, in set_cd

    self.wcs.wcs.crota = image_angle_from_cd(cd, u.deg)

ValueError: object of too small depth for desired array



On Wed, Nov 16, 2016 at 9:13 AM, Simon Conseil <simon at sconseil.fr> wrote:

> Hi all,
>
> We have some code to rotate an image with a given angle:
>
> http://mpdaf.readthedocs.io/en/latest/image.html#image-
> geometrical-manipulation
>
> http://mpdaf.readthedocs.io/en/latest/api/mpdaf.obj.Image.
> html#mpdaf.obj.Image.rotate
>
> It uses scipy.ndimage.affine_transform, and should give the same result
> as reproject, which uses scipy.ndimage.map_coordinates (both rely on
> ndimage.geometric_transform). It would be interesting to compare !
>
> Cheers,
>
> Simon
>
>
>
> Le 16/11/2016 à 13:46, Brigitta Sipocz a écrit :
>
>
> Hi Marcio,
>
> While it doesn't do exactly what you ask for, you may want to check out
> the affiliated package reproject (http://reproject.readthedocs.
> io/en/stable/). It does flux conserving image reprojection:
>
> http://reproject.readthedocs.io/en/stable/
>
> Cheers,
>  Brigitta
>
> On 15 November 2016 at 14:26, Marcio Melendez <marcio.melendez at gmail.com>
> wrote:
>
>> Hi all,
>> Is there a similar function to IDL's  HROT in python, e.g., a function to
>> rotate an image and create a new FITS header with updated astrometry.
>>
>> Thanks!
>>
>> --
>> Marcio B. Melendez, Ph.D
>> JWST ISIM Optics Support Scientist
>> KBRwyle Science, Technology and Engineering Group
>> NASA Goddard Space Flight Center  Greenbelt, MD  20771
>> Bldg. 29 Rm. T29-10, phone: 301-286-8517
>>
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at scipy.org
>> https://mail.scipy.org/mailman/listinfo/astropy
>>
>>
>
>
>
>
> _______________________________________________
> AstroPy mailing listAstroPy at scipy.orghttps://mail.scipy.org/mailman/listinfo/astropy
>
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy
>
>


-- 
Marcio B. Melendez, Ph.D
JWST ISIM Optics Support Scientist
KBRwyle Science, Technology and Engineering Group
NASA Goddard Space Flight Center  Greenbelt, MD  20771
Bldg. 29 Rm. T29-10, phone: 301-286-8517
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20161116/9e4cce40/attachment.html>


More information about the AstroPy mailing list