casa
5.7.0-16
|
Base class for spectral models. More...
#include <SpectralModel.h>
Public Member Functions | |
virtual | ~SpectralModel () |
a virtual destructor is needed so that the actual destructor in the derived class will be used. More... | |
virtual ComponentType::SpectralShape | type () const =0 |
return the actual spectral type. More... | |
virtual const casacore::String & | ident () const |
Specify the identification of the record (e.g. More... | |
virtual void | setRefFrequency (const casacore::MFrequency &newRefFreq) |
set/get the reference frequency More... | |
const casacore::MFrequency & | refFrequency () const |
const casacore::Unit & | frequencyUnit () const |
get the frequency unit, and change the default frequency unit to the specified one. More... | |
void | convertFrequencyUnit (const casacore::Unit &freqUnit) |
void | setRefFrequencyError (const casacore::Quantum< casacore::Double > &newRefFreqErr) |
set/get the error in the reference frequency. More... | |
const casacore::Quantum < casacore::Double > & | refFrequencyError () const |
virtual casacore::Double | sample (const casacore::MFrequency ¢erFrequency) const =0 |
Return the scaling factor that indicates what proportion of the flux is at the specified frequency. More... | |
virtual void | sampleStokes (const casacore::MFrequency ¢erFrequency, casacore::Vector< casacore::Double > &stokesval) const =0 |
return full casacore::Stokes version especially for models which have different frequency dependence for the casacore::Stokes param (1 or 4 elements) So as allow for fractional pol change and angle change of linear pol w.r.t frequency A a four casacore::Vector of original IQUV should be passed in and it will hold the return values More... | |
virtual void | sample (casacore::Vector< casacore::Double > &scale, const casacore::Vector< casacore::MFrequency::MVType > &frequencies, const casacore::MFrequency::Ref &refFrame) const =0 |
Same as the previous function except that many frequencies can be sampled at once. More... | |
virtual void | sampleStokes (casacore::Vector< casacore::Vector< casacore::Double > > &stokesval, const casacore::Vector< casacore::MFrequency::MVType > &frequencies, const casacore::MFrequency::Ref &refFrame) const =0 |
So as allow for fractional pol change and angle change of linear pol w.r.t frequency casacore::Vector of four Vectors of original IQUV should be passed in and it will hold the return values Uitimately this math should really go in Flux and FluxRep to where a rotation of linear pol is allowed. More... | |
virtual SpectralModel * | clone () const =0 |
Return a pointer to a copy of the derived object upcast to a SpectralModel object. More... | |
virtual casacore::uInt | nParameters () const =0 |
return the number of parameters in this spectral shape and set/get them. More... | |
virtual void | setParameters (const casacore::Vector< casacore::Double > &newParms)=0 |
virtual casacore::Vector < casacore::Double > | parameters () const =0 |
virtual void | setErrors (const casacore::Vector< casacore::Double > &newErrors)=0 |
virtual casacore::Vector < casacore::Double > | errors () const =0 |
virtual casacore::Bool | fromRecord (casacore::String &errorMessage, const casacore::RecordInterface &record)=0 |
These functions convert between a record and a SpectralModel. More... | |
virtual casacore::Bool | toRecord (casacore::String &errorMessage, casacore::RecordInterface &record) const =0 |
Convert the class to an Record representation. More... | |
virtual casacore::Bool | convertUnit (casacore::String &errorMessage, const casacore::RecordInterface &record)=0 |
Convert the parameters of the spectral model to the specified units. More... | |
virtual casacore::Bool | ok () const |
casacore::Function which checks the internal data of this class for correct dimensionality and consistant values. More... | |
Public Member Functions inherited from casacore::RecordTransformable | |
virtual | ~RecordTransformable () |
The destructor must be virtual so that the destructor of derived classes is actually used. More... | |
virtual Bool | fromString (String &error, const String &inString) |
Initialise the class from a String representation. More... | |
Static Public Member Functions | |
static ComponentType::SpectralShape | getType (casacore::String &errorMessage, const casacore::RecordInterface &record) |
Return the spectral shape that the supplied record represents. More... | |
Protected Member Functions | |
SpectralModel () | |
The constructors and assignment operator are protected as only derived classes should use them. More... | |
SpectralModel (const casacore::MFrequency &refFreq, const casacore::Unit &=casacore::Unit("GHz")) | |
SpectralModel (const SpectralModel &other) | |
SpectralModel & | operator= (const SpectralModel &other) |
casacore::Double | refFreqInFrame (const casacore::MFrequency::Ref &frame) const |
Return the value refFrequency in the requested frame... More... | |
Static Protected Member Functions | |
static casacore::Bool | badError (const casacore::Quantum< casacore::Double > &quantum) |
returns true if the quantum is not a non-negative quantity with units dimensionally identical to the Hz More... | |
Private Attributes | |
casacore::MFrequency | itsRefFreq |
casacore::Unit | itsFreqUnit |
casacore::Quantity | itsFreqErr |
Base class for spectral models.
Public interface
This abstract base class defines the interface for different classes which model the spectrum of a component. The most fundamental derived class is the ConstantSpectrum class but the SpectralIndex class is also available. These classes model the spectrum of emission from the sky.
Classes derived from the ComponentShape class are used to model the shape and the Flux class is used to model the flux. The SkyComponent class incorporates these three characteristics (flux, shape & spectrum) and the ComponentList class handles groups of SkyComponent objects.
This class parameterises spectral models with two quantities.
The basic operation of classes using this interface is to model the flux as a function of frequency. Classes derived from this one do not know what the flux is at the reference frequency. Instead the sample functions return factors that are used to scale the flux and calculate the amount of flux at a specified frequency.
Any allowed frequency reference frame can be used. However the reference frame must be adequately specified in order to allow conversions to other reference frames. For example if the reference frame code for the frequency is casacore::MFrequency::TOPO then the reference frame must also contain the time, position on the earth, and direction of the observation that corresponds to the specified frequency. This way the sample functions can convert the frequency to a value in the LSR reference frame (if you specify the sample frequency in the LSR frame).
Because this is an abstract base class, an actual instance of this class cannot be constructed. However the interface it defines can be used inside a function. This is always recommended as it allows functions which have SpectralModels as arguments to work for any derived class.
In this example the plotSpectrum function prints out the type of spectral model it is working with and the reference frequency of that model. It then uses the model to calculate the proportion of the flux at other frequencies. This example is coded in the dSpectralModel.cc file.
The SpectralModel base class was seperated from the ComponentShape base class so that mixing components with different spatial and spectral shapes did not result in a combinatorial explosion in the number of classes required.
Definition at line 159 of file SpectralModel.h.
|
virtual |
a virtual destructor is needed so that the actual destructor in the derived class will be used.
|
protected |
The constructors and assignment operator are protected as only derived classes should use them.
|
protected |
|
protected |
|
staticprotected |
returns true if the quantum is not a non-negative quantity with units dimensionally identical to the Hz
|
pure virtual |
Return a pointer to a copy of the derived object upcast to a SpectralModel object.
The class that uses this function is responsible for deleting the pointer. This is used to implement a virtual copy constructor.
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
void casa::SpectralModel::convertFrequencyUnit | ( | const casacore::Unit & | freqUnit | ) |
|
pure virtual |
Convert the parameters of the spectral model to the specified units.
The casacore::Record must contain the same fields that the to/from casacore::Record functions have (with the exception of the frequency & type fields). These fields will contain strings (and not Quantums) that specify the new units for these parameters. The new units must have the same dimensions as the existing ones. If there is any problem parsing the record then an error message is appended to the supplied string and the function returns false.
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
pure virtual |
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
const casacore::Unit& casa::SpectralModel::frequencyUnit | ( | ) | const |
get the frequency unit, and change the default frequency unit to the specified one.
This will only affect the units used in the casacore::Record returned by the toRecord function.
|
pure virtual |
These functions convert between a record and a SpectralModel.
This way derived classes can interpret fields in the record in a class specific way. They return false if the record is malformed and append an error message to the supplied string giving the reason. These functions define how a spectral model is represented in glish. All records should have 'type' & 'frequency' fields which contain respectively; a string indicating which spectral model is actually used, and a record representation of a frequency measure. The interpretation of all other fields depends on the specific spectral model used.
Implements casacore::RecordTransformable.
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
static |
Return the spectral shape that the supplied record represents.
The spectral shape is determined by parsing a 'type' field in the supplied record. Returns ComponentType::UNKNOWN_SPECTRAL_SHAPE if the type field (which contains a string) could not be translated into a known spectral shape. It then appends an appropriate error message to the errorMessage String.
|
virtual |
Specify the identification of the record (e.g.
'meas', 'quant'). The default implementation returns a empty string.
Reimplemented from casacore::RecordTransformable.
|
pure virtual |
return the number of parameters in this spectral shape and set/get them.
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
virtual |
casacore::Function which checks the internal data of this class for correct dimensionality and consistant values.
Returns true if everything is fine otherwise returns false.
Reimplemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
protected |
|
pure virtual |
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
protected |
Return the value refFrequency in the requested frame...
exception is thrown if convert does not work. No direction or epoch is available..so better ask for a frame that works or better convert to the frame of the refFrequency.
const casacore::MFrequency& casa::SpectralModel::refFrequency | ( | ) | const |
const casacore::Quantum<casacore::Double>& casa::SpectralModel::refFrequencyError | ( | ) | const |
|
pure virtual |
Return the scaling factor that indicates what proportion of the flux is at the specified frequency.
ie. if the centreFrequency argument is the reference frequency then this function will always return one. At other frequencies it will return a non-negative number.
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
pure virtual |
Same as the previous function except that many frequencies can be sampled at once.
The reference frame must be the same for all the specified frequencies. A default implementation of this function is available that uses the sample function described above. However customised versions of this function will be more efficient as intermediate values only need to be computed once.
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
pure virtual |
return full casacore::Stokes version especially for models which have different frequency dependence for the casacore::Stokes param (1 or 4 elements) So as allow for fractional pol change and angle change of linear pol w.r.t frequency A a four casacore::Vector of original IQUV should be passed in and it will hold the return values
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
pure virtual |
So as allow for fractional pol change and angle change of linear pol w.r.t frequency casacore::Vector of four Vectors of original IQUV should be passed in and it will hold the return values Uitimately this math should really go in Flux and FluxRep to where a rotation of linear pol is allowed.
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
pure virtual |
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
pure virtual |
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
virtual |
set/get the reference frequency
Reimplemented in casa::TabularSpectrum.
void casa::SpectralModel::setRefFrequencyError | ( | const casacore::Quantum< casacore::Double > & | newRefFreqErr | ) |
set/get the error in the reference frequency.
Values must be positive angular quantities otherwise an casacore::AipsError exception is thrown. The errors are usually interpreted as the 1-sigma bounds in latitude/longitude and implicitly assume a Gaussian distribution. They must have units with the same dimensions as the Hz.
|
pure virtual |
Convert the class to an Record representation.
The input record may already contain fields and these fields may be silently overridden. New fields may be added to the input Record. If the transformation succeeds then the error String is unchanged and the function returns True. Otherwise the function returns False and appends an error message to the supplied String giving the reason why the conversion failed.
Implements casacore::RecordTransformable.
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
pure virtual |
return the actual spectral type.
The ident function returns it as a String.
Implemented in casa::SpectralIndex, casa::TabularSpectrum, and casa::ConstantSpectrum.
|
private |
Definition at line 312 of file SpectralModel.h.
|
private |
Definition at line 311 of file SpectralModel.h.
|
private |
Definition at line 308 of file SpectralModel.h.