Go to the documentation of this file.
28 #ifndef COORDINATES_COORDINATEUTIL_H
29 #define COORDINATES_COORDINATEUTIL_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/Arrays/Vector.h>
34 #include <casacore/measures/Measures/Stokes.h>
35 #include <casacore/coordinates/Coordinates/Coordinate.h>
37 #include <casacore/measures/Measures/MDirection.h>
38 #include <casacore/measures/Measures/MFrequency.h>
39 #include <casacore/measures/Measures/MeasConvert.h>
43 class CoordinateSystem;
44 class DirectionCoordinate;
387 Int coordinateTo,
Int coordinateFrom,
440 const String directionSystem);
476 const String frequencySystem);
Interconvert pixel and world coordinates.
static void addFreqAxis(CoordinateSystem &coords)
Add a spectral axis to the user supplied CoordinateSystem.
static void addDirAxes(CoordinateSystem &coords)
Add a RA/DEC pair of direction axes (ie.
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.
Interface for converting between world and pixel coordinates.
static Bool setDirectionConversion(String &errorMsg, CoordinateSystem &cSys, const String directionSystem)
Set Direction conversion layer of DirectionCoordinate in CoordinateSystem so that pixel<->world go to...
A Vector of integers, for indexing into Array<T> objects.
static Vector< Int > toPixelAxes(const CoordinateSystem &thisCsys, const CoordinateSystem &thatCsys, const Vector< Int > &worldAxes)
Convert the world axes map given in worldAxes to a pixel axes map.
A Measure: instant in time.
A Measure: position on Earth.
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.
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 th...
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 t...
Interconvert pixel positions and directions (e.g. RA/DEC).
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 rem...
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.
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.
static Int findSpectralAxis(const CoordinateSystem &coords)
Find which pixel axis in the CoordinateSystem corresponds to the SpectralCoordinate.
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.
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.
static CoordinateSystem defaultCoords4D()
Return a 4-dimensional coordinate system with RA/DEC axes, an IQUV polarisation axis and a spectral a...
static Int compareCoordinates(const CoordinateSystem &thisCsys, const CoordinateSystem &thatCsys)
Check how the coordinates of this and that compare.
Type
This enum lists the types of the derived classes.
static CoordinateSystem defaultCoords2D()
Return a 2-dimensional coordinate system with RA/DEC axes only.
static Bool setSpectralConversion(String &errorMsg, CoordinateSystem &cSys, const String frequencySystem)
Set Spectral conversion layer of SpectralCoordinate in CoordinateSystem so that pixel<->world go to t...
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.
static Stokes::StokesTypes findSingleStokes(LogIO &os, const CoordinateSystem &cSys, uInt pixel=0)
Find the Stokes for the specified pixel.
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.
ostream-like interface to creating log messages.
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,...
static CoordinateSystem defaultCoords3D()
Return a 3-dimensional coordinate system with RA/DEC axes and a spectral axis.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
static Bool findSky(String &errorMessage, Int &dirCoord, Vector< Int > &pixelAxes, Vector< Int > &worldAxes, const CoordinateSystem &cSys)
Find the Sky in the CoordinateSystem.
static Bool addStokesAxis(CoordinateSystem &coords, uInt shape)
Add a Stokes axis of length 1 to 4 selected from I,Q,U,V E.g.
static Bool checkOrder(const Vector< Int > &pixelAxes)
Check if the axes in the pixel axes map are in ascending order.
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
static Vector< Int > findDirectionAxes(const CoordinateSystem &coords)
Find which pixel axes correspond to the DirectionCoordinate in the supplied coordinate system and ret...
static String formatCoordinate(const Vector< Double > &pixel, const CoordinateSystem &cSys, Int precision=-1)
A Measure: astronomical direction.
static Bool setSpectralState(String &errorMsg, CoordinateSystem &cSys, const String &unit, const String &spcquant)
Set spectral state of SpectralCoordinate in CoordinateSystem.
static void addIQUVAxis(CoordinateSystem &coords)
Add a Stokes I,Q,U,V axis to the user supplied CoordinateSystem.
this file contains all the compiler specific defines
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
static Coordinate::Type findPixelAxis(const CoordinateSystem &cSys, Int axis)
Find Coordinate type for this pixel or world axis.
static Bool setCoordinateUnits(CoordinateSystem &cSys, const Vector< String > &units, uInt which)
Set world axis units for specific Coordinate.
Functions for creating default CoordinateSystems.
static CoordinateSystem defaultCoords(uInt dims)
Calls one of the above three functions depending of the arguement.
static Bool setRestFrequency(String &errorMsg, CoordinateSystem &cSys, const String &unit, const Double &value)
Set rest frequency of SpectralCoordinate in CoordinateSystem.
static String axisLabel(const Coordinate &coord, uInt axisInCoordinate=0, Bool doWorld=True, Bool doAbs=True, Bool doVel=False)
Generate axis label String from coordinate.
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.
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 ret...
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 Exten...
String: the storage and methods of handling collections of characters.
bool Bool
Define the standard types used by Casacore.
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 wh...
Store miscellaneous information related to an observation.
static void addLinearAxes(CoordinateSystem &coords, const Vector< String > &names, const IPosition &shape)
Add Linear axes.
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.
A 1-D Specialization of the Array class.
static CoordinateSystem makeCoordinateSystem(const IPosition &shape, Bool doLinear=False)
If doLinear=False, Tries to make a standard RA/DEC/Stokes/Frequency CoordinateSystem depending upon t...
static void setNiceAxisLabelUnits(CoordinateSystem &cSys)
Set the world axis units in the CS to 'deg' for Direction.
StokesTypes
The Stokes types are defined by this enum.
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.
static Bool setVelocityState(String &errorMsg, CoordinateSystem &cSys, const String &unit, const String &spcquant)
Set velocity state of SpectralCoordinate in CoordinateSystem.
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 l...
static void addIAxis(CoordinateSystem &coords)
Add a Stokes I (only) axis to the user supplied CoordinateSystem.
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 ...