[AstroPy] API question: Instantiating of time/coord and similar

Tim Jenness tim.jenness at gmail.com
Wed May 2 16:42:21 EDT 2012

On Wed, May 2, 2012 at 1:03 PM, Perry Greenfield <perry at stsci.edu> wrote:
> Are these necessarily exclusive approaches?

AST was designed to handle mappings from different coordinate systems
from the beginning to handle data pixel coordinates to WCS to graphic
coordinates (and vice versa) in a transparent manner.

The examples earlier in this thread are more based around conversion
of a single value from one frame to another and there are many
simplifications that are possible when that is done. A single galactic
coordinate to the corresponding RA/Dec coordinate is a well understood
conversion that never changes. AST will let you work out the world
coordinates of a particular pixel in your image, or the pixel that
corresponds to a particular WCS, or the position on the graphics
plotting device corresponding to either the data pixel or the WCS
coordinate. The transformation from RA/Dec to Galactic is all handled
in a specialist SKY frame and you can actually do the simple
translations by setting attributes in a Sky frame object without
having to understand mappings and pixel coordinates (so easily

> (by the way, most of ast
> links are slightly corrupted by appended closing parentheses
> apparently).

I think it depends on the mailer. gmail guesses (correctly) that the
trailing parenthesis below is not part of the URL so it does work.

>> 1) Given two Frames, find a transformation between them. For instance,
>> if you have a pair of Frames representing different celestial
>> coordinate systems, or spectral coorinate systems, or time coordinate
>> systems, or any combination, AST has a method
>> ( http://www.starlink.ac.uk/docs/sun211.htx/node245.html ) that will
>> return you a Mapping (if possible) that can be used to transform
>> position from one Frame to the other. This is

>> up?" is really useful (lots of AST  examples - e.g.
>> http://www.starlink.ac.uk/docs/sun211.htx/node340.html
>> 3) Attaching a set of coordinate systems to a data cube (i.e. the sort
>> of thing the FITS WCS papers cover) - you can define the Frames
>> ("pixel", "Focal plane", "sky", etc), and the Mappings between them,
>> and then join them all into some higher level object (a "FrameSet" in
>> AST - http://www.starlink.ac.uk/docs/sun211.htx/node270.html ) that
>> allows you to convert positions between any pair of frames.
>> 4) If you read such a FrameSet from a data set, you can search it for
>> coordinate systems with particular properties by using a Frame as a
>> sort of wild-card template ("search the FrameSet for any Frames that
>> have properties matching this template Frame" -
>> http://www.starlink.ac.uk/docs/sun211.htx/node264.html ).
>> 5) The Frame can define things like how to format or parse axis
>> values. For instance,  equatorial sky coordinates may be represented
>> internally in degrees or radians, but should probably be represented
>> as sexagisimal RA and Dec values. But other coordinate systems (e.g.
>> galactic sky coords or pixel coords) are usually represented as
>> decimal values. A Frame class is a good place to encapsulate all this
>> knowledge (e.g.
>> http://www.starlink.ac.uk/docs/sun211.htx/node435.html ).

Tim Jenness

More information about the AstroPy mailing list