+ All Categories
Home > Documents > 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16...

1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16...

Date post: 29-Mar-2015
Category:
Upload: anabel-dragon
View: 213 times
Download: 1 times
Share this document with a friend
Popular Tags:
40
1 A Tool-kit Approach to A Tool-kit Approach to WCS WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003
Transcript
Page 1: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

1

A Tool-kit Approach to WCSA Tool-kit Approach to WCS

David Berry (Starlink)

IVOA Inter-operability Meeting

Cambridge

12-16th May 2003

Page 2: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

2/40

Importance of WCS Importance of WCS

WCS is needed to:Locate data within the region of interest Align data sets from disparate sourcesAnnotate data displays

Page 3: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

3/40

The “prescriptive” approachThe “prescriptive” approach

Prescribes a limited number of allowed recipes which may be used to describe the relationships between specified co-ordinate systems.

As WCS needs change, new recipes need to be added – can end up with lots of “specific-case” code (does not scale well).

It can be difficult to reach agreement on what the allowed recipes should be.

Page 4: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

4/40

The “tool-kit” approachThe “tool-kit” approach

Provides a wide range of simple WCS components (tools) which can be “connected together” in any way to create a complete WCS representation.

There are no prescribed recipes; the developer is free to use the most appropriate representation for the WCS information.

Components are self-describing.

Page 5: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

5/40

The AST libraryThe AST library

An implementation of a tool-kit approach to WCS representation and management.

See

http://www.ast.man.ac.uk/~dsb/ast/ast.html

Page 6: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

6/40

AST Base classesAST Base classes

The basic tools in the AST tool-kit are Mappings, Frames and FrameSets.

Each base class encapsulates the general properties and methods of the class – sub-classes are provided for specific case.

All can be serialised, for instance as XML.

Page 7: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

7/40

The The MappingMapping class class

A Mapping transforms a set of positions using a specified mathematical operation.

No assumptions are made about the nature of the input or output co-ordinate systems.

The input and output positions need not be of the same dimensionality.

Many (but not all) Mappings will be in invertible.

Page 8: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

8/40

Mapping sub-classesMapping sub-classes

Sub-classes of Mapping are provided which implement: – Axis scaling– Shift of origin– Matrix multiplication– Spherical projections– Cartesian to spherical conversion

Page 9: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

9/40

Mapping sub-classesMapping sub-classes

– Axis permutation and selection– Arbitrary algebraic expressions– Pin-cushion distortion– Transformations between celestial,

spectral and (shortly) time co-ordinate systems, all based on SLALIB

– Others can be added easily

Page 10: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

10/40

Compound MappingsCompound Mappings

A CmpMap is a sub-class of Mapping which encapsulates two other Mappings.

Series CmpMaps:

Parallel CmpMaps:

Map1 Map2

Map1

Map2

Page 11: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

11/40

Compound MappingsCompound Mappings

Since a CmpMap is itself a Mapping, a CmpMap can encapsulate other CmpMaps.

This allows arbitrarily complex Mappings to be constructed:

Map2 Map3

Map4

Map1

Page 12: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

12/40

The The FrameFrame class class

A Frame describes a physical domain such as “the sky”, “a pixel array”, “a spectrum”, “time”, “a focal plane”, “3D space”, etc.

The base Frame class represents a basic N-dimensional Euclidean space which can be used to describe a user-specified domain.

Sub-classes of Frame exist to describe celestial and spectral positions (“time” to follow shortly).

Page 13: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

13/40

The The FrameFrame class class

The description given by a Frame includes:– The domain name– The dimensionality of the domain– The particular co-ordinate system used to

describe positions within the domain (sub-classes support a range of different co-ordinate systems appropriate to the sub-class domain)

– A moment in time which specifies the co-ordinate system

Page 14: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

14/40

The The FrameFrame class class

The description given by a Frame includes:– Label, Unit and Symbol strings for each axis of

the co-ordinate system.– The topology of the domain (allows navigation

around the domain)– The Mappings needed to transform between the

different co-ordinate systems which can be used to describe positions within the domain.

Page 15: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

15/40

The SkyFrameThe SkyFrame

Describes positions on the skyCo-ordinate systems currently supported

