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

More...

`#include <SpectralCoordinate.h>`

## Public Types

enum | SpecType { FREQ , VRAD , VOPT , BETA , WAVE , AWAV }
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...

## Public Member Functions

| SpectralCoordinate ()
| Default constructor.
| SpectralCoordinate (MFrequency::Types type, Double f0, Double inc, Double refPix, Double restFrequency=0.0)
| Create a linear frequency axis SpectralCoordinate f0 is the frequency of the reference pixel, inc is the pixel increment, refPix is the reference pixel.
| SpectralCoordinate (MFrequency::Types type, const Quantum< Double > &f0, const Quantum< Double > &inc, Double refPix, const Quantum< Double > &restFrequency=Quantum< Double >(0.0,"Hz"))
| Create linear frequency axis SpectralCoordinate with Quantum-based interface.
| SpectralCoordinate (MFrequency::Types type, const Vector< Double > &freqs, Double restFrequency=0.0)
| Construct a SpectralCoordinate with the specified frequencies (in Hz).
| SpectralCoordinate (MFrequency::Types type, const Quantum< Vector< Double > > &freqs, const Quantum< Double > &restFrequency=Quantum< Double >(0.0,"Hz"))
| Construct a SpectralCoordinate with the specified frequencies with Quantum-based interface.
| SpectralCoordinate (MFrequency::Types freqType, MDoppler::Types velType, const Vector< Double > &velocities, const String &velUnit, Double restFrequency=0.0)
| Construct a SpectralCoordinate with the specified velocities (in km/s).
| SpectralCoordinate (MFrequency::Types freqType, const Vector< Double > &wavelengths, const String &waveUnit, Double restFrequency=0.0, Bool inAir=False)
| Construct a SpectralCoordinate with the specified wavelengths (in mm).
| SpectralCoordinate (MFrequency::Types freqType, const ::wcsprm &wcs, Bool oneRel=True)
| Construct from wcs structure.
| SpectralCoordinate (const SpectralCoordinate &other)
| Copy constructor (copy semantics).
SpectralCoordinate & | operator= (const SpectralCoordinate &other)
| Assignment (copy semantics).
virtual | ~SpectralCoordinate ()
| Destructor.
virtual Coordinate::Type | type () const
| Always returns Coordinate::SPECTRAL.
virtual String | showType () const
| Always returns the String "Spectral".
virtual uInt | nPixelAxes () const
| Always returns 1.
virtual uInt | nWorldAxes () const
Bool | setReferenceConversion (MFrequency::Types type, const MEpoch &epoch, const MPosition &position, const MDirection &direction)
| Set extra conversion layer.
void | getReferenceConversion (MFrequency::Types &type, MEpoch &epoch, MPosition &position, MDirection &direction) const
virtual Bool | toWorld (Vector< Double > &world, const Vector< Double > &pixel, Bool useConversionFrame=True) const
| Convert a pixel to a world coordinate or vice versa.
virtual Bool | toPixel (Vector< Double > &pixel, const Vector< Double > &world) const
Bool | toWorld (Double &world, const Double &pixel) const
Bool | toPixel (Double &pixel, const Double &world) const
Bool | toWorld (MFrequency &world, Double pixel) const
| Convert a pixel (channel number) into an MFrequency or MVFrequency and vice versa.
Bool | toPixel (Double &pixel, const MFrequency &world) const
Bool | toWorld (MVFrequency &world, Double pixel) const
Bool | toPixel (Double &pixel, const MVFrequency &world) 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
Bool | setVelocity (const String &velUnit=String("km/s"), MDoppler::Types velType=MDoppler::RADIO)
| Set the state that is used for conversions from pixel and frequency to velocity or wavelength.
MDoppler::Types | velocityDoppler () const
String | velocityUnit () const
Bool | setWavelengthUnit (const String &waveUnit=String("mm"))
String | wavelengthUnit () const
Bool | setNativeType (const SpectralCoordinate::SpecType spcType)
SpectralCoordinate::SpecType | nativeType () const
Bool | pixelToVelocity (Quantum< Double > &velocity, Double pixel) const
| Functions to convert to velocity (uses the current active rest frequency) or wavelength.
Bool | pixelToVelocity (Double &velocity, Double pixel) const
Bool | pixelToVelocity (Vector< Double > &velocity, const Vector< Double > &pixel) const
Bool | frequencyToVelocity (Quantum< Double > &velocity, Double frequency) const
Bool | frequencyToVelocity (Quantum< Double > &velocity, const MFrequency &frequency) const
Bool | frequencyToVelocity (Quantum< Double > &velocity, const MVFrequency &frequency) const
Bool | frequencyToVelocity (Double &velocity, Double frequency) const
Bool | frequencyToVelocity (Vector< Double > &velocity, const Vector< Double > &frequency) const
Bool | frequencyToWavelength (Vector< Double > &wavelength, const Vector< Double > &frequency) const
Bool | frequencyToAirWavelength (Vector< Double > &wavelength, const Vector< Double > &frequency) const
Bool | velocityToPixel (Double &pixel, Double velocity) const
| The refractive index of air (argument can be wavelength or airwavelength) according to Greisen et al., 2006, A&A, 464, 746.
Bool | velocityToPixel (Vector< Double > &pixel, const Vector< Double > &velocity) const
Bool | velocityToFrequency (Double &frequency, Double velocity) const
Bool | velocityToFrequency (Vector< Double > &frequency, const Vector< Double > &velocity) const
Bool | wavelengthToFrequency (Vector< Double > &frequency, const Vector< Double > &wavelength) const
Bool | airWavelengthToFrequency (Vector< Double > &frequency, const Vector< Double > &wavelength) const
Double | restFrequency () const
| The SpectralCoordinate can maintain a list of rest frequencies (e.g.
const Vector< Double > & | restFrequencies () const
Bool | setRestFrequency (Double newFrequency, Bool append=False)
void | setRestFrequencies (const Vector< Double > &newFrequencies, uInt which=0, Bool append=False)
void | selectRestFrequency (uInt which)
void | selectRestFrequency (Double frequency)
String | formatRestFrequencies () const
MFrequency::Types | frequencySystem (Bool showConversion=False) const
| Retrieve/set the frequency system.
void | setFrequencySystem (MFrequency::Types type, Bool verbose=True)
Bool | transformFrequencySystem (MFrequency::Types type, const MEpoch &epoch, const MPosition &position, const MDirection &direction)
| Transform the SpectralCoordinate to a different native reference frame keeping the conversion layer as is.
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)
Vector< Double > | pixelValues () const
| Get the table, i.e.
Vector< Double > | worldValues () const
virtual Bool | setWorldAxisUnits (const Vector< String > &units)
| Set/get the unit.
virtual Vector< String > | worldAxisUnits () const
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 Coordinate * | makeFourierCoordinate (const Vector< Bool > &axes, const Vector< Int > &shape) const
| Find the Coordinate for when we Fourier Transform ourselves.
virtual String | format (String &unit, Coordinate::formatType format, Double worldValue, uInt worldAxis, Bool isAbsolute=True, Bool showAsAbsolute=True, Int precision=-1, Bool usePrecForFixed=False) const
| Format a SpectralCoordinate coordinate world value nicely through the common format interface.
String | formatUnit () const
| Set the default formatter unit (which is initialized to empty).
Bool | setFormatUnit (const String &unit)
void | toFITS (RecordInterface &header, uInt whichAxis, LogIO &logger, Bool oneRelative=True, Bool preferVelocity=True, Bool opticalVelDef=True, Bool preferWavelength=False, Bool airWaveDef=False) const
| Convert to FITS header record.
virtual Bool | save (RecordInterface &container, const String &fieldName) const
| Old interface.
virtual Coordinate * | clone () const
| Make a copy of the SpectralCoordinate using new.
ostream & | print (ostream &os) const
Bool | isTabular () const
| is this a tabular 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.
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 ()
Vector< Double > | worldMixMin () const
Vector< Double > | worldMixMax () const
virtual void | makePixelRelative (Vector< Double > &pixel) const
| Make absolute coordinates relative and vice-versa (with respect to the reference value).
virtual void | makePixelAbsolute (Vector< Double > &pixel) const
virtual void | makeWorldRelative (Vector< Double > &world) const
virtual void | makeWorldAbsolute (Vector< Double > &world) 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
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 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 The default implementation should be ok for all Coordinate types except Stokes and Quality...
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 SpectralCoordinate * | restore (const RecordInterface &container, const String &fieldName)
| Recover the SpectralCoordinate from a record.
static Bool | specTypetoString (String &stypeString, const SpecType &specType)
| Convert from String to spectral type and vice versa.
static Bool | stringtoSpecType (SpecType &specType, const String &stypeString)
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

