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

Functions for creating default CoordinateSystems. More...

#include <CoordinateUtil.h>

Static Public Member Functions

static void addDirAxes (CoordinateSystem &coords)
 Add a RA/DEC pair of direction axes (ie. More...
 
static void addIQUVAxis (CoordinateSystem &coords)
 Add a Stokes I,Q,U,V axis to the user supplied CoordinateSystem. More...
 
static void addIAxis (CoordinateSystem &coords)
 Add a Stokes I (only) axis to the user supplied CoordinateSystem. More...
 
static Bool addStokesAxis (CoordinateSystem &coords, uInt shape)
 Add a Stokes axis of length 1 to 4 selected from I,Q,U,V E.g. More...
 
static void addLinearAxes (CoordinateSystem &coords, const Vector< String > &names, const IPosition &shape)
 Add Linear axes. More...
 
static void addFreqAxis (CoordinateSystem &coords)
 Add a spectral axis to the user supplied CoordinateSystem. More...
 
static uInt addAxes (CoordinateSystem &csys, Bool direction, Bool spectral, const String &stokes, Bool linear, Bool tabular, Bool silent=False)
 Add one axis for each of the specified coordinate types. More...
 
static CoordinateSystem defaultCoords2D ()
 Return a 2-dimensional coordinate system with RA/DEC axes only. More...
 
static CoordinateSystem defaultCoords3D ()
 Return a 3-dimensional coordinate system with RA/DEC axes and a spectral axis. More...
 
static CoordinateSystem defaultCoords4D ()
 Return a 4-dimensional coordinate system with RA/DEC axes, an IQUV polarisation axis and a spectral axis. More...
 
static CoordinateSystem defaultCoords (uInt dims)
 Calls one of the above three functions depending of the arguement. More...
 
static CoordinateSystem makeCoordinateSystem (const IPosition &shape, Bool doLinear=False)
 If doLinear=False, Tries to make a standard RA/DEC/Stokes/Frequency CoordinateSystem depending upon the shape. More...
 
static Int findSpectralAxis (const CoordinateSystem &coords)
 Find which pixel axis in the CoordinateSystem corresponds to the SpectralCoordinate. More...
 
static void findSpectralAxis (Int &pixelAxis, Int &worldAxis, Int &coordinate, const CoordinateSystem &coords)
 Find the SpectralCoordinate in the CoordinateSystem, and then return the most general description of where it is. More...
 
static Vector< IntfindDirectionAxes (const CoordinateSystem &coords)
 Find which pixel axes correspond to the DirectionCoordinate in the supplied coordinate system and return this as a Vector. More...
 
static void findDirectionAxes (Vector< Int > &pixelAxes, Vector< Int > &worldAxes, Int &coordinate, const CoordinateSystem &coords)
 Find which pixel axes correspond to the DirectionCoordinate in the supplied coordinate system and return the most general description of where it is. More...
 
static Int findStokesAxis (Vector< Stokes::StokesTypes > &whichPols, const CoordinateSystem &coords)
 Find which pixel axis is the polarisation axis in the supplied CoordinateSystem and return this. More...
 
static void findStokesAxis (Int &pixelAxis, Int &worldAxis, Int &coordinate, const CoordinateSystem &coords)
 Find the StokesCoordinate in the CoordinateSystem, and then return the most general description of where it is. More...
 
static Coordinate::Type findPixelAxis (const CoordinateSystem &cSys, Int axis)
 Find Coordinate type for this pixel or world axis. More...
 
static Coordinate::Type findWorldAxis (const CoordinateSystem &cSys, Int axis)
 
static Bool removeAxes (CoordinateSystem &cSys, Vector< Double > &worldReplacement, const Vector< Int > &worldAxes, const Bool remove)
 Remove a list of world axes and their associated pixel axes from a CoordinateSystem. More...
 
static Bool removePixelAxes (CoordinateSystem &cSys, Vector< Double > &pixelReplacement, const Vector< Int > &pixelAxes, const Bool remove)
 Remove a list of pixel axes but not their associated world axes from a CoordinateSystem. More...
 
static Bool dropRemovedAxes (CoordinateSystem &cSysOut, const CoordinateSystem &cSysIn, Bool preserveAxesOrder=False)
 Physically (nont just virtually) drop coordinates from the CoordinateSystem if all axes are fully removed. More...
 
static Bool makeDirectionMachine (LogIO &os, MDirection::Convert &machine, const DirectionCoordinate &dirCoordTo, const DirectionCoordinate &dirCoordFrom, const ObsInfo &obsTo, const ObsInfo &obsFrom)
 Setup Measures conversion machine for MDirections. More...
 
static Bool makeFrequencyMachine (LogIO &os, MFrequency::Convert &machine, Int coordinateTo, Int coordinateFrom, const CoordinateSystem &coordsTo, const CoordinateSystem &coordsFrom, const Unit &unit=Unit(String("Hz")))
 Setup Measures conversion machines for MFrequencies. More...
 
static Bool makeFrequencyMachine (LogIO &os, MFrequency::Convert &machine, MFrequency::Types typeTo, MFrequency::Types typeFrom, const MDirection &dirTo, const MDirection &dirFrom, const MEpoch &epochTo, const MEpoch &epochFrom, const MPosition &posTo, const MPosition &posFrom, const Unit &unit=Unit(String("Hz")))
 Setup Measures conversion machines for MFrequencies. More...
 
static Bool findSky (String &errorMessage, Int &dirCoord, Vector< Int > &pixelAxes, Vector< Int > &worldAxes, const CoordinateSystem &cSys)
 Find the Sky in the CoordinateSystem. More...
 
static Bool holdsSky (Bool &holdsOneSkyAxis, const CoordinateSystem &cSys, Vector< Int > pixelAxes)
 Do the specified axes hold the sky ? Returns False if no DirectionCoordinate or if only one axis of the DirectionCoordinate is held or the specified pixel axes don't pertain to the DirectionCoordinate. More...
 
static Stokes::StokesTypes findSingleStokes (LogIO &os, const CoordinateSystem &cSys, uInt pixel=0)
 Find the Stokes for the specified pixel. More...
 
static void setNiceAxisLabelUnits (CoordinateSystem &cSys)
 Set the world axis units in the CS to 'deg' for Direction. More...
 
static Bool setCoordinateUnits (CoordinateSystem &cSys, const Vector< String > &units, uInt which)
 Set world axis units for specific Coordinate. More...
 
static Bool setDirectionUnit (CoordinateSystem &cSys, const String &unit, Int which=-1)
 Set a unit for all unremoved world axes in the DirectionCoordinate in the CS. More...
 
static Bool setDirectionConversion (String &errorMsg, CoordinateSystem &cSys, const String directionSystem)
 Set Direction conversion layer of DirectionCoordinate in CoordinateSystem so that pixel<->world go to the specified direction system (a valid MDirection::Types string). More...
 
static Bool setSpectralState (String &errorMsg, CoordinateSystem &cSys, const String &unit, const String &spcquant)
 Set spectral state of SpectralCoordinate in CoordinateSystem. More...
 
static Bool setVelocityState (String &errorMsg, CoordinateSystem &cSys, const String &unit, const String &spcquant)
 Set velocity state of SpectralCoordinate in CoordinateSystem. More...
 
static Bool isSky (LogIO &os, const CoordinateSystem &cSys)
 Does the CoordinateSystem hold just the sky? Returns True if CS pixel axis 0 is the longitude and 1 latitude else returns False. More...
 
static Bool setRestFrequency (String &errorMsg, CoordinateSystem &cSys, const String &unit, const Double &value)
 Set rest frequency of SpectralCoordinate in CoordinateSystem. More...
 
static Bool setSpectralConversion (String &errorMsg, CoordinateSystem &cSys, const String frequencySystem)
 Set Spectral conversion layer of SpectralCoordinate in CoordinateSystem so that pixel<->world go to the specified frequency system (a valid MFrequency::Types string). More...
 
static Bool setSpectralFormatting (String &errorMsg, CoordinateSystem &cSys, const String &unit, const String &spcquant)
 Set default format unit and doppler velocity state of SpectralCoordinate in CoordinateSystem. More...
 
static String formatCoordinate (const IPosition &pixel, const CoordinateSystem &cSys, Int precision=-1)
 Convert an absolute pixel coordinate to world and format with default Coordinate formatting. More...
 
static String formatCoordinate (const Vector< Double > &pixel, const CoordinateSystem &cSys, Int precision=-1)
 
static String axisLabel (const Coordinate &coord, uInt axisInCoordinate=0, Bool doWorld=True, Bool doAbs=True, Bool doVel=False)
 Generate axis label String from coordinate. More...
 
static Bool cylindricalFix (CoordinateSystem &cSys, String &errorMessage, const IPosition &shape)
 Fix up Cylindrical parameters in any DirectionCoordinate for when the longitude is outside of [-180,180] range. More...
 
static CoordinateSystem makeBinnedCoordinateSystem (const IPosition &factors, const CoordinateSystem &cSysIn, Bool failOnStokes=False)
 Apply the binning factors to the CS and create a new one reflecting the binning You can optionally throw an exception if factors is non-unit for any Stokes axis. More...
 
static Int compareCoordinates (const CoordinateSystem &thisCsys, const CoordinateSystem &thatCsys)
 Check how the coordinates of this and that compare. More...
 
static Vector< InttoPixelAxes (const CoordinateSystem &thisCsys, const CoordinateSystem &thatCsys, const Vector< Int > &worldAxes)
 Convert the world axes map given in worldAxes to a pixel axes map. More...
 
static Bool checkOrder (const Vector< Int > &pixelAxes)
 Check if the axes in the pixel axes map are in ascending order. More...
 
static Bool findExtendAxes (IPosition &newAxes, IPosition &stretchAxes, const IPosition &newShape, const IPosition &oldShape, const CoordinateSystem &newCsys, const CoordinateSystem &oldCsys)
 Find the new and stretch axes when comparing the old and new coordinates and shapes (helper for ExtendImage). More...
 

Static Private Member Functions

static void findObservatoryOrRaiseException (LogIO &os, MPosition &pos, const String &tel)
 Sets pos to the position found for tel in the database, or raises an exception + error message. More...
 

Detailed Description

Functions for creating default CoordinateSystems.

Intended use:

Public interface

Prerequisite

Etymology

CoordinateUtils follows the Casacore naming convention for static functions that are associated with a class.

Synopsis

This file contains declarations for static functions that manipulate coordinate systems. It currently contains functions for:

The functions for adding default axes to a CoordinateSystem can add either a RA/DEC pair of axes, a Polarisation Axis, or a Spectral Axis to a user supplied coordinate system. The default values for these functions are:

The defaultCoords functions, create from scratch a CoordinateSystem using the above described addXXXAxis functions to add the required number of dimensions to the CoordinateSystem. Only 2, 3 or 4 dimensional coordinate systems can be constructed using these functions. The coordinate systems always have RA/Dec axes. Three dimensional Systems add a spectral axis and four-dimensional systems add an IQUV polarization axis. An exception (AipsError) is thrown if defaultCoords(uInt) is called with a parameter that is not 2, 3, or 4.

The defaultCoordsXX functions return the coordinate system by value (which involves a copy of the CoordinateSystem) and hence are not as effcient as the addXXXAxis functions.

If the default axes provided by these functions are not quite what is required it is possible to use member functions of the CoordinateSystem and Coordinate classes (DirectionCoordinate, StokesCoordinate, SpectralCoordinate etc.) to tweak the appropriate parameters of the specified axis.

Now we turn to the functions for finding axes in a CoordinateSystem. With a CoordinateSystem object it is not required that the first Coordinate axis in the the CoordinateSystem map to the first pixel axis in an image. Hence it is necessary to determine which pixel axis corresponds to a specified Coordinate and this can be done using these functions. Some coordinate types, in particular DirectionCoordinate, usually map to more than one pixel axis (DirectionsCoordinates are inherently two-dimensional).

This group contains declarations for static functions that search CoordinateSystem's for a coordinate of the specified type. It returns the pixel axis (zero relative) of the specified coordinate type. If the supplied Coordinate system does not contain the specified coordinate type the returned value is function specific (but usually -1). If the supplied CoordinateSystem contains two or more of the specified coordinateType then an exception (AipsError) is thrown.

Finally functions are provided for removing lists of pixel/world axes from a CoordinateSystem. This process is made a little awkward by the fact that when you remove one axis, all the rest shuffle down one, so it is provided here. Generally, one only needs to remove one axis (in which case you should use the CoordinateSystem::removeWorldAxis and CoordinateSystem::removcePixelAxis functions), but on occaision, the multiple need is there.

Example

I use these functions when creating test images.

PagedImage(IPosition(4,256,256,4,32), CoordinateUtil::defaultCoords4D(),
String("test.image"));

Example

Functions are needed to handle images without specifying a canonical coordinate order. For example suppose we want to find the spectral aixs of a PagedImage object.

const Int spectralAxis = CoordinateUtil::findSpectralAxis(image.coordinates());
cout << "The spectral axis is of shape " << image.shape()(spectralAxis) << endl;

Example

Here we remove the first and last world axes, and their associated pixel axes from a 3D CoordinateSystem. The reference values and reference pixels are used for the replacement values.

CoordinateSystem cSys = CoordinateUtil::defaultCoords3D();
Vector<Int> worldAxes(2);
worldAxes(0) = 0; worldAxes(1) = cSys.nWorldAxes()-1;
Vector<Double> worldRep;
Bool ok = CoordinateUtil::removeAxes(cSys, worldRep, worldAxes, True);
cout << "For world axes used " << worldRep << " for replacement" << endl;

Motivation

I got fed up writing small functions to create and find coordinates when writing test programs involving Images and ComponentModels.

Thrown Exceptions

Definition at line 202 of file CoordinateUtil.h.

Member Function Documentation

static uInt casacore::CoordinateUtil::addAxes ( CoordinateSystem csys,
Bool  direction,
Bool  spectral,
const String stokes,
Bool  linear,
Bool  tabular,
Bool  silent = False 
)
static

Add one axis for each of the specified coordinate types.

Returns the number of axes added. If silent==True, existing axes are silently ignored. This should really be a method of CoordinateSystem, but the code was moved from ImageUtilities which makes heavy use of CoordUtil methods (which aren't available to CoordinateSystem)

static void casacore::CoordinateUtil::addDirAxes ( CoordinateSystem coords)
static

Add a RA/DEC pair of direction axes (ie.

a DirectionCoordinate) to the user supplied CoordinateSystem. See the synopsis above for the current default values.

static void casacore::CoordinateUtil::addFreqAxis ( CoordinateSystem coords)
static

Add a spectral axis to the user supplied CoordinateSystem.

See the synopsis above for the current default values.

static void casacore::CoordinateUtil::addIAxis ( CoordinateSystem coords)
static

Add a Stokes I (only) axis to the user supplied CoordinateSystem.

static void casacore::CoordinateUtil::addIQUVAxis ( CoordinateSystem coords)
static

Add a Stokes I,Q,U,V axis to the user supplied CoordinateSystem.

static void casacore::CoordinateUtil::addLinearAxes ( CoordinateSystem coords,
const Vector< String > &  names,
const IPosition shape 
)
static

Add Linear axes.

The LinearCoordinate can have > 1 axes (like the DirectionCoordinate has 2). The number of axes is given by the length of the names argument. If you supply a shape, it will be used to set the reference pixel to 1/2 the shape. If the shape does not have the same number of elements as the names variable, the reference pixel will be 0

static Bool casacore::CoordinateUtil::addStokesAxis ( CoordinateSystem coords,
uInt  shape 
)
static

Add a Stokes axis of length 1 to 4 selected from I,Q,U,V E.g.

if shape=2 you get IQ. Returns False if shape is not in the range 1 to 4

static String casacore::CoordinateUtil::axisLabel ( const Coordinate coord,
uInt  axisInCoordinate = 0,
Bool  doWorld = True,
Bool  doAbs = True,
Bool  doVel = False 
)
static

Generate axis label String from coordinate.

Specify coordinate axis, whether world or pixel labels required, whether absolute or relative. For spectral coordinates, doVel says if you want to use the velocity information contained in it to generate the label

static Bool casacore::CoordinateUtil::checkOrder ( const Vector< Int > &  pixelAxes)
static

Check if the axes in the pixel axes map are in ascending order.

static Int casacore::CoordinateUtil::compareCoordinates ( const CoordinateSystem thisCsys,
const CoordinateSystem thatCsys 
)
static

Check how the coordinates of this and that compare.

The return value tells how they compare.
-1: left is subset
0: equal
1: left is superset
9: invalid (mismatch)

static Bool casacore::CoordinateUtil::cylindricalFix ( CoordinateSystem cSys,
String errorMessage,
const IPosition shape 
)
static

Fix up Cylindrical parameters in any DirectionCoordinate for when the longitude is outside of [-180,180] range.

If it returns False, it failed and an error message is returned as well. This function should be called on any CS made from an imported image like FITS

static CoordinateSystem casacore::CoordinateUtil::defaultCoords ( uInt  dims)
static

Calls one of the above three functions depending of the arguement.

An AipsError is thrown if dims is not 2, 3, or 4.

static CoordinateSystem casacore::CoordinateUtil::defaultCoords2D ( )
static

Return a 2-dimensional coordinate system with RA/DEC axes only.

static CoordinateSystem casacore::CoordinateUtil::defaultCoords3D ( )
static

Return a 3-dimensional coordinate system with RA/DEC axes and a spectral axis.

static CoordinateSystem casacore::CoordinateUtil::defaultCoords4D ( )
static

Return a 4-dimensional coordinate system with RA/DEC axes, an IQUV polarisation axis and a spectral axis.

static Bool casacore::CoordinateUtil::dropRemovedAxes ( CoordinateSystem cSysOut,
const CoordinateSystem cSysIn,
Bool  preserveAxesOrder = False 
)
static

Physically (nont just virtually) drop coordinates from the CoordinateSystem if all axes are fully removed.

For coordinates with axes partially removed (world/pixel) preserve that removal state in the output CS. No effort is made to deal in any way with transposed systems, unless perserveAxesOrder is True, and then the ordering of the axes of the output coordinate system will be the same as the input cSysIn (sans dropped axes of course).

static Vector<Int> casacore::CoordinateUtil::findDirectionAxes ( const CoordinateSystem coords)
static

Find which pixel axes correspond to the DirectionCoordinate in the supplied coordinate system and return this as a Vector.

If there is no DirectionCoordinate in the CoordinateSystem then return a Vector of zero length. Normally the returned Vector will have a length of two. However, if the pixel axis has been removed, then the resultant vector will take the value -1 for that axis.

static void casacore::CoordinateUtil::findDirectionAxes ( Vector< Int > &  pixelAxes,
Vector< Int > &  worldAxes,
Int coordinate,
const CoordinateSystem coords 
)
static

Find which pixel axes correspond to the DirectionCoordinate in the supplied coordinate system and return the most general description of where it is.

If there is no DirectionCoordinate then coordinate is returned with value -1. Values of -1 in the returned vectors indicate an axis has been removed.

static Bool casacore::CoordinateUtil::findExtendAxes ( IPosition newAxes,
IPosition stretchAxes,
const IPosition newShape,
const IPosition oldShape,
const CoordinateSystem newCsys,
const CoordinateSystem oldCsys 
)
static

Find the new and stretch axes when comparing the old and new coordinates and shapes (helper for ExtendImage).

static void casacore::CoordinateUtil::findObservatoryOrRaiseException ( LogIO os,
MPosition pos,
const String tel 
)
staticprivate

Sets pos to the position found for tel in the database, or raises an exception + error message.

static Coordinate::Type casacore::CoordinateUtil::findPixelAxis ( const CoordinateSystem cSys,
Int  axis 
)
static

Find Coordinate type for this pixel or world axis.

static Stokes::StokesTypes casacore::CoordinateUtil::findSingleStokes ( LogIO os,
const CoordinateSystem cSys,
uInt  pixel = 0 
)
static

Find the Stokes for the specified pixel.

If there is no Stokes in the CoordinateSystem, returns Stokes::I

static Bool casacore::CoordinateUtil::findSky ( String errorMessage,
Int dirCoord,
Vector< Int > &  pixelAxes,
Vector< Int > &  worldAxes,
const CoordinateSystem cSys 
)
static

Find the Sky in the CoordinateSystem.

Assumes only one DirectionCoordinate. pixelAxes and worldAxes say where in the CS the DirectionCoordinate axes are (long then lat). Returns False and an error message if it can't find the sky.

static Int casacore::CoordinateUtil::findSpectralAxis ( const CoordinateSystem coords)
static

Find which pixel axis in the CoordinateSystem corresponds to the SpectralCoordinate.

If there is no SpectralCoordinate in the coordinate system then return -1.

static void casacore::CoordinateUtil::findSpectralAxis ( Int pixelAxis,
Int worldAxis,
Int coordinate,
const CoordinateSystem coords 
)
static

Find the SpectralCoordinate in the CoordinateSystem, and then return the most general description of where it is.

If there is no SpectralCoordinate in the CoordinateSystem then return -1 for coordinate. If the world or pixel axis has been removed, return -1 for that value.

static Int casacore::CoordinateUtil::findStokesAxis ( Vector< Stokes::StokesTypes > &  whichPols,
const CoordinateSystem coords 
)
static

Find which pixel axis is the polarisation axis in the supplied CoordinateSystem and return this.

If there is no StokesCoordinate in the CoordinateSystem return a negative number. The actual polarisations on the returned pixel axis are returned in the whichPols Vector. Each element of this Vector is a Stokes::StokesTypes enumerator and the length of the Vector is the same as the length of the polarisation axis. If there is no polarisation axis the whichPols returns a unit length Vector containing Stokes::I

static void casacore::CoordinateUtil::findStokesAxis ( Int pixelAxis,
Int worldAxis,
Int coordinate,
const CoordinateSystem coords 
)
static

Find the StokesCoordinate in the CoordinateSystem, and then return the most general description of where it is.

If there is no StokesCoordinate in the CoordinateSystem then return -1 for coordinate. If the world or pixel axis has been removed, return -1 for that value.

static Coordinate::Type casacore::CoordinateUtil::findWorldAxis ( const CoordinateSystem cSys,
Int  axis 
)
static
static String casacore::CoordinateUtil::formatCoordinate ( const IPosition pixel,
const CoordinateSystem cSys,
Int  precision = -1 
)
static

Convert an absolute pixel coordinate to world and format with default Coordinate formatting.

static String casacore::CoordinateUtil::formatCoordinate ( const Vector< Double > &  pixel,
const CoordinateSystem cSys,
Int  precision = -1 
)
static
static Bool casacore::CoordinateUtil::holdsSky ( Bool holdsOneSkyAxis,
const CoordinateSystem cSys,
Vector< Int pixelAxes 
)
static

Do the specified axes hold the sky ? Returns False if no DirectionCoordinate or if only one axis of the DirectionCoordinate is held or the specified pixel axes don't pertain to the DirectionCoordinate.

static Bool casacore::CoordinateUtil::isSky ( LogIO os,
const CoordinateSystem cSys 
)
static

Does the CoordinateSystem hold just the sky? Returns True if CS pixel axis 0 is the longitude and 1 latitude else returns False.

static CoordinateSystem casacore::CoordinateUtil::makeBinnedCoordinateSystem ( const IPosition factors,
const CoordinateSystem cSysIn,
Bool  failOnStokes = False 
)
static

Apply the binning factors to the CS and create a new one reflecting the binning You can optionally throw an exception if factors is non-unit for any Stokes axis.

static CoordinateSystem casacore::CoordinateUtil::makeCoordinateSystem ( const IPosition shape,
Bool  doLinear = False 
)
static

If doLinear=False, Tries to make a standard RA/DEC/Stokes/Frequency CoordinateSystem depending upon the shape.

The shape for the Stokes axis must be <= 4. If axis 2 can't be Stokes it will be a Spectral axis instead. AFter the standard types, the rest (if any) of the CoordinateSystem consists of LinearCoordinates. If doLinear=True, then you just get a linear coordinate system

static Bool casacore::CoordinateUtil::makeDirectionMachine ( LogIO os,
MDirection::Convert machine,
const DirectionCoordinate dirCoordTo,
const DirectionCoordinate dirCoordFrom,
const ObsInfo obsTo,
const ObsInfo obsFrom 
)
static

Setup Measures conversion machine for MDirections.

Returns True if the machine was needed and set. Returns False if the machine was not needed and not set.

static Bool casacore::CoordinateUtil::makeFrequencyMachine ( LogIO os,
MFrequency::Convert machine,
Int  coordinateTo,
Int  coordinateFrom,
const CoordinateSystem coordsTo,
const CoordinateSystem coordsFrom,
const Unit unit = Unit(String("Hz")) 
)
static

Setup Measures conversion machines for MFrequencies.

Returns False if a trial conversion failed, else returns True. There must be both a Direction and a Spectral Coordinate in the CoordinateSystem when making the Frequency machine, else an exception occurs.

static Bool casacore::CoordinateUtil::makeFrequencyMachine ( LogIO os,
MFrequency::Convert machine,
MFrequency::Types  typeTo,
MFrequency::Types  typeFrom,
const MDirection dirTo,
const MDirection dirFrom,
const MEpoch epochTo,
const MEpoch epochFrom,
const MPosition posTo,
const MPosition posFrom,
const Unit unit = Unit(String("Hz")) 
)
static

Setup Measures conversion machines for MFrequencies.

Returns False if a trial conversion failed, else returns True.

static Bool casacore::CoordinateUtil::removeAxes ( CoordinateSystem cSys,
Vector< Double > &  worldReplacement,
const Vector< Int > &  worldAxes,
const Bool  remove 
)
static

Remove a list of world axes and their associated pixel axes from a CoordinateSystem.

The list of world axes to be removed is derived from a list giving either axes to remove, or axes to keep (controlled by whether remove is True or False. The replacement values (see functions CoordinateSystem::removeWorldAxis) for the world axes can be given. For the associated pixel axes, the pixel replacement coordinate is found by converting the world coordinate to a pixel coordinate. If the length of the replacement value vector is not the number of world axes to be removed then the reference values will be used (e.g. use zero length vectors).

static Bool casacore::CoordinateUtil::removePixelAxes ( CoordinateSystem cSys,
Vector< Double > &  pixelReplacement,
const Vector< Int > &  pixelAxes,
const Bool  remove 
)
static

Remove a list of pixel axes but not their associated world axes from a CoordinateSystem.

The list of pixel axes to be removed is derived from a list giving either axes to remove, or axes to keep (controlled by whether remove is True or False. The replacement values (see functions CoordinateSystem::removePixelAxis) for the pixel axes can be given. If the length of the replacement value vector is not the number of pixel axes to be removed then the reference pixel will be used (e.g. use zero length vectors).

static Bool casacore::CoordinateUtil::setCoordinateUnits ( CoordinateSystem cSys,
const Vector< String > &  units,
uInt  which 
)
static

Set world axis units for specific Coordinate.

Returnd False if fails to set units with error in cSys.errorMessage().

static Bool casacore::CoordinateUtil::setDirectionConversion ( String errorMsg,
CoordinateSystem cSys,
const String  directionSystem 
)
static

Set Direction conversion layer of DirectionCoordinate in CoordinateSystem so that pixel<->world go to the specified direction system (a valid MDirection::Types string).

Returns False with error if direction system invalid. If no DirectionCoordinate returns True

static Bool casacore::CoordinateUtil::setDirectionUnit ( CoordinateSystem cSys,
const String unit,
Int  which = -1 
)
static

Set a unit for all unremoved world axes in the DirectionCoordinate in the CS.

Returns False if fails to set unit with error in cSys. If no DC returns True

static void casacore::CoordinateUtil::setNiceAxisLabelUnits ( CoordinateSystem cSys)
static

Set the world axis units in the CS to 'deg' for Direction.

For Spectral set the velocity handling to use 'km/s' units. Other coordinates are not touched.

static Bool casacore::CoordinateUtil::setRestFrequency ( String errorMsg,
CoordinateSystem cSys,
const String unit,
const Double value 
)
static

Set rest frequency of SpectralCoordinate in CoordinateSystem.

Unit must be consistent with Hz or m. Returns False if invalid inputs (and CS not changed) and an error message.

static Bool casacore::CoordinateUtil::setSpectralConversion ( String errorMsg,
CoordinateSystem cSys,
const String  frequencySystem 
)
static

Set Spectral conversion layer of SpectralCoordinate in CoordinateSystem so that pixel<->world go to the specified frequency system (a valid MFrequency::Types string).

Returns False if frequency system invalid or if no DirectionCoordinate or if cant get Date/Epoch

static Bool casacore::CoordinateUtil::setSpectralFormatting ( String errorMsg,
CoordinateSystem cSys,
const String unit,
const String spcquant 
)
static

Set default format unit and doppler velocity state of SpectralCoordinate in CoordinateSystem.

Unit can be consistent with Hz or m/s Returns False if invalid inputs (and CS not changed) and an error message.

static Bool casacore::CoordinateUtil::setSpectralState ( String errorMsg,
CoordinateSystem cSys,
const String unit,
const String spcquant 
)
static

Set spectral state of SpectralCoordinate in CoordinateSystem.

Unit must be consistent with Hz or m/s and the doppler a valid MDoppler string. For no change, leave either String empty. Returns False if invalid inputs (and CS not changed) and an error message.

static Bool casacore::CoordinateUtil::setVelocityState ( String errorMsg,
CoordinateSystem cSys,
const String unit,
const String spcquant 
)
static

Set velocity state of SpectralCoordinate in CoordinateSystem.

Unit must be consistent m/s and the doppler a valid MDoppler string. For no change, leave either String empty. Returns False if invalid inputs (and CS not changed) and an error message.

static Vector<Int> casacore::CoordinateUtil::toPixelAxes ( const CoordinateSystem thisCsys,
const CoordinateSystem thatCsys,
const Vector< Int > &  worldAxes 
)
static

Convert the world axes map given in worldAxes to a pixel axes map.


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