include equatorial (FK4, FK4-NO-E, FK5, GAPPT, ICRF), ecliptic, galactic, super-galactic. Heliocentric systems to follow…

Extra properties: Equinox.

Page 16: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

16/40

A Serialised SkyFrameA Serialised SkyFrame Begin SkyFrame # Description of celestial coordinate system# Title = "FK4 equatorial coordinates; mean equinox B1950.0; epoch B1987.67101" # Title of coordinate system Naxes = 2 # Number of coordinate axes# Domain = "SKY" # Coordinate system domain Epoch = 1987.67 # Julian epoch of observation# Lbl1 = "Right ascension" # Label for axis 1# Lbl2 = "Declination" # Label for axis 2 System = "FK4" # Coordinate system type# Uni1 = "hh:mm:ss.s" # Units for axis 1# Uni2 = "ddd:mm:ss" # Units for axis 2# Dir1 = 0 # Plot axis 1 in reverse direction# Bot2 = -1.5707963267949 # Lowest legal axis value# Top2 = 1.5707963267949 # Highest legal axis value Ax1 = # Axis number 1 Begin SkyAxis # Celestial coordinate axis End SkyAxis Ax2 = # Axis number 2 Begin SkyAxis # Celestial coordinate axis End SkyAxis IsA Frame # Coordinate system description Eqnox = 1950 # Besselian epoch of mean equinox End SkyFrame

Page 17: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

17/40

The SpecFrameThe SpecFrame

Describes positions within an electro-magnetic spectrum

Co-ordinate systems include frequency, wavelength, energy, velocity (radio, optical, relativistic), etc, all in any appropriate unit (including log, sqrt, units, etc).

Extra properties: Rest frame, observer position, source position, rest frequency, source velocity...

Page 18: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

18/40

A Serialised SpecFrameA Serialised SpecFrame Begin SpecFrame # Description of spectral coordinate system# Title = "Frequency (lSRK)" # Title of coordinate system Naxes = 1 # Number of coordinate axes# Domain = "SPECTRUM" # Coordinate system domain Epoch = 1995.55138507871 # Julian epoch of observation# Lbl1 = "Frequency" # Label for axis 1 System = "FREQ" # Coordinate system type# Uni1 = "GHz" # Units for axis 1 Ax1 = # Axis number 1 Begin Axis # Coordinate axis Unit = "GHz" # Axis units End Axis IsA Frame # Coordinate system description SoR = "LSRK" # Standard of rest RefRA = 0.0286375917587126 # Reference RA (rads, FK5 J2000) RefDec = 0.0223112108219319 # Reference Dec (rads, FK5 J2000) GeoLat = 0.345973275091431 # Observers geodetic latitude (rads) GeoLon = -2.71358558214735 # Observers geodetic longitude (rads) RstFrq = 230537999000 # Rest frequency (Hz) SrcVel = 110000 # Source velocity (m/s) SrcVRF = "LSRK" # Source velocity rest frame UFreq = "GHz" # Preferred units for frequency End SpecFrame

Page 19: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

19/40

Compound FramesCompound Frames

The CmpFrame class combines two component Frames to form a Frame which describes two physical domains.

For instance, a spectral cube can be described by a CmpFrame which combines a SkyFrame and a SpecFrame.

Since a CmpFrame is itself a Frame, complex CmpFrames can be constructed which encapsulate other CmpFrames.

Page 20: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

20/40

The Convert methodThe Convert method

Convert – a method of the Frame class, extended by sub-classes.

Returns a Mapping which converts positions in ‘this’ Frame into another supplied Frame, or a null reference if no conversion is possible.

Hides all details of conversion between different co-ordinate systems – a non-trivial task for CmpFrames!

Page 21: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

21/40

Putting it all together - Putting it all together - FrameSetsFrameSets

A FrameSet is a network of Frames connected together by Mappings.

Each Frame represents one or more of the co-ordinate systems which can be used to describe the position of a data value.

Each Mapping describes how to transform a position from one Frame to another.

Page 22: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

22/40

Putting it all together – Putting it all together – FrameSetsFrameSets

XI-ETA-B: Tangent plane standard co-ordinates with barrel distortion.

XI-ETA-B

PIXEL Map1

XI-ETA

SKY-B

SKY

Map4

Map2

