casacore
|
Classes to interconvert pixel and world (physical) coordinates. More...
Modules | |
Coordinates_module_internal_classes | |
Internal Coordinates_module classes and functions. | |
Classes | |
class | casacore::Coordinate |
Interface for converting between world and pixel coordinates. More... | |
class | casacore::CoordinateSystem |
Interconvert pixel and world coordinates. More... | |
class | casacore::CoordinateUtil |
Functions for creating default CoordinateSystems. More... | |
class | casacore::DirectionCoordinate |
Interconvert pixel positions and directions (e.g. RA/DEC). More... | |
class | casacore::FITSCoordinateUtil |
class | casacore::FrequencyAligner< T > |
Aligns spectra in frequency space. More... | |
class | casacore::GaussianConvert |
Converts Gaussian parameters between pixel and world. More... | |
class | casacore::LinearCoordinate |
Interconvert between pixel and a linear world coordinate. More... | |
class | casacore::ObsInfo |
Store miscellaneous information related to an observation. More... | |
class | casacore::Projection |
Geometric parameters needed for a sky projection to a plane. More... | |
class | casacore::QualityCoordinate |
Interconvert between pixel and Quality value. More... | |
class | casacore::SpectralCoordinate |
Interconvert pixel and frequency values. More... | |
class | casacore::StokesCoordinate |
Interconvert between pixel and Stokes value. More... | |
class | casacore::TabularCoordinate |
Table lookup 1-D coordinate, with interpolation. More... | |
ostream & | casacore::operator<< (ostream &os, const ObsInfo &info) |
Global functions. More... | |
Classes to interconvert pixel and world (physical) coordinates.
See below for an overview of the classes in this module.
The primary notion is that a Coordinate can interconvert between a length "n" Vector<Double> (the pixel coordinate) and a length "m" Vector<Double> (the "world" coordinate). Note that "m" and "n" do not in principle have to be the same (so that one can get both the RA and DEC from an image slice, for example), however in practice they currently always are. Each Coordinate has the full mapping from pixel to world coordinates, i.e. it has a reference value, reference pixel, increments, and an arbitrary transformation matrix. To go from a pixel to a world coordinate the following steps are applied:
The classes are arranged as follows. The base class is Coordinate which defines the interface. Classes derived from it are
Other classes are Projection which is used to specify an astronomical projection for DirectionCoordinates, and LinearXform a helper class which the application programmer will not interact with.
CoordinateSystem is the class that application programmers will usually interact with. A CoordinateSystem consists of a collection of the other classes derived from Coordinate. Normally one group will be for RA/DEC, another for a Stokes axis, and another group for the spectral axis. The axes may be transposed arbitrarily, for example RA could be the first axis, and DEC the third.
Normally the CoordinateSystem being manipulated will be embedded in a PagedImage or other object. Note that the axes of the PagedImage do not necessarily map directly to the axes in the CoordinateSystem. Functionality is provided to determine this mapping.
One or more axes from the CoordinateSystem may be removed. Pixel axes and/or world axes may be removed. You are encouraged to leave all the world axes when you remove pixel axes.
If a world axis is removed, the corresponding pixel axis is also removed. This means that one can be sure that a pixel axis always has a corresponding world axis (it makes no sense otherwise). The opposite is not necessarily true: a world axis can exist without a pixel axis.
The linear transformation and sky projection computations are carried out in an underlying library – WCSLIB – written by Mark Calabretta of the ATNF.
Caution: All pixels coordinates are zero relative;
First, let's make a DirectionCoordinate — used to represent a direction, usually an RA/DEC, but it could also be, e.g., an AZ/EL pair.
xy<–>world
. SIN is the most common projection for radio interferometers. Note that SIN can optionally take parameters as defined in Calabretta and Greisen. If not provided, they default to 0.0, which is the "old" SIN convention. Although we happeend to create our DirectionCoordinate with Quanta in degrees, these have been converted to radians by the constructor. We can set the native units to degrees if we wish as follows:
The increment and reference value are updated appropriately.
Set up a couple of vectors to use the world and pixel coordinate values.
We use 138 as an abitrary pixel position which is near the reference pixel so we can tell if the answers look foolish or not.
We can actually perform a transformation like this as follows. If it succeeds we print the value of the world coordinate.
There is an overloaded "toWorld" function that produces an MDirection in case you want to, e.g., find out what the position in B1950 coordinates would be.
The reverse transformation takes place similarly:
Suppose we have an image with a Stokes axis. It can be set up as follows:
We create an integer array the same length as the Stokes axis, and place the corresponding Stokes enum into each element of the array. The values must be unique, e.g. there can only be one "I" plane. Besides the generic Vector<Double>
toWorld/toPixel interface, you can also directly interconvert between Stokes enum and and (zero-relative) plane number:
Here it will return True
and set plane to 1. On the other hand, it would return False
for:
since "XX" is not one of the Stokes enumerations we used to create this coordinate.
A Spectral ("frequency") coordinate may be created as follows:
The default frequency units of a spectral coordinate are Hz, although they may be changed to whatever is convenient. The first line (27) defines the type of frequency we have – topocentric here. The second (28) line defines the frequency at the reference pixel, 0 (28) here. The channel increment is defined on line 29. A rest frequency of the spectral may be provided. It is useful in calculating doppler velocities. These calculations are carried out by the MFrequency and MDoppler classes of the Measures system.
The primary motivation is to provide support for converting pixel locations in an image to physical ("world") positions.