A model of the sky brightness is defined by three properties.
These three properties of a component can be obtained using the flux, shape or spectrum functions defined in this interface. Each of these properties is represented by an object that contains functions for manipulating the parameters associated with that property. eg. to set the direction of the component you would use:
SkyComponent comp; comp.shape().setRefDirection(newDirection);See the
Besides these three properties the label functions are provided to associate a text string with the component.
A model of the sky brightness is by itself not very useful unless you can do something with it. This class contains functions for deriving information from the components. These functions are:
The toRecord & fromRecord functions are used to convert between a SkyCompBase object and a record representation. This is primarily so that a component can be represented in Glish.
void printComponent(const SkyCompBase & comp) { cout << "This component has a flux of " << comp.flux().value() << " " << comp.flux().unit().getName() << endl; cout << "and a " << ComponentType::name(comp.flux().pol()) << " polarisation" << endl; cout << "This component has a " << ComponentType::name(comp.shape().type()) << " shape" << endl; cout << "with a reference direction of " << comp.shape().refDirection().getAngle("deg") << endl; cout << "This component has a " << ComponentType::name(comp.spectrum().type()) << " spectrum" << endl; cout << "with a reference frequency of " << comp.spectrum().refFrequency().get("GHz") << endl; }
return a reference to the flux of the component. Because this is a reference, manipulation of the flux values is performed through the functions in the Flux class. eg., comp.flux().setValue(newVal). If the component flux varies with frequency then the flux set using this function is the value at the reference frequency.
return a reference to the shape of the component. Because this is a reference, manipulation of the shape of the component is performed through the functions in the ComponentShape (or derived) class. eg., comp.shape().setRefDirection(newVal). To change the shape to a different type you must use the setShape function.
return a reference to the spectrum of the component. Because this is a reference, manipulation of the spectrum of the component is performed through the functions in the SpectralModel (or derived) class. eg., refFreq = comp.spectrum().refFrequency(). Touse a different spectral model you must use the setSpectrum function.
return a reference to the label associated with this component. The label is a text string for general use.
Return True if the component parameters are physically plausable. This checks that I, Q, U, & V are all real numbers and if I^2 >= Q^2 + U^2 + U^2
Calculate the flux at the specified direction & frequency, in a pixel of specified x & y size.
Same as the previous function except that many directions & frequencies are done at once. The flux is added into the values supplied in the samples argument and this cube must have dimensions of [4, nDirs, nFreqs]. The polarisations are always [I, Q, U, V] and units of the flux added are specified with the reqUnits arguments.
Return the Fourier transform of the component at the specified point in the spatial frequency domain. The point is specified by a 3-element vector (u,v,w) that has units of meters and the frequency of the observation, in Hertz. These two quantities can be used to derive the required spatial frequency (s = uvw*freq/c). The w component is not used in these functions.
The "origin" of the transform is the reference direction of the component. This means, for symmetric components where the reference direction is at the centre, that the Fourier transform will always be real.
Same as the previous function except that many (u,v,w) points are done at once. The visibilities are returned in the first argument which must have dimensions of [4, nChan, nVis]. The points to sample are specified in the second argument which must have dimensions of [3, nVis], and the frequencies to sample are specified by the third argument which must have a length of nChan. The units and polarisation of the returned visibilities are the same as the flux of this object, and can be queried using the flux().units() & flux().pol() functions.
This functions convert between a record and a component. Derived classes can interpret fields in the record in a class specific way. These functions define how a component is represented in glish. They return False if the record is malformed and append an error message to the supplied string giving the reason.
Function which checks the internal data of this class for correct dimensionality and consistant values. Returns True if everything is fine otherwise returns False.