casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::StokesCoordinate Class Reference

Interconvert between pixel and Stokes value. More...

#include <StokesCoordinate.h>

Inheritance diagram for casacore::StokesCoordinate:
casacore::Coordinate

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. More...
 
 StokesCoordinate (const StokesCoordinate &other)
 Copy constructor (copy semantics) More...
 
StokesCoordinateoperator= (const StokesCoordinate &other)
 Assignment (copy semantics) More...
 
virtual ~StokesCoordinate ()
 Destructor. More...
 
virtual Coordinate::Type type () const
 Returns Coordinates::STOKES. More...
 
virtual String showType () const
 Always returns the String "Stokes". More...
 
virtual uInt nPixelAxes () const
 Always returns 1. More...
 
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. More...
 
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. More...
 
Bool toWorld (Stokes::StokesTypes &stokes, Int pixel) const
 
virtual void makePixelRelative (Vector< Double > &pixel) const
 Make absolute coordinates relative and vice-versa. More...
 
virtual void makePixelAbsolute (Vector< Double > &pixel) const
 
virtual void makeWorldRelative (Vector< Double > &world) const
 
virtual void makeWorldAbsolute (Vector< Double > &world) const
 
Vector< Intstokes () const
 Get the Stokes values (Stokes::StokesType) that we constructed with into a vector. More...
 
Vector< StringstokesStrings () const
 Get the stokes string representations. More...
 
void setStokes (const Vector< Int > &whichStokes)
 Set a new vector of Stokes values (a vector of Stokes::StokesType) More...
 
virtual Vector< StringworldAxisNames () const
 Report the value of the requested attribute. More...
 
virtual Vector< DoublereferencePixel () const
 
virtual Matrix< DoublelinearTransform () const
 
virtual Vector< Doubleincrement () const
 
virtual Vector< DoublereferenceValue () const
 
virtual Bool setWorldAxisNames (const Vector< String > &names)
 Set the value of the requested attribute. More...
 
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. More...
 
virtual Vector< StringworldAxisUnits () 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). More...
 
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. More...
 
virtual Bool near (const Coordinate &other, Double tol=1e-6) const
 Comparison function. More...
 
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. More...
 
virtual Coordinateclone () const
 Make a copy of the StokesCoordinate using new. More...
 
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. More...
 
- Public Member Functions inherited from casacore::Coordinate
virtual ~Coordinate ()
 Destructor. More...
 
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. More...
 
Vector< DoubleworldMixMin () const
 
Vector< DoubleworldMixMax () const
 
virtual Bool toWorldMany (Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures) const
 Batch up a lot of transformations. More...
 
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. More...
 
virtual void makePixelRelativeMany (Matrix< Double > &pixel) const
 Batch up a lot of absolute/relative transformations. More...
 
virtual void makePixelAbsoluteMany (Matrix< Double > &pixel) const
 
virtual void makeWorldRelativeMany (Matrix< Double > &world) const
 
virtual void makeWorldAbsoluteMany (Matrix< Double > &world) const
 
virtual CoordinatemakeFourierCoordinate (const Vector< Bool > &axes, const Vector< Int > &shape) const
 Find the Coordinate for when we Fourier Transform ourselves. More...
 
const StringerrorMessage () const
 If the last conversion to world or pixel coordinates resulted in an error, report that error. More...
 
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. More...
 
String formatQuantity (String &units, Coordinate::formatType format, const Quantum< Double > &worldValue, uInt axis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1)
 
virtual Coordinaterotate (const Quantum< Double > &angle) const
 return the result of rotating the coordinate clockwise through the specified angle. More...
 

Static Public Member Functions

static Double toWorld (Stokes::StokesTypes stokes)
 Interconvert between world stored as a Double and world stored as a Stokes type. More...
 
static Stokes::StokesTypes toWorld (Double world)
 
static StokesCoordinaterestore (const RecordInterface &container, const String &fieldName)
 Recover the StokesCoordinate from a record. More...
 
- 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. More...
 
static void init_wcs (::wcsprm &wcs, int naxis)
 Call wcsini on the wcs structure. More...
 
static void sub_wcs (const ::wcsprm &src, int &nsub, int axes[],::wcsprm &dst)
 Call wcssub on the src/dst pair. More...
 
