Loading...
Searching...
No Matches
casacore::StokesCoordinate Class Reference
coordinates package (libcasa_coordinates) » Coordinates_module

More...

`#include <StokesCoordinate.h>`

## Public Member Functions

| StokesCoordinate (const Vector< Int > &whichStokes)
| The length of whichStokes is the length of the axis, and the values define which stokes are in which axis value.
| StokesCoordinate (const StokesCoordinate &other)
| Copy constructor (copy semantics).
StokesCoordinate & | operator= (const StokesCoordinate &other)
| Assignment (copy semantics).
virtual | ~StokesCoordinate ()
| Destructor.
virtual Coordinate::Type | type () const
| Returns Coordinates::STOKES.
virtual String | showType () const
| Always returns the String "Stokes".
virtual uInt | nPixelAxes () const
| Always returns 1.
virtual uInt | nWorldAxes () const
virtual Bool | toWorld (Vector< Double > &world, const Vector< Double > &pixel, Bool=True) const
| Convert a pixel to a world coordinate or vice versa.
virtual Bool | toPixel (Vector< Double > &pixel, const Vector< Double > &world) const
Bool | toPixel (Int &pixel, Stokes::StokesTypes stokes) const
| Interconvert between pixel and world as a Stokes type.
Bool | toWorld (Stokes::StokesTypes &stokes, Int pixel) const
virtual void | makePixelRelative (Vector< Double > &pixel) const
| Make absolute coordinates relative and vice-versa.
virtual void | makePixelAbsolute (Vector< Double > &pixel) const
virtual void | makeWorldRelative (Vector< Double > &world) const
virtual void | makeWorldAbsolute (Vector< Double > &world) const
Vector< Int > | stokes () const
| Get the Stokes values (Stokes::StokesType) that we constructed with into a vector.
Vector< String > | stokesStrings () const
| Get the stokes string representations.
void | setStokes (const Vector< Int > &whichStokes)
| Set a new vector of Stokes values (a vector of Stokes::StokesType).
virtual Vector< String > | worldAxisNames () const
| Report the value of the requested attribute.
virtual Vector< Double > | referencePixel () const
virtual Matrix< Double > | linearTransform () const
virtual Vector< Double > | increment () const
virtual Vector< Double > | referenceValue () const
virtual Bool | setWorldAxisNames (const Vector< String > &names)
| Set the value of the requested attribute.
virtual Bool | setReferencePixel (const Vector< Double > &refPix)
virtual Bool | setLinearTransform (const Matrix< Double > &xform)
virtual Bool | setIncrement (const Vector< Double > &inc)
virtual Bool | setReferenceValue (const Vector< Double > &refval)
virtual Bool | setWorldAxisUnits (const Vector< String > &units)
| The set function has no effect as the units must be empty for a StokesCoordinate Always returns True.
virtual Vector< String > | worldAxisUnits () const
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 ()
virtual String | format (String &units, Coordinate::formatType format, Double worldValue, uInt worldAxis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1, Bool usePrecForMixed=False) const
| Format a StokesCoordinate world value with the common format interface (refer to the base class Coordinate for basics.
virtual Bool | near (const Coordinate &other, Double tol=1e-6) const
| Comparison function.
virtual Bool | near (const Coordinate &other, const Vector< Int > &excludeAxes, Double tol=1e-6) const
virtual Bool | save (RecordInterface &container, const String &fieldName) const
| Save the StokesCoordinate into the supplied record using the supplied field name.
virtual Coordinate * | clone () const
| Make a copy of the StokesCoordinate using new.
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.
Public Member Functions inherited from casacore::Coordinate
virtual | ~Coordinate ()
| Destructor.
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.
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 | 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 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 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.
String | formatQuantity (String &units, Coordinate::formatType format, const Quantum< Double > &worldValue, uInt axis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1)
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 Double | toWorld (Stokes::StokesTypes stokes)
| Interconvert between world stored as a Double and world stored as a Stokes type.
static Stokes::StokesTypes | toWorld (Double world)
static StokesCoordinate * | restore (const RecordInterface &container, const String &fieldName)
| Recover the StokesCoordinate from a record.
Static Public Member Functions inherited from casacore::Coordinate
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.

## Private Member Functions

Bool | toWorld (Double &world, const Double pixel) const
Bool | toPixel (Double &pixel, const Double world) const
| StokesCoordinate ()
| Undefined and inaccessible.

## Private Attributes

Block< Int > | values_p
Double | crval_p
| Keep these for subimaging purposes.
Double | crpix_p
Double | matrix_p
Double | cdelt_p
String | name_p
String | unit_p
Int | nValues_p

## Additional Inherited Members

Public Types inherited from casacore::Coordinate
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...
Protected Member Functions inherited from casacore::Coordinate
| 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 inherited from casacore::Coordinate
Vector< Double > | worldMin_p
| toMix ranges.
Vector< Double > | worldMax_p

## Detailed Description

Interconvert between pixel and Stokes value.

### Intended use:

Public interface

### Review Status

Reviewed By:
  Peter Barnes
Date Reviewed:
  1999/12/24
Test programs:
  tStokesCoordinate

### Prerequisite

- Coordinate
- Stokes

### Synopsis

Although not really a "coordinate", an axis where pixel numbers are used for different Stokes values is in wide use. The StokesCoordinate is a poor fit to the Coordinate polymorphic model. You will probably find that if you try to use the Coordinate classes polymorphically, that StokesCoordinate will cause you to break the polymorphism. I.e. you may have to deal with a specific StokesCoordinate)