void | checkFormat (Coordinate::formatType &format, const Bool) const
| Format checker.
void | copy (const SpectralCoordinate &other)
| Copy private data.
virtual void | convertTo (Vector< Double > &world) const
| Convert to and from conversion reference type.
virtual void | convertFrom (Vector< Double > &world) const
void | deleteVelocityMachine ()
| Deletes and sets pointer to 0.
void | deleteConversionMachines ()
| Deletes and sets pointers to 0.
Int | makeConversionMachines (MFrequency::Types type, MFrequency::Types conversionType, const MEpoch &epoch, const MPosition &position, const MDirection &direction)
| Set up pixel<->world conversion machines Returns: 3 (machines were noOPs, machines deleted) 2 (types the same, machines deleted), 1 (machines created and functioning) -1 (machines could not make trial conversion, machines deleted).
void | makeVelocityMachine (const String &velUnit, MDoppler::Types velType, const Unit &freqUnit, MFrequency::Types freqType, Double restFreq)
| Create velocity<->frequency machine.
void | toCurrent (Vector< Double > &value) const
| Interconvert between the current units and wcs units (Hz).
void | fromCurrent (Vector< Double > &value) const
const Vector< Double > | toCurrentFactors () const
| Return unit conversion vector for converting to current units.
void | updateVelocityMachine (const String &velUnit, MDoppler::Types velType)
| Update Velocity Machine.
Bool | wcsSave (RecordInterface &rec, const wcsprm &wcs, const String &fieldName) const
| Save wcs stuff into Record.
void | _setTabulatedFrequencies (const Vector< Double > &freqs)

## Static Private Member Functions

static void | makeWCS (wcsprm &wcs, const String &ctype, Double refPix, Double refVal, Double inc, Double pc, Double restFreq)
| Make spectral wcs structure (items in Hz).
static SpectralCoordinate * | restoreVersion1 (const RecordInterface &container)
| Record restoration handling.
static SpectralCoordinate * | restoreVersion2 (const RecordInterface &container)
static void | restoreVelocity (SpectralCoordinate *&pSpectral, const RecordInterface &subrec)
static void | restoreRestFrequencies (SpectralCoordinate *&pSpectral, const RecordInterface &subrec, Double restFreq)
static void | restoreConversion (SpectralCoordinate *&pSpectral, const RecordInterface &subrec)
static Bool | wcsRestore (Double &crval, Double &crpix, Double &cdelt, Double &pc, String &ctype, const RecordInterface &rec)
| Restore wcs stuff from Record.

## Private Attributes

std::unique_ptr< TabularCoordinate > | _tabular
mutable::wcsprm | wcs_p
Double | to_hz_p
Double | to_m_p
MFrequency::Types | type_p
MFrequency::Types | conversionType_p
Vector< Double > | restfreqs_p
uInt | restfreqIdx_p
MFrequency::Convert * | pConversionMachineTo_p
| Conversion machines; for pixel<->world conversions only.
MFrequency::Convert * | pConversionMachineFrom_p
VelocityMachine * | pVelocityMachine_p
MDoppler::Types | velType_p
String | velUnit_p
String | waveUnit_p
SpectralCoordinate::SpecType | nativeType_p
Unit | unit_p
String | axisName_p
String | formatUnit_p
MDirection | direction_p
MPosition | position_p
MEpoch | epoch_p

