Loading...
Searching...
No Matches
casacore::Coordinate Class Referenceabstract
coordinates package (libcasa_coordinates) » Coordinates_module

More...

`#include <Coordinate.h>`

## Public Types

enum | Type { LINEAR , DIRECTION , SPECTRAL , STOKES , TABULAR , QUALITY , COORDSYS }
| This enum lists the types of the derived classes. More...
enum | formatType { DEFAULT , SCIENTIFIC , FIXED , MIXED , TIME }
| This enum is used for formatting world values into Strings. More...

## Public Member Functions

virtual | ~Coordinate ()
| Destructor.
virtual Type | type () const =0
| List the type of this Coordinate object.
virtual String | showType () const =0
virtual uInt | nPixelAxes () const =0
| How many world/pixel axes are there in this Coordinate?
virtual uInt | nWorldAxes () const =0
virtual Bool | toWorld (Vector< Double > &world, const Vector< Double > &pixel, Bool useConversionFrame=True) const =0
| Convert an absolute pixel position to an absolute world position or vice versa.
virtual Bool | toPixel (Vector< Double > &pixel, const Vector< Double > &world) const =0
virtual Bool | toMix (Vector< Double > &worldOut, Vector< Double > &pixelOut, const Vector< Double > &worldIn, const Vector< Double > &pixelIn, const Vector< Bool > &worldAxes, const Vector< Bool > &pixelAxes, const Vector< Double > &worldMin, const Vector< Double > &worldMax) const
| Mixed absolute pixel/world coordinate conversion.
virtual Bool | setWorldMixRanges (const IPosition &shape)
| Set the world min and max ranges, for use in function toMix, for a lattice of the given shape for this coordinate.
virtual void | setDefaultWorldMixRanges ()
Vector< Double > | worldMixMin () const
Vector< Double > | worldMixMax () const
virtual Bool | toWorldMany (Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures) const
| Batch up a lot of transformations.
virtual Bool | toPixelMany (Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures) const
virtual void | makePixelRelative (Vector< Double > &pixel) const
| Make absolute coordinates relative and vice-versa (with respect to the reference value).
virtual void | makePixelAbsolute (Vector< Double > &pixel) const
virtual void | makeWorldRelative (Vector< Double > &world) const
virtual void | makeWorldAbsolute (Vector< Double > &world) const
virtual void | makeWorldAbsoluteRef (Vector< Double > &world, const Vector< Double > &refVal) const
| Make absolute coordinates relative and vice versa with respect to the given reference value.
virtual void | makePixelRelativeMany (Matrix< Double > &pixel) const
| Batch up a lot of absolute/relative transformations.
virtual void | makePixelAbsoluteMany (Matrix< Double > &pixel) const
virtual void | makeWorldRelativeMany (Matrix< Double > &world) const
virtual void | makeWorldAbsoluteMany (Matrix< Double > &world) const
virtual Vector< String > | worldAxisNames () const =0
| Return the requested attributed.
virtual Vector< Double > | referencePixel () const =0
virtual Matrix< Double > | linearTransform () const =0
virtual Vector< Double > | increment () const =0
virtual Vector< Double > | referenceValue () const =0
virtual Vector< String > | worldAxisUnits () const =0
virtual Bool | setWorldAxisNames (const Vector< String > &names)=0
| Set the requested attribute.
virtual Bool | setReferencePixel (const Vector< Double > &refPix)=0
virtual Bool | setLinearTransform (const Matrix< Double > &xform)=0
virtual Bool | setIncrement (const Vector< Double > &inc)=0
virtual Bool | setReferenceValue (const Vector< Double > &refval)=0
virtual Bool | setWorldAxisUnits (const Vector< String > &units)=0
| Change the units.
virtual Coordinate * | makeFourierCoordinate (const Vector< Bool > &axes, const Vector< Int > &shape) const
| Find the Coordinate for when we Fourier Transform ourselves.
const String & | errorMessage () const
| If the last conversion to world or pixel coordinates resulted in an error, report that error.
virtual Bool | near (const Coordinate &other, Double tol=1.0e-6) const =0
| Comparison to fractional tolerance (for floating point values).
virtual Bool | near (const Coordinate &other, const Vector< Int > &excludeAxes, Double tol=1.0e-6) const =0
virtual void | getPrecision (Int &precision, Coordinate::formatType &format, Bool showAsAbsolute, Int defPrecScientific, Int defPrecFixed, Int defPrecTime) const
| Provide a common interface to getting formatted representations of coordinate values.
virtual String | format (String &units, Coordinate::formatType format, Double worldValue, uInt axis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1, Bool usePrecForMixed=False) const
String | formatQuantity (String &units, Coordinate::formatType format, const Quantum< Double > &worldValue, uInt axis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1)
virtual Bool | save (RecordInterface &container, const String &fieldName) const =0
| Used for persistence.
virtual Coordinate * | clone () const =0
| Make a copy of ourself.
virtual Bool | doNearPixel (const Coordinate &other, const Vector< Bool > &thisAxes, const Vector< Bool > &otherAxes, Double tol=1.0e-6) const
| Comparison only made for specified axes in this and other Coordinate The default implementation should be ok for all Coordinate types except Stokes and Quality...
virtual Coordinate * | rotate (const Quantum< Double > &angle) const
| return the result of rotating the coordinate clockwise through the specified angle.