The StokesCoordinate just maintains a list (given in the constructor) of possibly non-monotonic Stokes values. The values of the list are the world values (they are values from the Stokes::StokesTypes enum). Thus world = list[pixel] where pixel is the pixel coordinate (0,1,...)

This means that concepts such as reference pixel, reference value, increment etc are meaningless for StokesCoordinate. You can recover these these attributes, but the functions to set these attributes have no effect.

Note also that for the StokesCoordinate relative world coordinates are defined to be the as absolute, since there is no meaning for a relative Stokes world value (e.g. what is XX -RL ?? Relative pixel coordinates are defined.

Caution: All pixel coordinates are zero relative;

### Example

In this example we create a StokesCoordinate housing IQUV

Vector<Int> iquv(4);
iquv(0) = Stokes::I; iquv(1) = Stokes::Q;
iquv(2) = Stokes::U; iquv(3) = Stokes::V;
StokesCoordinate stokes(iquv);
casacore::StokesCoordinate::stokes
Vector< Int > stokes() const
Get the Stokes values (Stokes::StokesType) that we constructed with into a vector.
casacore::StokesCoordinate::StokesCoordinate
StokesCoordinate(const Vector< Int > &whichStokes)
The length of whichStokes is the length of the axis, and the values define which stokes are in which ...
casacore::Stokes::U
@ U
Definition Stokes.h:69
casacore::Stokes::I
@ I
Definition Stokes.h:67
casacore::Stokes::Q
@ Q
Definition Stokes.h:68
casacore::Stokes::V
@ V
standard stokes parameters
Definition Stokes.h:71
casacore::Vector
Definition Vector.h:82

### Motivation

It is conventional to make a pseudo-axis of Stokes parameters. Another approach is to make an image type called Stokes.

### To Do

- This could probably be generalized into an "enumeration axis" class.

Definition at line 102 of file StokesCoordinate.h.

## Constructor & Destructor Documentation

## StokesCoordinate() [1/3]

casacore::StokesCoordinate::StokesCoordinate | ( | const Vector< Int > & | whichStokes | ) |

explicit

The length of whichStokes is the length of the axis, and the values define which stokes are in which axis value.

Often the vector will be of length 4 and will contain Stokes::I, Q, U and V, however any valid value from the stokes enum may be used. The values may not repeat however, e.g. only one axis position may contain "I".

Referenced by operator=(), restore(), and StokesCoordinate().

## StokesCoordinate() [2/3]

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

Copy constructor (copy semantics).

References StokesCoordinate().

## ~StokesCoordinate()

virtual casacore::StokesCoordinate::~StokesCoordinate | ( |  | ) |

virtual

Destructor.

## StokesCoordinate() [3/3]

casacore::StokesCoordinate::StokesCoordinate | ( |  | ) |

private

Undefined and inaccessible.

## Member Function Documentation

## clone()

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

virtual

Make a copy of the StokesCoordinate using new.

The caller is responsible for calling delete.

Implements casacore::Coordinate.

References casacore::Coordinate::Coordinate().

## doNearPixel()

virtual Bool casacore::StokesCoordinate::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.

Reimplemented from casacore::Coordinate.

References casacore::Coordinate::Coordinate().

## format()

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

virtual

Format a StokesCoordinate world value with the common format interface (refer to the base class Coordinate for basics.

A StokesCoordinate is formatted differently from other Coordinate types. The world value is converted to the character representation as defined by the enum StokesTypes in the class Stokes.

Thus, all other arguments to do with formatting and precision are ignored.

Reimplemented from casacore::Coordinate.

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

Referenced by format().

## increment()

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

virtual

Implements casacore::Coordinate.

## linearTransform()

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

virtual

Implements casacore::Coordinate.

## makePixelAbsolute()

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

virtual

Reimplemented from casacore::Coordinate.

## makePixelRelative()

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

virtual

Make absolute coordinates relative and vice-versa.

For the StokesCoordinate relative world coordinates are defined to be the same as absolute world coordinates. Relative pixels do have meaning and are implemented (rel = abs - refPix)

Reimplemented from casacore::Coordinate.

## makeWorldAbsolute()

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

virtual

Reimplemented from casacore::Coordinate.

## makeWorldRelative()

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

virtual

Reimplemented from casacore::Coordinate.

## near() [1/2]

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

virtual

Implements casacore::Coordinate.

References casacore::Coordinate::Coordinate().

## near() [2/2]

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

virtual

Comparison function.

Any private Double data members are compared
with the specified fractional tolerance. Don't compare on the specified
axes in the Coordinate. If the comparison returns False, method errorMessage returns a message about why.

Implements casacore::Coordinate.

References casacore::Coordinate::Coordinate().

## nPixelAxes()

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

virtual

Always returns 1.

Implements casacore::Coordinate.

## nWorldAxes()

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

virtual

Implements casacore::Coordinate.

## operator=()

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

Assignment (copy semantics).

References StokesCoordinate().

## referencePixel()

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

virtual

Implements casacore::Coordinate.

## referenceValue()

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

virtual

Implements casacore::Coordinate.

## restore()

StokesCoordinate * casacore::StokesCoordinate::restore | ( | const RecordInterface & | container,
|  | const String & | fieldName )

static

Recover the StokesCoordinate from a record.

A null pointer means that the restoration did not succeed - probably because fieldName doesn't exist or doesn't contain a CoordinateSystem.

References casacore::RecordInterface(), and StokesCoordinate().

## save()

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

virtual

Save the StokesCoordinate into the supplied record using the supplied field name.

The field must not exist, otherwise False is returned.

Implements casacore::Coordinate.

References casacore::RecordInterface().

## setDefaultWorldMixRanges()

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

virtual

Reimplemented from casacore::Coordinate.

## setIncrement()

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

virtual

Implements casacore::Coordinate.

## setLinearTransform()

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

virtual

Implements casacore::Coordinate.

## setReferencePixel()

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

virtual

Implements casacore::Coordinate.

## setReferenceValue()

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

virtual

Implements casacore::Coordinate.

## setStokes()

void casacore::StokesCoordinate::setStokes | ( | const Vector< Int > & | whichStokes | ) |

Set a new vector of Stokes values (a vector of Stokes::StokesType).

## setWorldAxisNames()

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

virtual

Set the value of the requested attribute.

For the StokesCoordinate, these have no effect (always return True) except for setWorldAxisNames.

Implements casacore::Coordinate.

## setWorldAxisUnits()

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

virtual

The set function has no effect as the units must be empty for a StokesCoordinate Always returns True.

Implements casacore::Coordinate.

## setWorldMixRanges()

virtual Bool casacore::StokesCoordinate::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 implementation here gives world coordinates at the start and end of the Stokes axis. The output vectors are resized. Returns False if fails (and then setDefaultWorldMixRanges generates the ranges) with a reason in errorMessage(). The setDefaultWorldMixRanges function gives you [-1e99->1e99].

Reimplemented from casacore::Coordinate.

References casacore::shape().

## showType()

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

virtual

Always returns the String "Stokes".

Implements casacore::Coordinate.

## stokes()

Vector< Int > casacore::StokesCoordinate::stokes | ( |  | ) | const

Get the Stokes values (Stokes::StokesType) that we constructed with into a vector.

Referenced by toPixel(), toWorld(), and toWorld().

## stokesStrings()

Vector< String > casacore::StokesCoordinate::stokesStrings | ( |  | ) | const

Get the stokes string representations.

## toPixel() [1/3]

Bool casacore::StokesCoordinate::toPixel | ( | Double & | pixel,
|  | const Double | world ) const

private

## toPixel() [2/3]

Bool casacore::StokesCoordinate::toPixel | ( | Int & | pixel,
|  | Stokes::StokesTypes | stokes ) const

Interconvert between pixel and world as a Stokes type.

It returns False if no conversion could be done.

References stokes().

## toPixel() [3/3]

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

virtual

Implements casacore::Coordinate.

## toWorld() [1/5]

Bool casacore::StokesCoordinate::toWorld | ( | Double & | world,
|  | const Double | pixel ) const

private

## toWorld() [2/5]

Stokes::StokesTypes casacore::StokesCoordinate::toWorld | ( | Double | world | ) |

static

## toWorld() [3/5]

Bool casacore::StokesCoordinate::toWorld | ( | Stokes::StokesTypes & | stokes,
|  | Int | pixel ) const

References stokes().

## toWorld() [4/5]

Double casacore::StokesCoordinate::toWorld | ( | Stokes::StokesTypes | stokes | ) |

static

Interconvert between world stored as a Double and world stored as a Stokes type.

Since these functions are static, any valid Stokes type can be used. The second function returns Stokes::Undefined if world is illegal.

References stokes().

## toWorld() [5/5]

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

virtual

Convert a pixel to a world coordinate or vice versa.

Returns True if the conversion succeeds, otherwise it returns False and method errorMessage returns an error message. The output vectors are appropriately resized before use. The Bool parameter in toWorld() is ignored as this coordinate does not support a conversion layer frame.

Implements casacore::Coordinate.

References casacore::True.

## type()

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

virtual

Returns Coordinates::STOKES.

Implements casacore::Coordinate.

## worldAxisNames()

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

virtual

Report the value of the requested attribute.

Implements casacore::Coordinate.

## worldAxisUnits()

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

virtual

Implements casacore::Coordinate.

## Member Data Documentation

## cdelt_p

Double casacore::StokesCoordinate::cdelt_p

private

Definition at line 285 of file StokesCoordinate.h.

## crpix_p

Double casacore::StokesCoordinate::crpix_p

private

Definition at line 285 of file StokesCoordinate.h.

## crval_p

Double casacore::StokesCoordinate::crval_p

private

Keep these for subimaging purposes.

Definition at line 285 of file StokesCoordinate.h.

## matrix_p

Double casacore::StokesCoordinate::matrix_p

private

Definition at line 285 of file StokesCoordinate.h.

## name_p

String casacore::StokesCoordinate::name_p

private

Definition at line 286 of file StokesCoordinate.h.

## nValues_p

Int casacore::StokesCoordinate::nValues_p

private

Definition at line 288 of file StokesCoordinate.h.

## unit_p

String casacore::StokesCoordinate::unit_p

private

Definition at line 287 of file StokesCoordinate.h.

## values_p

Block<Int> casacore::StokesCoordinate::values_p

private

Definition at line 282 of file StokesCoordinate.h.

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

- coordinates/Coordinates/StokesCoordinate.h