Map3

SKY-B: RA/Dec with barrel distortion.

XI-ETA: Tangent plane standard co-ordinates without barrel distortion.

SKY: RA/Dec without added barrel distortion.

Page 23: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

23/40

The Convert method againThe Convert method again

FrameSet inherits from Frame. When viewed as a Frame, a FrameSet is equivalent to its current Frame.

FrameSet extends the Frame.Convert method to find a Mapping which “aligns” two FrameSets: it uses the Convert method recursively on all pairs of Frames.

Even works with CmpFrames!

Page 24: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

24/40

The FindFrame methodThe FindFrame method

Searches a FrameSet for a Frame with given properties.

A template Frame defines the required properties.

Properties may be left undefined in the template – they are used as “wild-cards”.

Page 25: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

25/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

An AST FrameSet can be automatically generated to describe the WCS information in a FITS header. Consider the following simple FITS header as an example:

CRPIX1 = 256 / Pixel X coordinate of reference pointCRPIX2 = 257 / Pixel Y coordinate of reference pointCRVAL1 = 45.83 / RA (degs) at reference pointCRVAL2 = 63.57 / Dec (degs) at reference pointCTYPE1 = 'RA---TAN' / Gnomonic projection giving RA/DECCTYPE2 = 'DEC—-TAN' / Gnomonic projection giving RA/DECCD1_1 = -0.003 / Matrix which rotates and scales pixelCD1_2 = 0.0005 / coordinates into projection planeCD2_1 = -0.0005 / (X,Y) coordinates in degreesCD2_2 = 0.003 /RADESYS = 'FK5 ' / RA/DEC are in the FK5 frameEQUINOX = 2000.0 / Mean equator and equinox of J2000.0MJD-OBS = 44258.7856 / Modified Julian Date at start of observation

Page 26: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

26/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

The example FITS header on the previous slide can be described using an AST FrameSet holding 2 Frames connected together by a Mapping.

These components are described over the next few slides…

PIXEL Map SKY

Page 27: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

27/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

The “PIXEL” Frame represents the pixel array. Positions within the pixel array are described using the usual Cartesian FITS pixel co-ordinate system.

This Frame describes the input co-ordinates supplied to the Mapping.

PIXEL Map SKY

Page 28: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

28/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

The “SKY” SkyFrame (a sub-class of Frame) represents the sky. Positions on the sky are described in the system specified by the FITS keywords CTYPEi, RADESYS, EQUINOX and MJD-OBS.

This SkyFrame describes the output co-ordinates produced by the Mapping.

PIXEL Map SKY

Page 29: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

29/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

“Map” is a CmpMap (a compound Mapping) which combines several simpler atomic Mappings in series.

Each atomic Mapping represents a step in the FITS-WCS recipe for converting pixel positions into sky positions. These Mappings are described over the next few slides…

PIXEL Map SKY

Page 30: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

30/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

The first atomic Mapping is a WinMap which shifts the origin as described by the CRPIX1 & CRPIX2 FITS keywords. A WinMap is a sub-class of Mapping which maps a specified rectangular input window onto a specified output window by applying a linear scale and shift to each axis. The input to this Mapping is a position in the PIXEL Frame.

Map1

PIXEL

Page 31: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

31/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

A WinMap which shifts the origin as described by the CRPIX1 & CRPIX2 keywords. Map1

Map2 The second atomic Mapping is a MatrixMap which rotates and scales the axes as described by the CDi_j FITS keywords. A MatrixMap is a sub-class of Mapping which multiplies each input N-dimensional position by an M x N matrix to produce an M-dimensional output position.

PIXEL

Page 32: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

32/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

A WinMap which shifts the origin as described by the CRPIX1 & CRPIX2 keywords. Map1

Map2 The second atomic Mapping is a MatrixMap which rotates and scales the axes as described by the CDi_j FITS keywords.

The third atomic Mapping is a WcsMap which produces native longitude and latitude, using the spherical projection specified by the CTYPEi FITS keywords. A WcsMap is a sub-class of Mapping which can perform any of the FITS-WCS spherical projections.

Map3

PIXEL

Page 33: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

33/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

A WinMap which shifts the origin as described by the CRPIX1 & CRPIX2 keywords. Map1

