30 #ifndef COORDINATES_SPECTRALCOORDINATE_H
31 #define COORDINATES_SPECTRALCOORDINATE_H
33 #include <casacore/casa/aips.h>
34 #include <casacore/casa/Arrays/Vector.h>
35 #include <casacore/coordinates/Coordinates/Coordinate.h>
36 #include <casacore/coordinates/Coordinates/ObsInfo.h>
37 #include <casacore/measures/Measures/MFrequency.h>
38 #include <casacore/measures/Measures/MDoppler.h>
39 #include <casacore/measures/Measures/MDirection.h>
40 #include <casacore/measures/Measures/MPosition.h>
41 #include <casacore/measures/Measures/MEpoch.h>
42 #include <casacore/casa/Quanta/Quantum.h>
43 #include <casacore/casa/Utilities/PtrHolder.h>
45 #include <wcslib/wcs.h>
51 class TabularCoordinate;
54 class VelocityMachine;
55 template<
class T>
class Quantum;
574 const String &fieldName)
const;
654 const Unit& freqUnit,
695 const String& fieldName)
const;
Hold and delete pointers not deleted by object destructors.
Type
This enum lists the types of the derived classes.
formatType
This enum is used for formatting world values into Strings.
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
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)
const Vector< Double > toCurrentFactors() const
Return unit conversion vector for converting to current units.
Bool velocityToFrequency(Vector< Double > &frequency, const Vector< Double > &velocity) const
Bool frequencyToAirWavelength(Vector< Double > &wavelength, const Vector< Double > &frequency) const
Vector< Double > pixelValues() const
Get the table, i.e.
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).
static SpectralCoordinate * restoreVersion2(const RecordInterface &container)
virtual void convertTo(Vector< Double > &world) const
Convert to and from conversion reference type.
virtual Coordinate * clone() const
Make a copy of the SpectralCoordinate using new.
SpectralCoordinate(MFrequency::Types type, const Vector< Double > &freqs, Double restFrequency=0.0)
Construct a SpectralCoordinate with the specified frequencies (in Hz).
Bool wcsSave(RecordInterface &rec, const wcsprm &wcs, const String &fieldName) const
Save wcs stuff into Record.
virtual void convertFrom(Vector< Double > &world) const
Bool velocityToPixel(Vector< Double > &pixel, const Vector< Double > &velocity) const
SpectralCoordinate(const SpectralCoordinate &other)
Copy constructor (copy semantics).
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.
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 a...
String wavelengthUnit() const
Vector< Double > restfreqs_p
virtual Bool setWorldAxisNames(const Vector< String > &names)
Set the value of the requested attribute.
Bool toWorld(MFrequency &world, Double pixel) const
Convert a pixel (channel number) into an MFrequency or MVFrequency and vice versa.
Bool pixelToVelocity(Quantum< Double > &velocity, Double pixel) const
Functions to convert to velocity (uses the current active rest frequency) or wavelength.
virtual Bool toWorldMany(Matrix< Double > &world, const Matrix< Double > &pixel, Vector< Bool > &failures) const
Batch up a lot of transformations.
virtual Coordinate::Type type() const
Always returns Coordinate::SPECTRAL.
ostream & print(ostream &os) const
virtual Vector< String > worldAxisUnits() const
Bool frequencyToVelocity(Quantum< Double > &velocity, Double frequency) const
static void restoreVelocity(SpectralCoordinate *&pSpectral, const RecordInterface &subrec)
static void restoreRestFrequencies(SpectralCoordinate *&pSpectral, const RecordInterface &subrec, Double restFreq)
Bool frequencyToVelocity(Double &velocity, Double frequency) const
Bool pixelToVelocity(Vector< Double > &velocity, const Vector< Double > &pixel) const
String formatUnit() const
Set the default formatter unit (which is initialized to empty).
MFrequency::Convert * pConversionMachineTo_p
Conversion machines; for pixel<->world conversions only.
static SpectralCoordinate * restore(const RecordInterface &container, const String &fieldName)
Recover the SpectralCoordinate from a record.
Bool wavelengthToFrequency(Vector< Double > &frequency, const Vector< Double > &wavelength) const
Bool toPixel(Double &pixel, const Double &world) const
SpectralCoordinate()
Default constructor.
virtual Vector< String > worldAxisNames() const
Report the value of the requested attribute.
Bool toPixel(Double &pixel, const MVFrequency &world) const
Double restFrequency() const
The SpectralCoordinate can maintain a list of rest frequencies (e.g.
void selectRestFrequency(Double frequency)
virtual Bool setReferencePixel(const Vector< Double > &refPix)
MDoppler::Types velType_p
virtual Vector< Double > increment() const
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,...
static Bool stringtoSpecType(SpecType &specType, const String &stypeString)
MFrequency::Types conversionType_p
Bool frequencyToVelocity(Quantum< Double > &velocity, const MVFrequency &frequency) const
virtual Bool toPixelMany(Matrix< Double > &pixel, const Matrix< Double > &world, Vector< Bool > &failures) const
void toCurrent(Vector< Double > &value) const
Interconvert between the current units and wcs units (Hz)
static Bool specTypetoString(String &stypeString, const SpecType &specType)
Convert from String to spectral type and vice versa.
void setRestFrequencies(const Vector< Double > &newFrequencies, uInt which=0, Bool append=False)
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).
String formatRestFrequencies() const
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.
virtual Vector< Double > referenceValue() const
Bool setFormatUnit(const String &unit)
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.
VelocityMachine * pVelocityMachine_p
void _setTabulatedFrequencies(const Vector< Double > &freqs)
Bool setWavelengthUnit(const String &waveUnit=String("mm"))
void makeVelocityMachine(const String &velUnit, MDoppler::Types velType, const Unit &freqUnit, MFrequency::Types freqType, Double restFreq)
Create velocity<->frequency machine
const Vector< Double > & restFrequencies() const
virtual Bool save(RecordInterface &container, const String &fieldName) const
Old interface.
void setFrequencySystem(MFrequency::Types type, Bool verbose=True)
static void restoreConversion(SpectralCoordinate *&pSpectral, const RecordInterface &subrec)
Bool airWavelengthToFrequency(Vector< Double > &frequency, const Vector< Double > &wavelength) const
SPtrHolder< TabularCoordinate > _tabular
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 ...
virtual uInt nWorldAxes() const
virtual String showType() const
Always returns the String "Spectral".
static Bool wcsRestore(Double &crval, Double &crpix, Double &cdelt, Double &pc, String &ctype, const RecordInterface &rec)
Restore wcs stuff from Record.
String velocityUnit() const
virtual Bool setReferenceValue(const Vector< Double > &refval)
SpectralCoordinate & operator=(const SpectralCoordinate &other)
Assignment (copy semantics).
SpectralCoordinate::SpecType nativeType() const
Bool frequencyToWavelength(Vector< Double > &wavelength, const Vector< Double > &frequency) const
Bool frequencyToVelocity(Vector< Double > &velocity, const Vector< Double > &frequency) const
Bool velocityToFrequency(Double &frequency, Double velocity) const
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.
MFrequency::Types frequencySystem(Bool showConversion=False) const
Retrieve/set the frequency system.
virtual Bool setWorldAxisUnits(const Vector< String > &units)
Set/get the unit.
void selectRestFrequency(uInt which)
void deleteConversionMachines()
Deletes and sets pointers to 0.
Vector< Double > worldValues() const
Bool setRestFrequency(Double newFrequency, Bool append=False)
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.
Bool pixelToVelocity(Double &velocity, Double pixel) const
virtual Bool near(const Coordinate &other, Double tol=1e-6) const
Comparison function.
virtual Coordinate * makeFourierCoordinate(const Vector< Bool > &axes, const Vector< Int > &shape) const
Find the Coordinate for when we Fourier Transform ourselves.
virtual Bool setIncrement(const Vector< Double > &inc)
Bool isTabular() const
is this a tabular coordinate?
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 ~SpectralCoordinate()
Destructor.
void checkFormat(Coordinate::formatType &format, const Bool) const
Format checker.
virtual Bool toPixel(Vector< Double > &pixel, const Vector< Double > &world) const
Bool setNativeType(const SpectralCoordinate::SpecType spcType)
Bool toWorld(MVFrequency &world, Double pixel) const
SpectralCoordinate(MFrequency::Types freqType, const ::wcsprm &wcs, Bool oneRel=True)
Construct from wcs structure.
Bool velocityToPixel(Double &pixel, Double velocity) const
The refractive index of air (argument can be wavelength or airwavelength) according to Greisen et al....
void fromCurrent(Vector< Double > &value) const
virtual Bool near(const Coordinate &other, const Vector< Int > &excludeAxes, Double tol=1e-6) const
MDoppler::Types velocityDoppler() const
virtual Matrix< Double > linearTransform() const
Bool setReferenceConversion(MFrequency::Types type, const MEpoch &epoch, const MPosition &position, const MDirection &direction)
Set extra conversion layer.
void updateVelocityMachine(const String &velUnit, MDoppler::Types velType)
Update Velocity Machine.
SpectralCoordinate::SpecType nativeType_p
void deleteVelocityMachine()
Deletes and sets pointer to 0.
Bool toPixel(Double &pixel, const MFrequency &world) const
virtual Vector< Double > referencePixel() const
virtual Bool setLinearTransform(const Matrix< Double > &xform)
Bool toWorld(Double &world, const Double &pixel) const
void copy(const SpectralCoordinate &other)
Copy private data.
virtual uInt nPixelAxes() const
Always returns 1.
Bool frequencyToVelocity(Quantum< Double > &velocity, const MFrequency &frequency) const
MFrequency::Convert * pConversionMachineFrom_p
static SpectralCoordinate * restoreVersion1(const RecordInterface &container)
Record restoration handling.
String: the storage and methods of handling collections of characters.
const Double e
e and functions thereof:
this file contains all the compiler specific defines
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
bool Bool
Define the standard types used by Casacore.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.