[AstroPy] [pywcs] Unit question

Ole Streicher astropy at liska.ath.cx
Mon Apr 4 08:27:34 EDT 2011


Dear James,

Am 01.04.2011 18:30, schrieb James Turner:
> Oh, sorry, that probably didn't make sense; it couldn't convert to m
> it didn't know what it was. Should think longer before posting... I
> did notice that there's a units class in pywcs (under API
> documentation), so maybe that will help?

This helps a bit, thank you. However, my problem is that I want to put
not just the wavelength there but coordinates for all dimensions.

So, I have a loop like

for i, s in enumerate(wcs.wcs_pix2sky([origin], 1)[0]):
    conv = pywcs.UnitConverter(want = h.header['CUNIT%i' % (i+1)])
    h.header['CRVAL%i' % (i+1)] = conv.convert(s)
    h.header['CRPIX%i' % (i+1)] = 1

The Problem here is now that wcs.UnitConverter wants the "have" unit,
which is the of the wcs.wcs_sky2pix() output. How do I canonically get
the measurement units of the coordinates returned by wcs_sky2pix()?

Regards

Ole



More information about the AstroPy mailing list