## Static Public Member Functions

static String | typeToString (Coordinate::Type type)
static void | set_wcs (::wcsprm &wcs)
| Call wcsset on the wcs structure.
static void | init_wcs (::wcsprm &wcs, int naxis)
| Call wcsini on the wcs structure.
static void | sub_wcs (const ::wcsprm &src, int &nsub, int axes[], ::wcsprm &dst)
| Call wcssub on the src/dst pair.
static void | copy_wcs (const ::wcsprm &src, ::wcsprm &dst)
| Call wcssub on the src/dst pair with null nsub/axes.

## Protected Member Functions

| Coordinate ()
| Default constructor.
| Coordinate (const Coordinate &other)
| Copy constructor (copy semantics).
Coordinate & | operator= (const Coordinate &other)
| Assignment (copy semantics).
void | set_error (const String &errorMsg) const
| Set error message.
Bool | find_scale_factor (String &error, Vector< Double > &factor, const Vector< String > &units, const Vector< String > &oldUnits)
void | fourierUnits (String &nameOut, String &unitOut, String &unitInCanon, Coordinate::Type type, Int axis, const String &unitIn, const String &nameIn) const
| Tries to find a canonical unit for input unit (e.g.
Bool | toWorldWCS (Vector< Double > &world, const Vector< Double > &pixel, wcsprm &wcs) const
| Functions to interconvert pixel<->world via wcs.
Bool | toPixelWCS (Vector< Double > &pixel, const Vector< Double > &world, wcsprm &wcs) const
Bool | toWorldManyWCS (Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures, wcsprm &wcs) const
Bool | toPixelManyWCS (Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures, wcsprm &wcs) const
void | toCurrentMany (Matrix< Double > &world, const Vector< Double > &toCurrentFactors) const
| Functions for handling conversion between the current units and the wcs units.
void | fromCurrentMany (Matrix< Double > &world, const Vector< Double > &toCurrentFactors) const
virtual void | convertTo (Vector< Double > &) const
| Functions for handling conversion between the current reference frame and the native one.
virtual void | convertFrom (Vector< Double > &) const
void | convertToMany (Matrix< Double > &world) const
| Functions for handling conversion between the current reference frame and the native one for many conversions.
void | convertFromMany (Matrix< Double > &world) const
void | pcToXform (Matrix< Double > &xForm, const wcsprm &wcs) const
| Interconvert between wcs PC cards and Matrix xForm format.
void | xFormToPC (wcsprm &wcs, const Matrix< Double > &xForm) const

## Protected Attributes

Vector< Double > | worldMin_p
| toMix ranges.
Vector< Double > | worldMax_p

## Private Member Functions

void | checkFormat (Coordinate::formatType &format, const Bool absolute) const
| Check format type.
void | makeWorldAbsRelMany (Matrix< Double > &value, Bool toAbs) const
void | makePixelAbsRelMany (Matrix< Double > &value, Bool toAbs) const

## Private Attributes

String | error_p

## Detailed Description

Interface for converting between world and pixel coordinates.

### Intended use:

Public interface

### Review Status

Reviewed By:
  Peter Barnes
Date Reviewed:
  1999/12/24

### Prerequisite

- Knowledge of astronomical coordinate conversions in general. Probably the best documents are the papers by Mark Calabretta and Eric Greisen. The initial draft from 1996 can be found at http://www.atnf.csiro.au/~mcalabre. It is this draft that the Coordinate classes are based upon. Since then, this paper has evolved into three which can be found at the above address, and will be published in the Astronomy and Astrophysics Supplement Series (probably in 2000). The design has changed since the initial draft. When these papers are finalized, and the IAU has ratified the new standards, WCSLIB (Mark Calabretta's implementation of these conventions) will be revised for the new designs. At that time, the Coordinate classes may also be revised.
- Generic Casacore classes; especially those in the Arrays module.
- Perhaps some of the information in the Measures module.

### Synopsis

The Coordinate class defines the generic interface whereby a pixel position is converted to a world (sky, frequency, stokes,...) position and vice versa. The pixel and world coordinates are in general multi-dimensional values. In general there need not be the same number of pixel and world axes, although this will normally be the case.

The fundamental model is that a pixel is first converted into a relative physical coordinate by:

1. Subtracting a reference pixel value from the pixel location; then
2. Multiplying this offset by a general transformation matrix (usually to account for rotation, but any matrix is allowed); then
3. Multiplying this product by an increment in physical units.

After this linear stage, the final coordinate value is computed from this relative physical unit and a reference value, and possibly some other parameters. In the case of a sky position, these latter include at least the projection type. In the case of a purely linear coordinate, the reference value is merely added to the relative physical coordinate. The interface also allows the axes to be assigned names (reasonable defaults will be selected), and for physical units.

Both absolute and relative coordinates are supported. The main interface supports conversion between absolute pixel and absolute world coordinate. There are then functions to convert absolute coordinates to relative and vice versa. A relative pixel coordinate is defined according to

relative = absolute - reference

A relative world coordinate is similar, although there may be deviations from this formula (e.g. for DirectionCoordinate a cos(latitude) term is incorporated and for StokesCoordinate relative world coordinates are defined to be the same as absolute world coordinates.

Caution: All absolute pixels coordinates are zero relative;

### Example

This is a base class so there is no direct example, but see the example in Coordinates.h for use of the derived classes.

### Motivation

Encapsulate the common interface to coordinate conversion so that it may be used polymorphically.

### Thrown Exceptions

- AipsError
- AllocError

### To Do

- Perhaps common FITS related interfaces should go in this class.

Definition at line 136 of file Coordinate.h.

## Member Enumeration Documentation

## formatType

enum casacore::Coordinate::formatType

This enum is used for formatting world values into Strings.

Enumerator
DEFAULT | Default; formatter decides.
SCIENTIFIC | Scientific format (e.g. -1.2397E+03)
FIXED | Fixed floating format (e.g. 12.134)
MIXED | Either scientific or floating point, auto-selected by the C++ STL formatting routines. May not be available for all Coordinate types.
TIME | HHH:MM:SS.SSS style formatting.

Definition at line 159 of file Coordinate.h.

## Type

enum casacore::Coordinate::Type

This enum lists the types of the derived classes.

It is primarly used in the CoordinateSystem class.

Enumerator
LINEAR | Linear axes.
DIRECTION | A direction. Usually RA/DEC.
SPECTRAL | A spectral axis.
STOKES | A Stokes axis.
TABULAR | A one-dimensional Cooordinate system, usually created from a table although it can also be purely linear.
QUALITY | to mark DATA and ERROR values
COORDSYS | A CoordinateSystem (a collection of Coordinates).

Definition at line 141 of file Coordinate.h.

## Constructor & Destructor Documentation

## ~Coordinate()

virtual casacore::Coordinate::~Coordinate | ( |  | ) |

virtual

Destructor.

Needs to be public so the user can delete Coordinate* objects

## Coordinate() [1/2]

casacore::Coordinate::Coordinate | ( |  | ) |

protected

Default constructor.

Make an empty coordinate. Used by derived classes.

Referenced by casacore::CoordinateSystem::addCoordinate(), clone(), casacore::CoordinateSystem::clone(), casacore::DirectionCoordinate::clone(), casacore::LinearCoordinate::clone(), casacore::QualityCoordinate::clone(), casacore::SpectralCoordinate::clone(), casacore::StokesCoordinate::clone(), casacore::TabularCoordinate::clone(), Coordinate(), casacore::CoordinateSystem::coordinate(), doNearPixel(), casacore::QualityCoordinate::doNearPixel(), casacore::StokesCoordinate::doNearPixel(), casacore::CoordinateSystem::listHeader(), casacore::CoordinateSystem::listVelocity(), makeFourierCoordinate(), casacore::CoordinateSystem::makeFourierCoordinate(), casacore::DirectionCoordinate::makeFourierCoordinate(), casacore::LinearCoordinate::makeFourierCoordinate(), casacore::SpectralCoordinate::makeFourierCoordinate(), casacore::TabularCoordinate::makeFourierCoordinate(), near(), near(), casacore::CoordinateSystem::near(), casacore::CoordinateSystem::near(), casacore::DirectionCoordinate::near(), casacore::DirectionCoordinate::near(), casacore::LinearCoordinate::near(), casacore::LinearCoordinate::near(), casacore::QualityCoordinate::near(), casacore::QualityCoordinate::near(), casacore::SpectralCoordinate::near(), casacore::SpectralCoordinate::near(), casacore::StokesCoordinate::near(), casacore::StokesCoordinate::near(), casacore::TabularCoordinate::near(), casacore::TabularCoordinate::near(), operator=(), casacore::CoordinateSystem::replaceCoordinate(), and rotate().

## Coordinate() [2/2]

casacore::Coordinate::Coordinate | ( | const Coordinate & | other | ) |

protected

Copy constructor (copy semantics).

References Coordinate().

## Member Function Documentation

## checkFormat()

void casacore::Coordinate::checkFormat | ( | Coordinate::formatType & | format,
|  | const Bool | absolute ) const

private

Check format type.

References format().

## clone()

virtual Coordinate * casacore::Coordinate::clone | ( |  | ) | const

pure virtual

Make a copy of ourself.

This pointer has been allocated with new and must be deleted by the caller.

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

References Coordinate().

## convertFrom()

virtual void casacore::Coordinate::convertFrom | ( | Vector< Double > & |  | ) | const

inline protected virtual

Reimplemented in casacore::DirectionCoordinate, and casacore::SpectralCoordinate.

Definition at line 546 of file Coordinate.h.

## convertFromMany()

void casacore::Coordinate::convertFromMany | ( | Matrix< Double > & | world | ) | const

protected

## convertTo()

virtual void casacore::Coordinate::convertTo | ( | Vector< Double > & |  | ) | const

inline protected virtual

Functions for handling conversion between the current reference frame and the native one.

The default implementations do nothing. They should be over-ridden in the derived classes.

Reimplemented in casacore::DirectionCoordinate, and casacore::SpectralCoordinate.

Definition at line 544 of file Coordinate.h.

## convertToMany()

void casacore::Coordinate::convertToMany | ( | Matrix< Double > & | world | ) | const

protected

Functions for handling conversion between the current reference frame and the native one for many conversions.

These functions just call the virtual functions for single conversions.

## copy_wcs()

void casacore::Coordinate::copy_wcs | ( | const ::wcsprm & | src,
|  | ::wcsprm & | dst )

static

Call wcssub on the src/dst pair with null nsub/axes.

## doNearPixel()

virtual Bool casacore::Coordinate::doNearPixel | ( | const Coordinate & | other,
|  | const Vector< Bool > & | thisAxes,
|  | const Vector< Bool > & | otherAxes,
|  | Double | tol = 1.0e-6 ) const

virtual

Comparison only made for specified axes in this and other Coordinate The default implementation should be ok for all Coordinate types except Stokes and Quality...

Reimplemented in casacore::QualityCoordinate, and casacore::StokesCoordinate.

References Coordinate().

## errorMessage()

const String & casacore::Coordinate::errorMessage | ( |  | ) | const

inline

If the last conversion to world or pixel coordinates resulted in an error, report that error.

If the last conversion succeeded, it is undefined what this will return (it might well contain the last error message).

Definition at line 581 of file Coordinate.h.

References error_p.

## find_scale_factor()

Bool casacore::Coordinate::find_scale_factor | ( | String & | error,
|  | Vector< Double > & | factor,
|  | const Vector< String > & | units,
|  | const Vector< String > & | oldUnits )

protected

References casacore::factor.

## format()

virtual String casacore::Coordinate::format | ( | String & | units,
|  | Coordinate::formatType | format,
|  | Double | worldValue,
|  | uInt | axis,
|  | Bool | isAbsolute = True,
|  | Bool | showAsAbsolute = True,
|  | Int | precision = -1,
|  | Bool | usePrecForMixed = False ) const

virtual

Reimplemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, and casacore::StokesCoordinate.

References casacore::False, format(), and casacore::True.

Referenced by checkFormat(), format(), formatQuantity(), and getPrecision().

## formatQuantity()

String casacore::Coordinate::formatQuantity | ( | String & | units,
|  | Coordinate::formatType | format,
|  | const Quantum< Double > & | worldValue,
|  | uInt | axis,
|  | Bool | isAbsolute = True,
|  | Bool | showAsAbsolute = True,
|  | Int | precision = -1 )

References format(), and casacore::True.

## fourierUnits()

void casacore::Coordinate::fourierUnits | ( | String & | nameOut,
|  | String & | unitOut,
|  | String & | unitInCanon,
|  | Coordinate::Type | type,
|  | Int | axis,
|  | const String & | unitIn,
|  | const String & | nameIn ) const

protected

Tries to find a canonical unit for input unit (e.g.

GHz -> Hz), and tells you the output name and unit for the Fourier coordinate pairing with the canonical unit

References type().

## fromCurrentMany()

void casacore::Coordinate::fromCurrentMany | ( | Matrix< Double > & | world,
|  | const Vector< Double > & | toCurrentFactors ) const

protected

## getPrecision()

virtual void casacore::Coordinate::getPrecision | ( | Int & | precision,
|  | Coordinate::formatType & | format,
|  | Bool | showAsAbsolute,
|  | Int | defPrecScientific,
|  | Int | defPrecFixed,
|  | Int | defPrecTime ) const

virtual

Provide a common interface to getting formatted representations of coordinate values.

Different derived Coordinate types are formatted in different ways. For example, an RA/DEC DirectionCoordinate uses an HMS.SS/DMS.SS representation. A Galactic Lat/Long DirectionCoordinate uses floating format in degrees. Other derived Coordinates are formatted with scientific format or floating format. The derived class format functions provide this functionality.

You may specify the format with the format argument and a value from the enum Coordinate::formatType. If you give it the value Coordinate::DEFAULT then a sensible default is used.

A mechanism for specifying the precision number of significant digits after decimal point is provided. You can specify the precision directly when calling format if it is unambiguous how the derived Coordinate is going to be formatted. For example, a LinearCoordinate is always formatted with scientific format. However, if you are using these classes polymorphically, you don't want to have to know this and some derived Coordinates may be formatted in multiple ways (such as the DirectionCoordinate examples above). Therefore, the function getPrecision enables you to set default precisions for the different styles of formatting used variously in the base and derived classes. This function chooses the precision from these default values, according to the type of derived Coordinate that your object is and what value for format that you give (refer to the derived classes for details on this).

Some derived classes will format differently depending upon whether you want to format an absolute or offset world value input via absolute (e.g. DirectionCoordinates).

The provided worldValue must be in the native units of the Coordinate. It may be an absolute (isAbsolute=True) or relative (isAbsolute=False) value. You may choose to format the world value as absolute (showAsAbsolute=True) or relative (showAsAbsolute=False). axis specifies which axis of the Coordinate this value belongs to.

units specifies the units in which the input world value will be formatted.
If units is empty, the native unit for the given axis is used.

Some derived classes will format in units different from the native unit of the Coordinate. The units of the formatted number are returned in units. If the units string is provided, the unit must be consistent with the native unit of the coordinate. The input world value will be converted to this unit.

You can also use the Quantum interface. The units of the Quantum can then be anything consistent with the Coordinate.

The default implementation here is to format only with scientific or fixed formats. If precision is negative, a the default precision is used.

Reimplemented in casacore::DirectionCoordinate.

References format().

## increment()

virtual Vector< Double > casacore::Coordinate::increment | ( |  | ) | const

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## init_wcs()

void casacore::Coordinate::init_wcs | ( | ::wcsprm & | wcs,
|  | int | naxis )

static

Call wcsini on the wcs structure.

## linearTransform()

virtual Matrix< Double > casacore::Coordinate::linearTransform | ( |  | ) | const

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## makeFourierCoordinate()

virtual Coordinate * casacore::Coordinate::makeFourierCoordinate | ( | const Vector< Bool > & | axes,
|  | const Vector< Int > & | shape ) const

virtual

Find the Coordinate for when we Fourier Transform ourselves.

This pointer must be deleted by the caller. Axes specifies which axes of the Coordinate you wish to transform. Shape specifies the shape of the image associated with all the axes of the Coordinate. Currently the output reference pixel is always shape/2.

Reimplemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::SpectralCoordinate, and casacore::TabularCoordinate.

References Coordinate(), and casacore::shape().

## makePixelAbsolute()

virtual void casacore::Coordinate::makePixelAbsolute | ( | Vector< Double > & | pixel | ) | const

virtual

Reimplemented in casacore::CoordinateSystem, casacore::QualityCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## makePixelAbsoluteMany()

virtual void casacore::Coordinate::makePixelAbsoluteMany | ( | Matrix< Double > & | pixel | ) | const

virtual

Reimplemented in casacore::CoordinateSystem.

## makePixelAbsRelMany()

void casacore::Coordinate::makePixelAbsRelMany | ( | Matrix< Double > & | value,
|  | Bool | toAbs ) const

private

References casacore::NewDelAllocator< T >::value.

## makePixelRelative()

virtual void casacore::Coordinate::makePixelRelative | ( | Vector< Double > & | pixel | ) | const

virtual

Make absolute coordinates relative and vice-versa (with respect to the reference value).

Vectors must be length nPixelAxes() or nWorldAxes() or memory access errors will occur

Reimplemented in casacore::CoordinateSystem, casacore::QualityCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## makePixelRelativeMany()

virtual void casacore::Coordinate::makePixelRelativeMany | ( | Matrix< Double > & | pixel | ) | const

virtual

Batch up a lot of absolute/relative transformations.

Parameters as above for toWorldMany and toPixelMany

Reimplemented in casacore::CoordinateSystem.

## makeWorldAbsolute()

virtual void casacore::Coordinate::makeWorldAbsolute | ( | Vector< Double > & | world | ) | const

virtual

Reimplemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::QualityCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## makeWorldAbsoluteMany()

virtual void casacore::Coordinate::makeWorldAbsoluteMany | ( | Matrix< Double > & | world | ) | const

virtual

Reimplemented in casacore::CoordinateSystem.

## makeWorldAbsoluteRef()

virtual void casacore::Coordinate::makeWorldAbsoluteRef | ( | Vector< Double > & | world,
|  | const Vector< Double > & | refVal ) const

virtual

Make absolute coordinates relative and vice versa with respect to the given reference value.

Add the other functions in this grouping as needed. Vectors must be length nPixelAxes() or nWorldAxes() or memory access errors will occur

Reimplemented in casacore::CoordinateSystem, and casacore::DirectionCoordinate.

## makeWorldAbsRelMany()

void casacore::Coordinate::makeWorldAbsRelMany | ( | Matrix< Double > & | value,
|  | Bool | toAbs ) const

private

References casacore::NewDelAllocator< T >::value.

## makeWorldRelative()

virtual void casacore::Coordinate::makeWorldRelative | ( | Vector< Double > & | world | ) | const

virtual

Reimplemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::QualityCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## makeWorldRelativeMany()

virtual void casacore::Coordinate::makeWorldRelativeMany | ( | Matrix< Double > & | world | ) | const

virtual

Reimplemented in casacore::CoordinateSystem.

## near() [1/2]

virtual Bool casacore::Coordinate::near | ( | const Coordinate & | other,
|  | const Vector< Int > & | excludeAxes,
|  | Double | tol = 1.0e-6 ) const

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

References Coordinate().

## near() [2/2]

virtual Bool casacore::Coordinate::near | ( | const Coordinate & | other,
|  | Double | tol = 1.0e-6 ) const

pure virtual

Comparison to fractional tolerance (for floating point values).

Don't compare on specified axes in Coordinate. If the comparison returns False, errorMessage() contains a message.

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

References Coordinate().

## nPixelAxes()

virtual uInt casacore::Coordinate::nPixelAxes | ( |  | ) | const

pure virtual

How many world/pixel axes are there in this Coordinate?

While the number of world and pixel axes will generally be the same, it is not a requirement. For example, in CoordinateSystem you could remove a pixel axis and leave the corresponding world axis. Also, if we ever implement a "SlicedCoordinate" class then there would be more world than pixel coordinates (the pixel coordinate would be a pixel number along the slice, whereas the world axes would continue to be RA/DEC).

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## nWorldAxes()

virtual uInt casacore::Coordinate::nWorldAxes | ( |  | ) | const

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## operator=()

Coordinate & casacore::Coordinate::operator= | ( | const Coordinate & | other | ) |

protected

Assignment (copy semantics).

References Coordinate().

## pcToXform()

void casacore::Coordinate::pcToXform | ( | Matrix< Double > & | xForm,
|  | const wcsprm & | wcs ) const

protected

Interconvert between wcs PC cards and Matrix xForm format.

## referencePixel()

virtual Vector< Double > casacore::Coordinate::referencePixel | ( |  | ) | const

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## referenceValue()

virtual Vector< Double > casacore::Coordinate::referenceValue | ( |  | ) | const

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## rotate()

virtual Coordinate * casacore::Coordinate::rotate | ( | const Quantum< Double > & | angle | ) | const

virtual

return the result of rotating the coordinate clockwise through the specified angle.

Rotation occurs about the reference pixel. Coordinate must have exactly two pixel axes. The return type is the same as the input type. It is the caller's responsibility to delete the returned pointer when done with it to prevent a memory leak. This method ultimately just changes the input coordinate's linear transform matrix.

References Coordinate().

## save()

virtual Bool casacore::Coordinate::save | ( | RecordInterface & | container,
|  | const String & | fieldName ) const

pure virtual

Used for persistence.

Derived classes will have similar static restore methods. It will typically only return False if fieldName has already been defined.

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

References casacore::RecordInterface().

## set_error()

void casacore::Coordinate::set_error | ( | const String & | errorMsg | ) | const

protected

Set error message.

## set_wcs()

void casacore::Coordinate::set_wcs | ( | ::wcsprm & | wcs | ) |

static

Call wcsset on the wcs structure.

## setDefaultWorldMixRanges()

virtual void casacore::Coordinate::setDefaultWorldMixRanges | ( |  | ) |

virtual

Reimplemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::QualityCoordinate, and casacore::StokesCoordinate.

## setIncrement()

virtual Bool casacore::Coordinate::setIncrement | ( | const Vector< Double > & | inc | ) |

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## setLinearTransform()

virtual Bool casacore::Coordinate::setLinearTransform | ( | const Matrix< Double > & | xform | ) |

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## setReferencePixel()

virtual Bool casacore::Coordinate::setReferencePixel | ( | const Vector< Double > & | refPix | ) |

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## setReferenceValue()

virtual Bool casacore::Coordinate::setReferenceValue | ( | const Vector< Double > & | refval | ) |

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## setWorldAxisNames()

virtual Bool casacore::Coordinate::setWorldAxisNames | ( | const Vector< String > & | names | ) |

pure virtual

Set the requested attribute.

Note that these just change the internal values, they do not cause any recomputation.

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## setWorldAxisUnits()

virtual Bool casacore::Coordinate::setWorldAxisUnits | ( | const Vector< String > & | units | ) |

pure virtual

Change the units.

Adjust the increment and reference value by the ratio of the old and new units. This implies that the units must be known Unit strings, and that they must be compatible, e.g. they can't change from time to length.

A default implementation is available which does everything except set the units vector, which must be done in the derived class.

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## setWorldMixRanges()

virtual Bool casacore::Coordinate::setWorldMixRanges | ( | const IPosition & | shape | ) |

virtual

Set the world min and max ranges, for use in function toMix, for a lattice of the given shape for this coordinate.

The default implementation here sets the range for pixels dangling 25% off the image. Returns False if fails with a reason in errorMessage(). setDefaultWorldMixRanges sets the range for each axis to +/-1e99 The ranges remain zero length vectors until you explicitly initialize them.

Reimplemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::QualityCoordinate, and casacore::StokesCoordinate.

References casacore::shape().

## showType()

virtual String casacore::Coordinate::showType | ( |  | ) | const

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## sub_wcs()

void casacore::Coordinate::sub_wcs | ( | const ::wcsprm & | src,
|  | int & | nsub,
|  | int | axes[],
|  | ::wcsprm & | dst )

static

Call wcssub on the src/dst pair.

## toCurrentMany()

void casacore::Coordinate::toCurrentMany | ( | Matrix< Double > & | world,
|  | const Vector< Double > & | toCurrentFactors ) const

protected

Functions for handling conversion between the current units and the wcs units.

These are called explicitly by the appropriate derived class. convertFrom

## toMix()

virtual Bool casacore::Coordinate::toMix | ( | Vector< Double > & | worldOut,
|  | Vector< Double > & | pixelOut,
|  | const Vector< Double > & | worldIn,
|  | const Vector< Double > & | pixelIn,
|  | const Vector< Bool > & | worldAxes,
|  | const Vector< Bool > & | pixelAxes,
|  | const Vector< Double > & | worldMin,
|  | const Vector< Double > & | worldMax ) const

virtual

Mixed absolute pixel/world coordinate conversion.

worldIn and worldAxes are vectors of length nWorldAxes. pixelIn and pixelAxes are of length nPixelAxes. worldAxes(i) = True specifies you have given a world value in worldIn(i) to convert to pixel. pixelAxes(i)=True specifies you have given a pixel value in pixelIn(i) to convert to world. You cannot specify the same axis via worldAxes and pixelAxes. Values in pixelIn are converted to world and put into worldOut in the appropriate world axis location. Values in worldIn are copied to worldOut. Values in worldIn are converted to pixel and put into pixelOut in the appropriate pixel axis location. Values in pixelIn are copied to pixelOut. worldMin and worldMax specify the range of the world coordinate (in the world axis units of that world axis in the CoordinateSystem) being solved for in a mixed calculation for each world axis. They are only actually needed for DirectionCoordinates and for all other Coordinates the relevant elements
can be undefined. If you don't know, use -180 to 180 degrees for longitude, and -90 to 90 for latitude. Removed axes are handled (for example, a removed pixel axis with remaining corresponding world axis will correctly be converted to world using the replacement value). Returns True if the conversion succeeds, otherwise it returns False and errorMessage() contains an error message. The output vectors are resized.

Reimplemented in casacore::CoordinateSystem, and casacore::DirectionCoordinate.

## toPixel()

virtual Bool casacore::Coordinate::toPixel | ( | Vector< Double > & | pixel,
|  | const Vector< Double > & | world ) const

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## toPixelMany()

virtual Bool casacore::Coordinate::toPixelMany | ( | Matrix< Double > & | pixel,
|  | const Matrix< Double > & | world,
|  | Vector< Bool > & | failures ) const

virtual

Reimplemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::SpectralCoordinate, and casacore::TabularCoordinate.

## toPixelManyWCS()

Bool casacore::Coordinate::toPixelManyWCS | ( | Matrix< Double > & | pixel,
|  | const Matrix< Double > & | world,
|  | Vector< Bool > & | failures,
|  | wcsprm & | wcs ) const

protected

## toPixelWCS()

Bool casacore::Coordinate::toPixelWCS | ( | Vector< Double > & | pixel,
|  | const Vector< Double > & | world,
|  | wcsprm & | wcs ) const

protected

## toWorld()

virtual Bool casacore::Coordinate::toWorld | ( | Vector< Double > & | world,
|  | const Vector< Double > & | pixel,
|  | Bool | useConversionFrame = True ) const

pure virtual

Convert an absolute pixel position to an absolute world position or vice versa.

Returns True if the conversion succeeds, otherwise it returns False and method errorMessage contains an error message. The input vector must be of length nPixelAxes or nWorldAxes. The output vector is resized appropriately. if useConversionFrame, if the coordinate has a conversion layer frame (such as can be present in spectral and direction coordinates), it is used. Else, the native frame is used for the conversion.

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

References casacore::True.

## toWorldMany()

virtual Bool casacore::Coordinate::toWorldMany | ( | Matrix< Double > & | world,
|  | const Matrix< Double > & | pixel,
|  | Vector< Bool > & | failures ) const

virtual

Batch up a lot of transformations.

The first (most rapidly varying) axis of the matrices contain the coordinates. Returns False if any conversion failed and errorMessage() will hold a message. The failures array (True for fail, False for success) is the length of the number of conversions and holds an error status for each conversion. The default implementation is provided that works with the "single" version of toWorld and toPixel, but for maximum efficiency these should be overridden.

Reimplemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::SpectralCoordinate, and casacore::TabularCoordinate.

## toWorldManyWCS()

Bool casacore::Coordinate::toWorldManyWCS | ( | Matrix< Double > & | world,
|  | const Matrix< Double > & | pixel,
|  | Vector< Bool > & | failures,
|  | wcsprm & | wcs ) const

protected

## toWorldWCS()

Bool casacore::Coordinate::toWorldWCS | ( | Vector< Double > & | world,
|  | const Vector< Double > & | pixel,
|  | wcsprm & | wcs ) const

protected

Functions to interconvert pixel<->world via wcs.

These functions are called explicitly by the to{world,Pixel} functions in the appropriate wcs-based derived classes.

## type()

virtual Type casacore::Coordinate::type | ( |  | ) | const

pure virtual

List the type of this Coordinate object.

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

Referenced by fourierUnits(), and typeToString().

## typeToString()

String casacore::Coordinate::typeToString | ( | Coordinate::Type | type | ) |

static

References type().

## worldAxisNames()

virtual Vector< String > casacore::Coordinate::worldAxisNames | ( |  | ) | const

pure virtual

Return the requested attributed.

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## worldAxisUnits()

virtual Vector< String > casacore::Coordinate::worldAxisUnits | ( |  | ) | const

pure virtual

Implemented in casacore::CoordinateSystem, casacore::DirectionCoordinate, casacore::LinearCoordinate, casacore::QualityCoordinate, casacore::SpectralCoordinate, casacore::StokesCoordinate, and casacore::TabularCoordinate.

## worldMixMax()

Vector< Double > casacore::Coordinate::worldMixMax | ( |  | ) | const

inline

Definition at line 262 of file Coordinate.h.

References worldMax_p.

## worldMixMin()

Vector< Double > casacore::Coordinate::worldMixMin | ( |  | ) | const

inline

Definition at line 261 of file Coordinate.h.

References worldMin_p.

## xFormToPC()

void casacore::Coordinate::xFormToPC | ( | wcsprm & | wcs,
|  | const Matrix< Double > & | xForm ) const

protected

## Member Data Documentation

## error_p

String casacore::Coordinate::error_p

mutable private

Definition at line 567 of file Coordinate.h.

Referenced by errorMessage().

## worldMax_p

Vector<Double> casacore::Coordinate::worldMax_p

protected

Definition at line 564 of file Coordinate.h.

Referenced by worldMixMax().

## worldMin_p

Vector<Double> casacore::Coordinate::worldMin_p

protected

toMix ranges.

Should be set by derived class.

Definition at line 564 of file Coordinate.h.

Referenced by worldMixMin().

The documentation for this class was generated from the following file:

- coordinates/Coordinates/Coordinate.h