## Additional Inherited Members

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
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 pixel and frequency values.

### Intended use:

Public interface

### Review Status

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

### Prerequisite

- Coordinate
- MFrequency, MDoppler and VelocityMachine
  classes if you want radial velocities.

### Synopsis

This class performs the mapping from pixel to frequency. This can be done via a Tabular lookup or via an algorithmic implementation which may be linear or non-linear. The latter is implemented via the WCS library.

Caution: All pixels coordinates are zero relative;

### Example

Let us make a linear SpectralCoordinate first

Double restfreq = 1.420405752E9;
Double crpix = 10.0;
Double crval = 1.4e9;
Double cdelt = 1.0e6;
SpectralCoordinate sc(MFrequency::TOPO, crval, cdelt, crpix, restfreq);
Double world, pixel;
pixel = 12.1;
if (!sc.toWorld(world, pixel)) {
cerr << "Error : " << sc.errorMessage() << endl;
} else {
cerr << "pixel, world = " << pixel << ", " << world << endl;
}
casacore::MFrequency::TOPO
@ TOPO
Definition MFrequency.h:179
casacore::SpectralCoordinate::SpectralCoordinate
SpectralCoordinate()
Default constructor.
casacore::cdelt
double cdelt(int n) const
Definition hdu.h:364
casacore::crpix
double crpix(int n) const
Definition hdu.h:361
casacore::crval
double crval(int n) const
Definition hdu.h:363
casacore::Double
double Double
Definition aipstype.h:53

### Example

Now we make a non-linear SpectralCoordinate

Vector<Double> freqs(5);
freqs(0) = 1.4e9; freqs(1) = 1.41e9;
freqs(2) = 1.43e9; freqs(3) = 1.44e9;
freqs(4) = 1.47e9;
SpectralCoordinate sc(MFrequency::LSRK, freqs, restfreq);
Double world, pixel;
world = 1.42e9;
if (!sc.toPixel(pixel, world)) {
cerr << "Error : " << sc.errorMessage() << endl;
} else {
cerr << "world, pixel = " << world << ", " << pixel << endl;
}
casacore::MFrequency::LSRK
@ LSRK
Definition MFrequency.h:175
casacore::Vector
Definition Vector.h:82

### Motivation

Spectral-line astronomy requires a specialized SpectralCoordinate.

### To Do

- Allow other than linear interpolations for frequency lookup.

Definition at line 134 of file SpectralCoordinate.h.

## Member Enumeration Documentation

## SpecType

enum casacore::SpectralCoordinate::SpecType

Enumerator
FREQ |
VRAD |
VOPT |
BETA |
WAVE |
AWAV |

Definition at line 137 of file SpectralCoordinate.h.

## Constructor & Destructor Documentation

## SpectralCoordinate() [1/9]

casacore::SpectralCoordinate::SpectralCoordinate | ( |  | ) |

Default constructor.

It is equivalent to doing SpectralCoordinate(MFrequency::TOPO, 0.0, 1.0, 0.0)

Referenced by copy(), operator=(), restore(), restoreConversion(), restoreRestFrequencies(), restoreVelocity(), restoreVersion1(), restoreVersion2(), and SpectralCoordinate().

## SpectralCoordinate() [2/9]

casacore::SpectralCoordinate::SpectralCoordinate | ( | MFrequency::Types | type,
|  | Double | f0,
|  | Double | inc,
|  | Double | refPix,
|  | Double | restFrequency = 0.0 )

Create a linear frequency axis SpectralCoordinate f0 is the frequency of the reference pixel, inc is the pixel increment, refPix is the reference pixel.

You can optionally store the rest frequency for later use in calculating radial velocities. Use 0 for restFrequency if continuum.

Frequencies and increments initially in Hz.

References restFrequency(), and type().

## SpectralCoordinate() [3/9]

casacore::SpectralCoordinate::SpectralCoordinate | ( | MFrequency::Types | type,
|  | const Quantum< Double > & | f0,
|  | const Quantum< Double > & | inc,
|  | Double | refPix,
|  | const Quantum< Double > & | restFrequency = Quantum< Double >(0.0,"Hz") )

Create linear frequency axis SpectralCoordinate with Quantum-based interface.

Parameters are the same as above. Regardless of the units of the Quanta, the initial units of the SpectralCoordinate will be Hz. You can change it to something else with the setWorldAxisUnits method later if you want. Use 0 for restFrequency if continuum.

References restFrequency(), and type().

## SpectralCoordinate() [4/9]

casacore::SpectralCoordinate::SpectralCoordinate | ( | MFrequency::Types | type,
|  | const Vector< Double > & | freqs,
|  | Double | restFrequency = 0.0 )

Construct a SpectralCoordinate with the specified frequencies (in Hz).

