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.
SkyComponent myComp(...); ... if (myComp.spectrum().type() != ComponentType::CONSTANT_SPECTRUM) { myComp.spectrum() = ConstantSpectrum(); }
The copy constructor uses copy semantics
The destructor does nothing.
The assignment operator uses copy semantics.
return the actual spectral type. This function always returns ComponentType::CONSTANT_SPECTRUM
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.
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.
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.
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 Vector will throw an exception (when compiled in debug mode).
These functions convert between a 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.
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.
Function which checks the internal data of this class for consistant values. Returns True if everything is fine otherwise returns False.