[AstroPy] [pywcs] Unit question

Nico Nell nico.nell at gmail.com
Tue Apr 5 03:33:56 EDT 2011


Ole:

This can be done easily with astLib (http://astlib.sourceforge.net/).
See function clipImageSectionWCS
(http://astlib.sourceforge.net/docs/astLib/astLib.astImages-module.html#clipImageSectionWCS).

Here is an example that I used to make clips from big GALEX fits files
(http://casa.colorado.edu/~nell/cgit/cgit.cgi/pyscripts/tree/plotting/galex-clips.py)

Hopefully this makes things easier for you!

~Nico

On Tue, Apr 5, 2011 at 1:16 AM, Ole Streicher <astropy at liska.ath.cx> wrote:
> Dear Michael,
>
> Am 04.04.2011 15:45, schrieb Michael Droettboom:
>> I'm having a little trouble following what you are trying to do.
>
> I am going to write a small program to cut out parts of an 2d/3d image
> based on WCS coordinates and/or wavelength.
>
> The easy part is now to convert these coordinates into pixel coords
> using pywcs and slicing the required part of the image.
>
> But the resulting image needs now a new WCS header since the origin may
> have been changed, and I am wondering how one could easily built one.
> For CRVALx I have to calculate the world coordinates of the origin of
> the resulting image within the coordinate system of the primary image,
> in the units defined by CUNITx.
>
>> To get the units returned by wcs_pix2sky, use wcs.wcs.units[wcs.wcs.spec].
>
> This is what I needed, thank you (wcs.wcs.cunit). BTW, I would propose
> to implement an iterator there (or as wcs.unit)?
>
> Best regards
>
> Ole
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>



More information about the AstroPy mailing list