[AstroPy] [pywcs] Unit question

Ole Streicher astropy at liska.ath.cx
Tue Apr 5 03:16:24 EDT 2011

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


More information about the AstroPy mailing list