This axis can be nonlinear; the increments and related functions return the average values (calculated from the first and last pixel's frequencies).

A linear interpolation/extrapolation is used for pixels which are not supplied. The reference pixel is chosen to be 0. The frequencies must increase or decrease monotonically (otherwise the toPixel lookup would not be possible). Use 0 for restFrequency if continuum.

References restFrequency(), and type().

## SpectralCoordinate() [5/9]

casacore::SpectralCoordinate::SpectralCoordinate | ( | MFrequency::Types | type,
|  | const Quantum< Vector< Double > > & | freqs,
|  | const Quantum< Double > & | restFrequency = Quantum< Double >(0.0,"Hz") )

Construct a SpectralCoordinate with the specified frequencies with Quantum-based interface.

Parameters are the same as above. Regardless of the units of the Quanta, the initial units of the SpectralCoordinate will be Hz. Use 0 for restFrequency if continuum.

References restFrequency(), and type().

## SpectralCoordinate() [6/9]

casacore::SpectralCoordinate::SpectralCoordinate | ( | MFrequency::Types | freqType,
|  | MDoppler::Types | velType,
|  | const Vector< Double > & | velocities,
|  | const String & | velUnit,
|  | Double | restFrequency = 0.0 )

Construct a SpectralCoordinate with the specified velocities (in km/s).

They will be converted to Hz and the SpectralCoordinate constructed. This axis can be nonlinear; the increments and related functions return the average values (calculated from the first and last pixel's frequencies).

A linear interpolation/extrapolation is used for pixels which are not supplied. The reference pixel is chosen to be 0. The velocities must increase or decrease monotonically (otherwise the toPixel lookup would not be possible).

References restFrequency().

## SpectralCoordinate() [7/9]

casacore::SpectralCoordinate::SpectralCoordinate | ( | MFrequency::Types | freqType,
|  | const Vector< Double > & | wavelengths,
|  | const String & | waveUnit,
|  | Double | restFrequency = 0.0,
|  | Bool | inAir = False )

Construct a SpectralCoordinate with the specified wavelengths (in mm).

They will be converted to Hz and the SpectralCoordinate constructed. This axis can be nonlinear; the increments and related functions return the average values (calculated from the first and last pixel's frequencies). If inAir is True, the input wavelengths are assumed to be Air Wavelengths. They are converted to vacuum frequency using the refractive index which is calculated based on the mean input air wavelength.

A linear interpolation/extrapolation is used for pixels which are not supplied. The reference pixel is chosen to be 0. The wavelengths must increase or decrease monotonically (otherwise the toPixel lookup would not be possible).

References casacore::False, and restFrequency().

## SpectralCoordinate() [8/9]

casacore::SpectralCoordinate::SpectralCoordinate | ( | MFrequency::Types | freqType,
|  | const ::wcsprm & | wcs,
|  | Bool | oneRel = True )

Construct from wcs structure.

Must hold only a spectral wcs structure Specify whether the absolute pixel coordinates in the wcs structure are 0- or 1-relative. The coordinate is always constructed with 0-relative pixel coordinates

References casacore::True.

## SpectralCoordinate() [9/9]

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

Copy constructor (copy semantics).

References SpectralCoordinate().

## ~SpectralCoordinate()

virtual casacore::SpectralCoordinate::~SpectralCoordinate | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## _setTabulatedFrequencies()

void casacore::SpectralCoordinate::_setTabulatedFrequencies | ( | const Vector< Double > & | freqs | ) |

private

## airWavelengthToFrequency()

Bool casacore::SpectralCoordinate::airWavelengthToFrequency | ( | Vector< Double > & | frequency,
|  | const Vector< Double > & | wavelength ) const

## checkFormat()

void casacore::SpectralCoordinate::checkFormat | ( | Coordinate::formatType & | format,
|  | const Bool | ) const

private

Format checker.

References format().

## clone()

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

virtual

Make a copy of the SpectralCoordinate using new.

The caller is responsible for calling delete.

Implements casacore::Coordinate.

References casacore::Coordinate::Coordinate().

## convertFrom()

virtual void casacore::SpectralCoordinate::convertFrom | ( | Vector< Double > & | world | ) | const

private virtual

Reimplemented from casacore::Coordinate.

## convertTo()

virtual void casacore::SpectralCoordinate::convertTo | ( | Vector< Double > & | world | ) | const

private virtual

Convert to and from conversion reference type.

Reimplemented from casacore::Coordinate.

## copy()

void casacore::SpectralCoordinate::copy | ( | const SpectralCoordinate & | other | ) |

private

Copy private data.

References SpectralCoordinate().

## deleteConversionMachines()

void casacore::SpectralCoordinate::deleteConversionMachines | ( |  | ) |

private

Deletes and sets pointers to 0.

## deleteVelocityMachine()

void casacore::SpectralCoordinate::deleteVelocityMachine | ( |  | ) |

private

Deletes and sets pointer to 0.

## format()

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

virtual

Format a SpectralCoordinate coordinate world value nicely through the common format interface.

See Coordinate for basics.

Format types SCIENTIFIC, FIXED, MIXED and DEFAULT are supported. DEFAULT will use MIXED.

The world value must always be given in native frequency units. Use argument unit to determine what it will be converted to for formatting. If unit is given, it must be dimensionally consistent with Hz, m, or m/s.
If you give a unit consistent with m/s then the appropriate velocity Doppler type is taken from that set by function setVelocity. There is no frame conversion. If unit is empty, the unit given by setFormatUnit is used. If this is turn empty, then native units are used.

Reimplemented from casacore::Coordinate.

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

Referenced by checkFormat(), and format().

## formatRestFrequencies()

String casacore::SpectralCoordinate::formatRestFrequencies | ( |  | ) | const

## formatUnit()

String casacore::SpectralCoordinate::formatUnit | ( |  | ) | const

inline

Set the default formatter unit (which is initialized to empty).

Must be consistent with Hz or km/s.
If the given unit is illegal, False is returned and the internal state unchanged. This unit is used by the function format when the given unit is empty.

Definition at line 541 of file SpectralCoordinate.h.

References formatUnit_p.

## frequencySystem()

MFrequency::Types casacore::SpectralCoordinate::frequencySystem | ( | Bool | showConversion = False | ) | const

Retrieve/set the frequency system.

Note that setting the frequency system just changes the internal value of the frequency system. In addition, it will reset the internal conversion frequency system to the new type and delete any conversion machines.

References casacore::False.

## frequencyToAirWavelength()

Bool casacore::SpectralCoordinate::frequencyToAirWavelength | ( | Vector< Double > & | wavelength,
|  | const Vector< Double > & | frequency ) const

## frequencyToVelocity() [1/5]

Bool casacore::SpectralCoordinate::frequencyToVelocity | ( | Double & | velocity,
|  | Double | frequency ) const

## frequencyToVelocity() [2/5]

Bool casacore::SpectralCoordinate::frequencyToVelocity | ( | Quantum< Double > & | velocity,
|  | const MFrequency & | frequency ) const

## frequencyToVelocity() [3/5]

Bool casacore::SpectralCoordinate::frequencyToVelocity | ( | Quantum< Double > & | velocity,
|  | const MVFrequency & | frequency ) const

## frequencyToVelocity() [4/5]

Bool casacore::SpectralCoordinate::frequencyToVelocity | ( | Quantum< Double > & | velocity,
|  | Double | frequency ) const

## frequencyToVelocity() [5/5]

Bool casacore::SpectralCoordinate::frequencyToVelocity | ( | Vector< Double > & | velocity,
|  | const Vector< Double > & | frequency ) const

## frequencyToWavelength()

Bool casacore::SpectralCoordinate::frequencyToWavelength | ( | Vector< Double > & | wavelength,
|  | const Vector< Double > & | frequency ) const

## fromCurrent()

void casacore::SpectralCoordinate::fromCurrent | ( | Vector< Double > & | value | ) | const

private

References casacore::NewDelAllocator< T >::value.

## getReferenceConversion()

void casacore::SpectralCoordinate::getReferenceConversion | ( | MFrequency::Types & | type,
|  | MEpoch & | epoch,
|  | MPosition & | position,
|  | MDirection & | direction ) const

inline

Definition at line 271 of file SpectralCoordinate.h.

References conversionType_p, direction_p, epoch_p, position_p, and type().

## increment()

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

virtual

Implements casacore::Coordinate.

## isTabular()

Bool casacore::SpectralCoordinate::isTabular | ( |  | ) | const

is this a tabular coordinate?

## linearTransform()

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

virtual

Implements casacore::Coordinate.

## makeConversionMachines()

Int casacore::SpectralCoordinate::makeConversionMachines | ( | MFrequency::Types | type,
|  | MFrequency::Types | conversionType,
|  | const MEpoch & | epoch,
|  | const MPosition & | position,
|  | const MDirection & | direction )

private

Set up pixel<->world conversion machines Returns: 3 (machines were noOPs, machines deleted) 2 (types the same, machines deleted), 1 (machines created and functioning) -1 (machines could not make trial conversion, machines deleted).

References type().

## makeFourierCoordinate()

virtual Coordinate * casacore::SpectralCoordinate::makeFourierCoordinate | ( | const Vector< Bool > & | axes,
|  | const Vector< Int > & | shape ) const

virtual

Find the Coordinate for when we Fourier Transform ourselves.

This pointer must be deleted by the caller. Axes specifies which axes of the Coordinate you wish to transform. Shape specifies the shape of the image associated with all the axes of the Coordinate. Currently the output reference pixel is always shape/2. Cannot transform tabular coordinates. If the pointer returned is 0, it failed with a message in errorMessage

Reimplemented from casacore::Coordinate.

References casacore::Coordinate::Coordinate(), and casacore::shape().

## makeVelocityMachine()

void casacore::SpectralCoordinate::makeVelocityMachine | ( | const String & | velUnit,
|  | MDoppler::Types | velType,
|  | const Unit & | freqUnit,
|  | MFrequency::Types | freqType,
|  | Double | restFreq )

private

Create velocity<->frequency machine.

## makeWCS()

void casacore::SpectralCoordinate::makeWCS | ( | wcsprm & | wcs,
|  | const String & | ctype,
|  | Double | refPix,
|  | Double | refVal,
|  | Double | inc,
|  | Double | pc,
|  | Double | restFreq )

static private

Make spectral wcs structure (items in Hz).

References casacore::ctype().

## nativeType()

SpectralCoordinate::SpecType casacore::SpectralCoordinate::nativeType | ( |  | ) | const

inline

Definition at line 341 of file SpectralCoordinate.h.

References nativeType_p.

## near() [1/2]

virtual Bool casacore::SpectralCoordinate::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::SpectralCoordinate::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, errorMessage() contains a message about why.

Implements casacore::Coordinate.

References casacore::Coordinate::Coordinate().

## nPixelAxes()

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

virtual

Always returns 1.

Implements casacore::Coordinate.

## nWorldAxes()

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

virtual

Implements casacore::Coordinate.

## operator=()

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

Assignment (copy semantics).

References SpectralCoordinate().

## pixelToVelocity() [1/3]

Bool casacore::SpectralCoordinate::pixelToVelocity | ( | Double & | velocity,
|  | Double | pixel ) const

## pixelToVelocity() [2/3]

Bool casacore::SpectralCoordinate::pixelToVelocity | ( | Quantum< Double > & | velocity,
|  | Double | pixel ) const

Functions to convert to velocity (uses the current active rest frequency) or wavelength.

There is no reference frame change but you can specify the velocity Doppler and the output units of the velocity with function setVelocity or setWavelength respectively. When the input is a frequency stored as a Double it must be in the current units of the SpectralCoordinate.

Note that the extra conversion layer (see function setReferenceConversion) is active in the pixelToVelocity functions (because internally the use toWorld) but not in the frequencyToVelocity or frequencyToWavelength functions.

## pixelToVelocity() [3/3]

Bool casacore::SpectralCoordinate::pixelToVelocity | ( | Vector< Double > & | velocity,
|  | const Vector< Double > & | pixel ) const

## pixelValues()

Vector< Double > casacore::SpectralCoordinate::pixelValues | ( |  | ) | const

Get the table, i.e.

the pixel and world values. The length of these Vectors will be zero if this axis is pure linear (i.e. if the channel and frequencies are related through an increment and offset).

## print()

ostream & casacore::SpectralCoordinate::print | ( | ostream & | os | ) | const

## referencePixel()

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

virtual

Implements casacore::Coordinate.

## referenceValue()

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

virtual

Implements casacore::Coordinate.

## restFrequencies()

const Vector< Double > & casacore::SpectralCoordinate::restFrequencies | ( |  | ) | const

## restFrequency()

Double casacore::SpectralCoordinate::restFrequency | ( |  | ) | const

The SpectralCoordinate can maintain a list of rest frequencies (e.g.

multiple lines within a band). However, only one of them is active (e.g. for velocity conversions) at any one time. Function restFrequency returns that frequency. Function restFrequencies returns
all of the possible restfrequencies.

When you construct the SpectralCoordinate, you give it one rest frequency and it is the active one. Thereafter you can add a new restfrequency with function setRestFrequency (append=True) and that frequency will become the active one. With this function and append=False, the current active restfrequency will be replaced by the one you give.

You can change the list of restfrequencies with function setRestFrequencies. When you do so, you can either replace the list of rest frequencies or append to it. You specify which frequency of the new (appended) list becomes active.

You can also select the active rest frequency either by an index into the current list (exception if out of range) given by restFrequencies() or by the value in the list nearest to the frequency you give.

Whenever you change the active rest frequency, the class internals are adjusted (e.g. the velocity machine is updated).

Referenced by SpectralCoordinate(), SpectralCoordinate(), SpectralCoordinate(), SpectralCoordinate(), SpectralCoordinate(), and SpectralCoordinate().

## restore()

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

static

Recover the SpectralCoordinate from a record.

A null pointer means that the restoration did not succeed.

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

## restoreConversion()

void casacore::SpectralCoordinate::restoreConversion | ( | SpectralCoordinate *& | pSpectral,
|  | const RecordInterface & | subrec )

static private

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

## restoreRestFrequencies()

void casacore::SpectralCoordinate::restoreRestFrequencies | ( | SpectralCoordinate *& | pSpectral,
|  | const RecordInterface & | subrec,
|  | Double | restFreq )

static private

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

## restoreVelocity()

void casacore::SpectralCoordinate::restoreVelocity | ( | SpectralCoordinate *& | pSpectral,
|  | const RecordInterface & | subrec )

static private

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

## restoreVersion1()

SpectralCoordinate * casacore::SpectralCoordinate::restoreVersion1 | ( | const RecordInterface & | container | ) |

static private

Record restoration handling.

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

## restoreVersion2()

SpectralCoordinate * casacore::SpectralCoordinate::restoreVersion2 | ( | const RecordInterface & | container | ) |

static private

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

## save()

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

virtual

Old interface.

Handled by wcs in new interface in FITSCoordinateUtil.cc static Bool fromFITSOld(SpectralCoordinate &out, String &error, const RecordInterface &header, uInt whichAxis, LogIO &logger, Bool oneRelative=True);

Save the SpectralCoordinate into the supplied record using the supplied field name. The field must not exist, otherwise False is returned.

Implements casacore::Coordinate.

References casacore::RecordInterface().

## selectRestFrequency() [1/2]

void casacore::SpectralCoordinate::selectRestFrequency | ( | Double | frequency | ) |

## selectRestFrequency() [2/2]

void casacore::SpectralCoordinate::selectRestFrequency | ( | uInt | which | ) |

## setFormatUnit()

Bool casacore::SpectralCoordinate::setFormatUnit | ( | const String & | unit | ) |

## setFrequencySystem()

void casacore::SpectralCoordinate::setFrequencySystem | ( | MFrequency::Types | type,
|  | Bool | verbose = True )

References casacore::True, and type().

## setIncrement()

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

virtual

Implements casacore::Coordinate.

## setLinearTransform()

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

virtual

Implements casacore::Coordinate.

## setNativeType()

Bool casacore::SpectralCoordinate::setNativeType | ( | const SpectralCoordinate::SpecType | spcType | ) |

## setReferenceConversion()

Bool casacore::SpectralCoordinate::setReferenceConversion | ( | MFrequency::Types | type,
|  | const MEpoch & | epoch,
|  | const MPosition & | position,
|  | const MDirection & | direction )

Set extra conversion layer.

Whenever a conversion from pixel to world is done, the world value is then further converted to this MFrequency::Types value. For example, your SpectralCoordinate may be defined in LSRK. You can use this to get the world values out in say BARY. You must specify the position on earth, the epoch and the direction for the conversions and it is your responsibility to ensure they are viable. Similarly, whenever you convert from world to pixel, the world value is assumed to be that appropriate to the setReferenceConversion type. It is first converted to the MFrequency::Types with which the SpectralCoordinate was constructed and from there to pixel. If you don't call this function, or you set the same type for which the SpectralCoordinate was constructed, no extra conversions occur. Some conversions will fail. These are the ones that require extra frame information (radial velocity) such as to REST. This will be added later. In this case this function returns False (and the conversion parameters are all left as they were), else it returns True.

References type().

## setReferencePixel()

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

virtual

Implements casacore::Coordinate.

## setReferenceValue()

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

virtual

Implements casacore::Coordinate.

## setRestFrequencies()

void casacore::SpectralCoordinate::setRestFrequencies | ( | const Vector< Double > & | newFrequencies,
|  | uInt | which = 0,
|  | Bool | append = False )

References casacore::False.

## setRestFrequency()

Bool casacore::SpectralCoordinate::setRestFrequency | ( | Double | newFrequency,
|  | Bool | append = False )

References casacore::False.

## setVelocity()

Bool casacore::SpectralCoordinate::setVelocity | ( | const String & | velUnit = String("km/s"),
|  | MDoppler::Types | velType = MDoppler::RADIO )

Set the state that is used for conversions from pixel and frequency to velocity or wavelength.

The SpectralCoordinate is constructed with MDoppler::RADIO and km/s as the velocity conversion state and mm as the wavelength conversion state. The functions in this class which use this state are those that convert to or from velocity. Also, function format uses the Doppler state set here. If the function returns False it means the unit was not valid. There will be an error message in function errorMessage

References casacore::MDoppler::RADIO.

## setWavelengthUnit()

Bool casacore::SpectralCoordinate::setWavelengthUnit | ( | const String & | waveUnit = String("mm") | ) |

## setWorldAxisNames()

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

virtual

Set the value of the requested attribute.

Note that these just change the internal values, they do not cause any recomputation.

Implements casacore::Coordinate.

## setWorldAxisUnits()

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

virtual

Set/get the unit.

Adjust the increment and reference value by the ratio of the old and new units. The unit must be compatible with frequency.

Implements casacore::Coordinate.

## showType()

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

virtual

Always returns the String "Spectral".

Implements casacore::Coordinate.

## specTypetoString()

Bool casacore::SpectralCoordinate::specTypetoString | ( | String & | stypeString,
|  | const SpecType & | specType )

static

Convert from String to spectral type and vice versa.

## stringtoSpecType()

Bool casacore::SpectralCoordinate::stringtoSpecType | ( | SpecType & | specType,
|  | const String & | stypeString )

static

## toCurrent()

void casacore::SpectralCoordinate::toCurrent | ( | Vector< Double > & | value | ) | const

private

Interconvert between the current units and wcs units (Hz).

References casacore::NewDelAllocator< T >::value.

## toCurrentFactors()

const Vector< Double > casacore::SpectralCoordinate::toCurrentFactors | ( |  | ) | const

private

Return unit conversion vector for converting to current units.

## toFITS()

void casacore::SpectralCoordinate::toFITS | ( | RecordInterface & | header,
|  | uInt | whichAxis,
|  | LogIO & | logger,
|  | Bool | oneRelative = True,
|  | Bool | preferVelocity = True,
|  | Bool | opticalVelDef = True,
|  | Bool | preferWavelength = False,
|  | Bool | airWaveDef = False ) const

Convert to FITS header record.

When writing the FITS record, the fields "ctype, crval, crpix", and "cdelt" must already be created. Other header words are created as needed. Use oneRelative=True to convert zero-relative SpectralCoordinate pixel coordinates to one-relative FITS coordinates, and vice-versa. If preferVelocity=True the primary axis type will be velocity, if preferWavelength=True it will be wavelength, else frequency. For a velocity axis, if opticalVelDef=False, the radio velocity definition will be used, else optical definition. Similarly for a wavelength axis, if airWaveDef=True air wavelength will be used, the default is vacuum wavelength.

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

## toPixel() [1/4]

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

## toPixel() [2/4]

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

## toPixel() [3/4]

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

## toPixel() [4/4]

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

virtual

Implements casacore::Coordinate.

## toPixelMany()

virtual Bool casacore::SpectralCoordinate::toPixelMany | ( | Matrix< Double > & | pixel,
|  | const Matrix< Double > & | world,
|  | Vector< Bool > & | failures ) const

virtual

Reimplemented from casacore::Coordinate.

## toWorld() [1/4]

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

## toWorld() [2/4]

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

Convert a pixel (channel number) into an MFrequency or MVFrequency and vice versa.

Usually you will do this for calculating velocities or converting frequencies from one frame to another.

## toWorld() [3/4]

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

## toWorld() [4/4]

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

virtual

Convert a pixel to a world coordinate or vice versa.

Returns True if the conversion succeeds, otherwise it returns False and errorMessage() contains an error message. The input vectors must be of length one and the output vectors are resized if they are not already of length one. if useConversionFrame, if the coordinate has a conversion layer frame, it is used. Else, the native frame is used for the conversion.

Implements casacore::Coordinate.

References casacore::True.

## toWorldMany()

virtual Bool casacore::SpectralCoordinate::toWorldMany | ( | Matrix< Double > & | world,
|  | const Matrix< Double > & | pixel,
|  | Vector< Bool > & | failures ) const

virtual

Batch up a lot of transformations.

The first (most rapidly varying) axis of the matrices contain the coordinates. Returns False if any conversion failed and errorMessage() will hold a message. The failures array (True for fail, False for success) is the length of the number of conversions and holds an error status for each conversion.

Reimplemented from casacore::Coordinate.

## transformFrequencySystem()

Bool casacore::SpectralCoordinate::transformFrequencySystem | ( | MFrequency::Types | type,
|  | const MEpoch & | epoch,
|  | const MPosition & | position,
|  | const MDirection & | direction )

Transform the SpectralCoordinate to a different native reference frame keeping the conversion layer as is.

References type().

## type()

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

virtual

Always returns Coordinate::SPECTRAL.

Implements casacore::Coordinate.

Referenced by getReferenceConversion(), makeConversionMachines(), setFrequencySystem(), setReferenceConversion(), SpectralCoordinate(), SpectralCoordinate(), SpectralCoordinate(), SpectralCoordinate(), and transformFrequencySystem().

## updateVelocityMachine()

void casacore::SpectralCoordinate::updateVelocityMachine | ( | const String & | velUnit,
|  | MDoppler::Types | velType )

private

Update Velocity Machine.

## velocityDoppler()

MDoppler::Types casacore::SpectralCoordinate::velocityDoppler | ( |  | ) | const

inline

Definition at line 334 of file SpectralCoordinate.h.

References velType_p.

## velocityToFrequency() [1/2]

Bool casacore::SpectralCoordinate::velocityToFrequency | ( | Double & | frequency,
|  | Double | velocity ) const

## velocityToFrequency() [2/2]

Bool casacore::SpectralCoordinate::velocityToFrequency | ( | Vector< Double > & | frequency,
|  | const Vector< Double > & | velocity ) const

## velocityToPixel() [1/2]

Bool casacore::SpectralCoordinate::velocityToPixel | ( | Double & | pixel,
|  | Double | velocity ) const

The refractive index of air (argument can be wavelength or airwavelength) according to Greisen et al., 2006, A&A, 464, 746.

If airwavelength is used there is an error of the order of 1E-9. Argument must be in micrometers!
static Double refractiveIndex(const Double& lambda_um);

Functions to convert from velocity (uses the current active rest frequency) or wavelength. There is no reference frame change but you can specify the velocity Doppler and the output units of the velocity with function setVelocity and those of the wavelength with setWavelength. When the input is a frequency stored as a Double it must be in the current units of the SpectralCoordinate.

Note that the extra conversion layer (see function setReferenceConversion) is active in the pixelToVelocity functions (because internally the use toPixel) but not in the frequencyToVelocity functions.

## velocityToPixel() [2/2]

Bool casacore::SpectralCoordinate::velocityToPixel | ( | Vector< Double > & | pixel,
|  | const Vector< Double > & | velocity ) const

## velocityUnit()

String casacore::SpectralCoordinate::velocityUnit | ( |  | ) | const

inline

Definition at line 335 of file SpectralCoordinate.h.

References velUnit_p.

## wavelengthToFrequency()

Bool casacore::SpectralCoordinate::wavelengthToFrequency | ( | Vector< Double > & | frequency,
|  | const Vector< Double > & | wavelength ) const

## wavelengthUnit()

String casacore::SpectralCoordinate::wavelengthUnit | ( |  | ) | const

inline

Definition at line 338 of file SpectralCoordinate.h.

References waveUnit_p.

## wcsRestore()

Bool casacore::SpectralCoordinate::wcsRestore | ( | Double & | crval,
|  | Double & | crpix,
|  | Double & | cdelt,
|  | Double & | pc,
|  | String & | ctype,
|  | const RecordInterface & | rec )

static private

Restore wcs stuff from Record.

References casacore::cdelt(), casacore::crpix(), casacore::crval(), casacore::ctype(), and casacore::RecordInterface().

## wcsSave()

Bool casacore::SpectralCoordinate::wcsSave | ( | RecordInterface & | rec,
|  | const wcsprm & | wcs,
|  | const String & | fieldName ) const

private

Save wcs stuff into Record.

References casacore::RecordInterface().

## worldAxisNames()

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

virtual

Report the value of the requested attribute.

Implements casacore::Coordinate.

## worldAxisUnits()

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

virtual

Implements casacore::Coordinate.

## worldValues()

Vector< Double > casacore::SpectralCoordinate::worldValues | ( |  | ) | const

## Member Data Documentation

## _tabular

std::unique_ptr<TabularCoordinate> casacore::SpectralCoordinate::_tabular

private

Definition at line 593 of file SpectralCoordinate.h.

## axisName_p

String casacore::SpectralCoordinate::axisName_p

private

Definition at line 614 of file SpectralCoordinate.h.

## conversionType_p

MFrequency::Types casacore::SpectralCoordinate::conversionType_p

private

Definition at line 598 of file SpectralCoordinate.h.

Referenced by getReferenceConversion().

## direction_p

MDirection casacore::SpectralCoordinate::direction_p

private

Definition at line 617 of file SpectralCoordinate.h.

Referenced by getReferenceConversion().

## epoch_p

MEpoch casacore::SpectralCoordinate::epoch_p

private

Definition at line 619 of file SpectralCoordinate.h.

Referenced by getReferenceConversion().

## formatUnit_p

String casacore::SpectralCoordinate::formatUnit_p

private

Definition at line 615 of file SpectralCoordinate.h.

Referenced by formatUnit().

## nativeType_p

SpectralCoordinate::SpecType casacore::SpectralCoordinate::nativeType_p

private

Definition at line 611 of file SpectralCoordinate.h.

Referenced by nativeType().

## pConversionMachineFrom_p

MFrequency::Convert* casacore::SpectralCoordinate::pConversionMachineFrom_p

mutable private

Definition at line 604 of file SpectralCoordinate.h.

## pConversionMachineTo_p

MFrequency::Convert* casacore::SpectralCoordinate::pConversionMachineTo_p

mutable private

Conversion machines; for pixel<->world conversions only.

Definition at line 603 of file SpectralCoordinate.h.

## position_p

MPosition casacore::SpectralCoordinate::position_p

private

Definition at line 618 of file SpectralCoordinate.h.

Referenced by getReferenceConversion().

## pVelocityMachine_p

VelocityMachine* casacore::SpectralCoordinate::pVelocityMachine_p

private

Definition at line 606 of file SpectralCoordinate.h.

## restfreqIdx_p

uInt casacore::SpectralCoordinate::restfreqIdx_p

private

Definition at line 600 of file SpectralCoordinate.h.

## restfreqs_p

Vector<Double> casacore::SpectralCoordinate::restfreqs_p

private

Definition at line 599 of file SpectralCoordinate.h.

## to_hz_p

Double casacore::SpectralCoordinate::to_hz_p

private

Definition at line 595 of file SpectralCoordinate.h.

## to_m_p

Double casacore::SpectralCoordinate::to_m_p

private

Definition at line 596 of file SpectralCoordinate.h.

## type_p

MFrequency::Types casacore::SpectralCoordinate::type_p

private

Definition at line 598 of file SpectralCoordinate.h.

## unit_p

Unit casacore::SpectralCoordinate::unit_p

private

Definition at line 613 of file SpectralCoordinate.h.

## velType_p

MDoppler::Types casacore::SpectralCoordinate::velType_p

private

Definition at line 607 of file SpectralCoordinate.h.

Referenced by velocityDoppler().

## velUnit_p

String casacore::SpectralCoordinate::velUnit_p

private

Definition at line 608 of file SpectralCoordinate.h.

Referenced by velocityUnit().

## waveUnit_p

String casacore::SpectralCoordinate::waveUnit_p

private

Definition at line 610 of file SpectralCoordinate.h.

Referenced by wavelengthUnit().

## wcs_p

mutable::wcsprm casacore::SpectralCoordinate::wcs_p

private

Definition at line 594 of file SpectralCoordinate.h.

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

- coordinates/Coordinates/SpectralCoordinate.h