Map2 The second atomic Mapping is a MatrixMap which rotates and scales the axes as described by the CDi_j FITS keywords.

The third atomic Mapping is a WcsMap which produces native longitude and latitude, using the spherical projection specified by the CTYPEi FITS keywords.

Map3

The fourth atomic Mapping is a SphMap which converts native longitude and latitude into corresponding Cartesian (X,Y,Z) values on a unit sphere. A SphMap is a sub-class of Mapping which performs spherical to Cartesian conversion.

Map4

PIXEL

Page 34: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

34/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

A WinMap which shifts the origin as described by the CRPIX1 & CRPIX2 keywords. Map1

Map2 A MatrixMap which rotates and scales the axes as described by the CDi_j FITS keywords.

A WcsMap which produces native longitude and latitude, using the spherical projection specified by the CTYPEi FITS keywords.

Map3

A SphMap which converts native longitude and latitude into corresponding Cartesian (X,Y,Z) values on a unit sphere.Map4

Map5 The fifth Mapping is a 3x3 MatrixMap which does a 3-D rotation to put the RA/Dec position given by FITS keywords CRVALi at the reference point (with the default value for the LONPOLE keyword).

PIXEL

Page 35: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

35/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

A WinMap which shifts the origin as described by the CRPIX1 & CRPIX2 keywords. Map1

Map2 A MatrixMap which rotates and scales the axes as described by the CDi_j FITS keywords.

A WcsMap which produces native longitude and latitude, using the spherical projection specified by the CTYPEi FITS keywords.

Map3

A SphMap which converts native longitude and latitude into corresponding Cartesian (X,Y,Z) values on a unit sphere.Map4

Map5 A 3x3 MatrixMap which does a 3-D rotation to put the RA/Dec position given by FITS keywords CRVALi at the reference point.

Map6 The final Mapping is an inverted SphMap which converts Cartesian (X,Y,Z) values back into longitude (RA) and latitude (Dec).

PIXEL

Page 36: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

36/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

A WinMap which shifts the origin as described by the CRPIX1 & CRPIX2 keywords. Map1

Map2 A MatrixMap which rotates and scales the axes as described by the CDi_j FITS keywords.

A WcsMap which produces native longitude and latitude, using the spherical projection specified by the CTYPEi FITS keywords.

Map3

A SphMap which converts native longitude and latitude into corresponding Cartesian (X,Y,Z) values on a unit sphere.Map4

Map5 A 3x3 MatrixMap which does a 3-D rotation to put the RA/Dec position given by FITS keywords CRVALi at the reference point.

Map6 An inverted SphMap which converts Cartesian (X,Y,Z) values back into longitude (RA) and latitude (Dec).

The output from this final Mapping is the required RA/Dec position.

PIXEL

SKY

Page 37: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

37/40

An AST representation of An AST representation of FITS-WCSFITS-WCS

FITS header which have alternate axis descriptions can be represented by a more complicated FrameSet as shown above.

PIXEL

MapAWCSNAMEA

MapB WCSNAMEB

MapCWCSNAMEC

Page 38: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

38/40

Benefits of the “tool-kit” Benefits of the “tool-kit” approach to WCSapproach to WCS

Flexibility: provides a wider range of options for describing novel WCS arrangements.

Abstract interface: Frame methods can be used on any class of Frame so general purpose applications can be written which know nothing about the details of the WCS.

Scalability: Complex WCS arrangement can be extended simply by adding new Frames.

Page 39: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

39/40

Benefits of the “tool-kit” Benefits of the “tool-kit” approach to WCSapproach to WCS

Scalability: New classes of Frame and Mapping can be added and used without need for application code to be changed.

Functionality: Allows powerful methods such as Convert and FindFrame to be written.

Ease of use: Hides all the specific details of different co-ordinate systems and the conversions between them.

Page 40: 1 A Tool-kit Approach to WCS David Berry (Starlink) IVOA Inter-operability Meeting Cambridge 12-16 th May 2003.

40/40

ConclusionsConclusions

Tool-kit approaches to WCS description and management ease future development as WCS requirements evolve.

The description and handling of co-ordinate systems crops up in many areas of VO work. Adoption of a single unified system would reduce integration issues and the over-all development effort.


Recommended