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