casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
casa::ConstantSpectrum Class Reference

Model the spectral variation with a constant. More...

#include <ConstantSpectrum.h>

Inheritance diagram for casa::ConstantSpectrum:
casa::SpectralModel casacore::RecordTransformable

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...
 
ConstantSpectrumoperator= (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 &centerFrequency) 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 &centerFrequency, 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 SpectralModelclone () 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::Stringident () 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::MFrequencyrefFrequency () const
 
const casacore::UnitfrequencyUnit () 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)
 
SpectralModeloperator= (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...
 

Detailed Description

Model the spectral variation with a constant.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd
Test programs:
tConstantSpectrum
Demo programs:
dConstantSpectrum

Prerequisite

Synopsis

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:

c := [type = 'constant',
frequency = [type = 'frequency',
refer = 'lsr',
m0 = [value = 1, unit = 'GHz']
]
]

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.

Example

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.

SkyComponent myComp(...);
..\.
if (myComp.spectrum().type() != ComponentType::CONSTANT_SPECTRUM) {
myComp.spectrum() = ConstantSpectrum();
}

Motivation

A ConstantSpectrum class is needed for users who are not interested in modelling any spectral variation in their components.

To Do

Definition at line 128 of file ConstantSpectrum.h.

Constructor & Destructor Documentation

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 casa::ConstantSpectrum::~ConstantSpectrum ( )
virtual

The destructor does nothing.

Member Function Documentation

virtual SpectralModel* casa::ConstantSpectrum::clone ( ) const
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 casacore::Bool casa::ConstantSpectrum::convertUnit ( casacore::String errorMessage,
const casacore::RecordInterface record 
)
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 casacore::Vector<casacore::Double> casa::ConstantSpectrum::errors ( ) const
virtual

Implements casa::SpectralModel.

virtual casacore::Bool casa::ConstantSpectrum::fromRecord ( casacore::String errorMessage,
const casacore::RecordInterface record 
)
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 casacore::uInt casa::ConstantSpectrum::nParameters ( ) const
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::Bool casa::ConstantSpectrum::ok ( ) const
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 casacore::Vector<casacore::Double> casa::ConstantSpectrum::parameters ( ) const
virtual

Implements casa::SpectralModel.

virtual casacore::Double casa::ConstantSpectrum::sample ( const casacore::MFrequency centerFrequency) const
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 void casa::ConstantSpectrum::sample ( casacore::Vector< casacore::Double > &  scale,
const casacore::Vector< casacore::MFrequency::MVType > &  frequencies,
const casacore::MFrequency::Ref refFrame 
) const
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 void casa::ConstantSpectrum::sampleStokes ( const casacore::MFrequency centerFrequency,
casacore::Vector< casacore::Double > &  iquv 
) const
virtual

Original values returned.

Implements casa::SpectralModel.

virtual void casa::ConstantSpectrum::sampleStokes ( casacore::Vector< casacore::Vector< casacore::Double > > &  scale,
const casacore::Vector< casacore::MFrequency::MVType > &  frequencies,
const casacore::MFrequency::Ref refFrame 
) const
virtual

original values are returned

Implements casa::SpectralModel.

virtual void casa::ConstantSpectrum::setErrors ( const casacore::Vector< casacore::Double > &  newSpectralErrs)
virtual

Implements casa::SpectralModel.

virtual void casa::ConstantSpectrum::setParameters ( const casacore::Vector< casacore::Double > &  newSpectralParms)
virtual

Implements casa::SpectralModel.

virtual casacore::Bool casa::ConstantSpectrum::toRecord ( casacore::String error,
casacore::RecordInterface outRecord 
) const
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 ComponentType::SpectralShape casa::ConstantSpectrum::type ( ) const
virtual

return the actual spectral type.

This function always returns ComponentType::CONSTANT_SPECTRUM

Implements casa::SpectralModel.


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