casa
5.7.0-16
|
Interconvert between pixel and Stokes value. 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. More... | |
StokesCoordinate (const StokesCoordinate &other) | |
Copy constructor (copy semantics) More... | |
StokesCoordinate & | operator= (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< Int > | stokes () const |
Get the Stokes values (Stokes::StokesType) that we constructed with into a vector. More... | |
Vector< String > | stokesStrings () 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< String > | worldAxisNames () const |
Report the value of the requested attribute. More... | |
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. 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< 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). 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 Coordinate * | clone () 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< 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. 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 Coordinate * | makeFourierCoordinate (const Vector< Bool > &axes, const Vector< Int > &shape) const |
Find the Coordinate for when we Fourier Transform ourselves. More... | |
const String & | errorMessage () 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 Coordinate * | rotate (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 StokesCoordinate * | restore (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< Int > | values_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... | |
Coordinate & | operator= (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< Double > | worldMin_p |
toMix ranges. More... | |
Vector< Double > | worldMax_p |
Interconvert between pixel and Stokes value.
Public interface
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;
In this example we create a StokesCoordinate housing IQUV
It is conventional to make a pseudo-axis of Stokes parameters. Another approach is to make an image type called Stokes.
Definition at line 105 of file StokesCoordinate.h.
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 |
Destructor.
|
private |
Undefined and inaccessible.
|
virtual |
Make a copy of the StokesCoordinate using new.
The caller is responsible for calling delete.
Implements casacore::Coordinate.
|
virtual |
Comparison only made for specified axes in this and other Coordinate.
Reimplemented from casacore::Coordinate.
|
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.
Implements casacore::Coordinate.
Implements casacore::Coordinate.
|
virtual |
Reimplemented from casacore::Coordinate.
|
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 |
Reimplemented from casacore::Coordinate.
|
virtual |
Reimplemented from casacore::Coordinate.
|
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 |
Implements casacore::Coordinate.
|
virtual |
Always returns 1.
Implements casacore::Coordinate.
|
virtual |
Implements casacore::Coordinate.
StokesCoordinate& casacore::StokesCoordinate::operator= | ( | const StokesCoordinate & | other | ) |
Assignment (copy semantics)
Implements casacore::Coordinate.
Implements casacore::Coordinate.
|
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 |
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 |
Reimplemented from casacore::Coordinate.
Implements casacore::Coordinate.
|
virtual |
Implements casacore::Coordinate.
|
virtual |
Implements casacore::Coordinate.
|
virtual |
Implements casacore::Coordinate.
Set a new vector of Stokes values (a vector of Stokes::StokesType)
|
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 |
The set function has no effect as the units must be empty for a StokesCoordinate Always returns True.
Implements casacore::Coordinate.
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 |
Always returns the String "Stokes".
Implements casacore::Coordinate.
Get the Stokes values (Stokes::StokesType) that we constructed with into a vector.
Get the stokes string representations.
|
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.
|
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 |
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 |
|
virtual |
Returns Coordinates::STOKES.
Implements casacore::Coordinate.
Report the value of the requested attribute.
Implements casacore::Coordinate.
Implements casacore::Coordinate.
|
private |
Definition at line 288 of file StokesCoordinate.h.
|
private |
Definition at line 288 of file StokesCoordinate.h.
|
private |
Keep these for subimaging purposes.
Definition at line 288 of file StokesCoordinate.h.
|
private |
Definition at line 288 of file StokesCoordinate.h.
|
private |
Definition at line 289 of file StokesCoordinate.h.
|
private |
Definition at line 291 of file StokesCoordinate.h.
|
private |
Definition at line 290 of file StokesCoordinate.h.
Definition at line 285 of file StokesCoordinate.h.