casa
5.7.0-16
|
Model the spectral variation with a constant. More...
#include <ConstantSpectrum.h>
Public Member Functions | |
ConstantSpectrum () | |
The default constructor is the only one you really need as this class has no parameters! More... | |
ConstantSpectrum (const ConstantSpectrum &other) | |
The copy constructor uses copy semantics. More... | |
virtual | ~ConstantSpectrum () |
The destructor does nothing. More... | |
ConstantSpectrum & | operator= (const ConstantSpectrum &other) |
The assignment operator uses copy semantics. More... | |
virtual ComponentType::SpectralShape | type () const |
return the actual spectral type. More... | |
virtual casacore::Double | sample (const casacore::MFrequency ¢erFrequency) const |
Return the scaling factor that indicates the flux is at the specified frequency assuming the flux at the reference frequency is one. More... | |
virtual void | sampleStokes (const casacore::MFrequency ¢erFrequency, casacore::Vector< casacore::Double > &iquv) const |
Original values returned. More... | |
virtual void | sample (casacore::Vector< casacore::Double > &scale, const casacore::Vector< casacore::MFrequency::MVType > &frequencies, const casacore::MFrequency::Ref &refFrame) const |
Same as the previous function except that many frequencies can be sampled at once. More... | |
virtual void | sampleStokes (casacore::Vector< casacore::Vector< casacore::Double > > &scale, const casacore::Vector< casacore::MFrequency::MVType > &frequencies, const casacore::MFrequency::Ref &refFrame) const |
original values are returned More... | |
virtual SpectralModel * | clone () const |
Return a pointer to a copy of this object upcast to a SpectralModel object. More... | |
virtual casacore::uInt | nParameters () const |
return the number of parameters. More... | |
virtual void | setParameters (const casacore::Vector< casacore::Double > &newSpectralParms) |
virtual casacore::Vector < casacore::Double > | parameters () const |
virtual void | setErrors (const casacore::Vector< casacore::Double > &newSpectralErrs) |
virtual casacore::Vector < casacore::Double > | errors () const |
virtual casacore::Bool | fromRecord (casacore::String &errorMessage, const casacore::RecordInterface &record) |
These functions convert between a casacore::Record and a ConstantSpectrum. More... | |
virtual casacore::Bool | toRecord (casacore::String &errorMessage, casacore::RecordInterface &record) const |
Convert the class to an Record representation. More... | |
virtual casacore::Bool | convertUnit (casacore::String &errorMessage, const casacore::RecordInterface &record) |
Convert the parameters of the spectrum to the specified units. More... | |
virtual casacore::Bool | ok () const |
casacore::Function which checks the internal data of this class for consistant values. More... | |
Public Member Functions inherited from casa::SpectralModel | |
virtual | ~SpectralModel () |
a virtual destructor is needed so that the actual destructor in the derived class will be used. 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 |
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... | |
Additional Inherited Members | |
Static Public Member Functions inherited from casa::SpectralModel | |
static ComponentType::SpectralShape | getType (casacore::String &errorMessage, const casacore::RecordInterface &record) |
Return the spectral shape that the supplied record represents. More... | |
Protected Member Functions inherited from casa::SpectralModel | |
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 inherited from casa::SpectralModel | |
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... | |
Model the spectral variation with a constant.
Public interface
This class models the spectral variation of a component as constant, ie. unchanging with frequency. It is the simplest possible model for spectral variation.
This class like the other spectral models becomes more useful when used through the SkyComponent class, which incorperates the flux and spatial variation of the emission, or through the ComponentList class, which handles groups of SkyComponent objects.
Because the flux is constant with frequency the concept of a reference frequency is meaningless with this class. But it can still be accessed using the refFrequency
and setRefFrequency
. However changing its value will not affect the behaviour of this class.
This class does not have any parameters and the nParameters
function will return zero. It is an error that will generate an exception (in Debug mode) to call the setParameters
and parameters
functions with anything other than a zero length vector.
The sample
functions always return 1.0.
This class also contains functions (toRecord
& fromRecord
) which perform the conversion between Records and ConstantSpectrum objects. These functions define how a ConstantSpectrum object is represented in glish. The format of the record that is generated and accepted by these functions is:
The frequency field contains a record representation of a frequency measure and its format is defined in the Measures module. Its refer field defines the reference frame for the direction and the m0 field defines the value of the reference frequency. The parsing of the type field is case insensitive.
Its hard to think of a good example for this class as it is basically does nothing! In this example the spectral variation of a component is set to to a constant value.
A ConstantSpectrum class is needed for users who are not interested in modelling any spectral variation in their components.
Definition at line 128 of file ConstantSpectrum.h.
casa::ConstantSpectrum::ConstantSpectrum | ( | ) |
The default constructor is the only one you really need as this class has no parameters!
casa::ConstantSpectrum::ConstantSpectrum | ( | const ConstantSpectrum & | other | ) |
The copy constructor uses copy semantics.
|
virtual |
The destructor does nothing.
|
virtual |
Return a pointer to a copy of this 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.
Implements casa::SpectralModel.
|
virtual |
Convert the parameters of the spectrum to the specified units.
As a constant spectrum has no parameters this function does nothing and always returns true.
Implements casa::SpectralModel.
|
virtual |
Implements casa::SpectralModel.
|
virtual |
These functions convert between a casacore::Record and a ConstantSpectrum.
These functions define how a ConstantSpectrum object is represented in glish and this is detailed in the synopsis above. These functions return false if the record is malformed and append an error message to the supplied string giving the reason.
Implements casa::SpectralModel.
|
virtual |
return the number of parameters.
There are no parameters for this spectral model. So calling setParameters
or parameters
with anything other than a zero length casacore::Vector will throw an exception (when compiled in debug mode).
Implements casa::SpectralModel.
|
virtual |
casacore::Function which checks the internal data of this class for consistant values.
Returns true if everything is fine otherwise returns false.
Reimplemented from casa::SpectralModel.
ConstantSpectrum& casa::ConstantSpectrum::operator= | ( | const ConstantSpectrum & | other | ) |
The assignment operator uses copy semantics.
|
virtual |
Implements casa::SpectralModel.
|
virtual |
Return the scaling factor that indicates the flux is at the specified frequency assuming the flux at the reference frequency is one.
This function always returns one, as the spectrum is constant.
Implements casa::SpectralModel.
|
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. Uses a customised implementation.
Implements casa::SpectralModel.
|
virtual |
Original values returned.
Implements casa::SpectralModel.
|
virtual |
original values are returned
Implements casa::SpectralModel.
|
virtual |
Implements casa::SpectralModel.
|
virtual |
Implements casa::SpectralModel.
|
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 casa::SpectralModel.
|
virtual |
return the actual spectral type.
This function always returns ComponentType::CONSTANT_SPECTRUM
Implements casa::SpectralModel.