[AstroPy] comments on coordinate system and wcs packages

Tim Jenness tim.jenness at gmail.com
Fri May 4 19:15:28 EDT 2012


On Fri, May 4, 2012 at 4:08 PM, Marshall Perrin <mperrin at stsci.edu> wrote:
> On May 4, 2012, at 3:58 PM, Wolfgang Kerzendorf wrote:
>> In that sense transforming from an ifu cube (which has a coordinate system in equatorial). is simply mycoord = myifu.pixel2world(500, 500, 500) -> (200. -60 6562) (the wcs has the units, so we can look them up).
>> mygal = coord.from_equatorial(mycoord[0], mycoord[1]).to_galactic().
>
> I'm with Vicki on this: better to return complex objects rather than just tuples. For instance in this case, keep in mind that there's no universal convention in IFU data for whether the wavelength axis is first or last. So in this example, is it (ra, dec, wave) or (wave, ra, dec), or what? Much better to return instead some kind of Coordinate object with attributes, each of which has some associated unit.
>

Exactly

>>>> mycoord = myifu.pixel2world(500, 500, 500)
> <SpectralCelestialCoord object>

This would be a CmpFrame in AST made up of a SkyFrame and SpecFrame.

>>>> mycoord.ra
> Value with unit: 200 deg
>>>> mycoord.wavelength
> Value with unit: 6562 Angstrom
>
> One can then imagine just casting between coordinates with attributes (internally implemented as a method call wrapped in @property, probably)
>
>>>> mycoord.galactic
> (8:04:02, -12:34:56 )
>
>>>> mycoord.freq
> Value with unit: 4.56e14 Hz
>
> For spectroscopic data, note that wavelength, frequency, and energy should all be included, and it ought to be possible to specify a rest wavelength in which case the axis can also be cast to velocity, too.
>

Exactly. Look at the attributes associated with a SpecFrame

http://www.starlink.rl.ac.uk/docs/sun211.htx/node680.html

-- 
Tim Jenness
Joint Astronomy Centre



More information about the AstroPy mailing list