static void copy_wcs (const ::wcsprm &src,::wcsprm &dst)
 Call wcssub on the src/dst pair with null nsub/axes. More...
 

Private Member Functions

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

Private Attributes

Block< Intvalues_p
 
Double crval_p
 Keep these for subimaging purposes. More...
 
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. More...
 
 Coordinate (const Coordinate &other)
 Copy constructor (copy semantics) More...
 
Coordinateoperator= (const Coordinate &other)
 Assignment (copy semantics) More...
 
void set_error (const String &errorMsg) const
 Set error message. More...
 
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. More...
 
Bool toWorldWCS (Vector< Double > &world, const Vector< Double > &pixel, wcsprm &wcs) const
 Functions to interconvert pixel<->world via wcs. More...
 
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. More...
 
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. More...
 
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. More...
 
void convertFromMany (Matrix< Double > &world) const
 
void pcToXform (Matrix< Double > &xForm, const wcsprm &wcs) const
 Interconvert between wcs PC cards and Matrix xForm format. More...
 
void xFormToPC (wcsprm &wcs, const Matrix< Double > &xForm) const
 
- Protected Attributes inherited from casacore::Coordinate
Vector< DoubleworldMin_p
 toMix ranges. More...
 
Vector< DoubleworldMax_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

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;

Motivation

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

To Do

Definition at line 105 of file StokesCoordinate.h.

Constructor & Destructor Documentation

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".

casacore::StokesCoordinate::StokesCoordinate ( const StokesCoordinate other)

Copy constructor (copy semantics)

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

Destructor.

casacore::StokesCoordinate::StokesCoordinate ( )
private

Undefined and inaccessible.

Member Function Documentation

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.

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.

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.

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

Implements casacore::Coordinate.

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

Implements casacore::Coordinate.

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

Reimplemented from casacore::Coordinate.

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.

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

Reimplemented from casacore::Coordinate.

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

Reimplemented from casacore::Coordinate.

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.

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

Implements casacore::Coordinate.

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

Always returns 1.

Implements casacore::Coordinate.

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

Implements casacore::Coordinate.

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

Assignment (copy semantics)

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

Implements casacore::Coordinate.

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

Implements casacore::Coordinate.

static 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.

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.

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

Reimplemented from casacore::Coordinate.

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

Implements casacore::Coordinate.

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

Implements casacore::Coordinate.

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

Implements casacore::Coordinate.

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

Implements casacore::Coordinate.

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

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

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.

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.

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.

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

Always returns the String "Stokes".

Implements casacore::Coordinate.

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

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

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

Get the stokes string representations.

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

Implements casacore::Coordinate.

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.

Bool casacore::StokesCoordinate::toPixel ( Double pixel,
const Double  world 
) const
private
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.

Bool casacore::StokesCoordinate::toWorld ( Stokes::StokesTypes stokes,
Int  pixel 
) const
static 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.

static Stokes::StokesTypes casacore::StokesCoordinate::toWorld ( Double  world)
static
Bool casacore::StokesCoordinate::toWorld ( Double world,
const Double  pixel 
) const
private
virtual Coordinate::Type casacore::StokesCoordinate::type ( ) const
virtual

Returns Coordinates::STOKES.

Implements casacore::Coordinate.

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

Report the value of the requested attribute.

Implements casacore::Coordinate.

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

Implements casacore::Coordinate.

Member Data Documentation

Double casacore::StokesCoordinate::cdelt_p
private

Definition at line 288 of file StokesCoordinate.h.

Double casacore::StokesCoordinate::crpix_p
private

Definition at line 288 of file StokesCoordinate.h.

Double casacore::StokesCoordinate::crval_p
private

Keep these for subimaging purposes.

Definition at line 288 of file StokesCoordinate.h.

Double casacore::StokesCoordinate::matrix_p
private

Definition at line 288 of file StokesCoordinate.h.

String casacore::StokesCoordinate::name_p
private

Definition at line 289 of file StokesCoordinate.h.

Int casacore::StokesCoordinate::nValues_p
private

Definition at line 291 of file StokesCoordinate.h.

String casacore::StokesCoordinate::unit_p
private

Definition at line 290 of file StokesCoordinate.h.

Block<Int> casacore::StokesCoordinate::values_p
private

Definition at line 285 of file StokesCoordinate.h.


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