casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
casa::SkyCompBase Class Reference

Base class for model components of the sky brightness. More...

#include <SkyCompBase.h>

Inheritance diagram for casa::SkyCompBase:
casa::RecordTransformable casa::SkyComponent casa::SkyCompRep

List of all members.

Public Member Functions

virtual ~SkyCompBase ()
 The destructor does not anything.
virtual const Flux< Double > & flux () const =0
 return a reference to the flux of the component.
virtual Flux< Double > & flux ()=0
virtual const ComponentShapeshape () const =0
 return a reference to the shape of the component.
virtual ComponentShapeshape ()=0
virtual void setShape (const ComponentShape &newShape)=0
virtual const SpectralModelspectrum () const =0
 return a reference to the spectrum of the component.
virtual SpectralModelspectrum ()=0
virtual void setSpectrum (const SpectralModel &newSpectrum)=0
virtual Stringlabel ()=0
 return a reference to the label associated with this component.
virtual const Stringlabel () const =0
virtual Vector< Double > & optionalParameters ()=0
 return a reference to the label associated with this component.
virtual const Vector< Double > & optionalParameters () const =0
virtual Bool isPhysical () const =0
 Return True if the component parameters are physically plausable.
virtual Flux< Doublesample (const MDirection &direction, const MVAngle &pixelLatSize, const MVAngle &pixelLongSize, const MFrequency &centerFrequency) const =0
 Calculate the flux at the specified direction & frequency, in a pixel of specified x & y size.
virtual void sample (Cube< Double > &samples, const Unit &reqUnit, const Vector< MVDirection > &directions, const MeasRef< MDirection > &dirRef, const MVAngle &pixelLatSize, const MVAngle &pixelLongSize, const Vector< MVFrequency > &frequencies, const MeasRef< MFrequency > &freqRef) const =0
 Same as the previous function except that many directions & frequencies are done at once.
virtual Flux< Doublevisibility (const Vector< Double > &uvw, const Double &frequency) const =0
 Return the Fourier transform of the component at the specified point in the spatial frequency domain.
virtual void visibility (Cube< DComplex > &visibilities, const Matrix< Double > &uvws, const Vector< Double > &frequencies) const =0
 Same as the previous function except that many (u,v,w) points are done at once.
virtual Bool fromRecord (String &errorMessage, const RecordInterface &record)=0
 This functions convert between a record and a component.
virtual Bool toRecord (String &errorMessage, RecordInterface &record) const =0
 Convert the class to an Record representation.
virtual Bool ok () const =0
 Function which checks the internal data of this class for correct dimensionality and consistant values.

Detailed Description

Base class for model components of the sky brightness.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Synopsis

This abstract base class defines the interface for classes that model the sky brightness.

A model of the sky brightness is defined by three properties.

A Flux
This is the integrated brightness of the component.
A Shape
This defines how the sky brightness varies as a function of position on the sky. Currently two shapes are supported, points and Gaussians .
A Spectrum
This defines how the component flux varies as a function of frequency. Currently two spectral models are supported. The simplest assumes the spectrum is constant with frequency. Alternatively a spectral index model can be used.

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 Flux , ComponentShape or SpectralModel classes for more information on these properties and how to manipulate them.

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:

sample
This function will return the the flux in an specified pixel, at a specified direction at a specified frequency.
project
This function will generate an image of the component, given a user specified ImageInterface object.
visibility
This function will return the visibility (spatial coherence) that would be measured if the component was at the field centre of an interferometer with a specified (u,v,w) coordinates and observation frequency.

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.

Example

Because SpectralModel 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 SkyCompBase's as arguments to work for any derived class. These examples are coded in the dSkyCompBase.cc file.

Example 1:

In this example the printComp function prints out the some basic information on the spatial, spectral and flux properties of the component.

    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;
    }

Motivation

I wanted to force the interfaces of the SkyCompRep and the SkyComponent classes to be the same. The best way I found was the introduction of a base class that these other classes would derive from.

To Do

Definition at line 164 of file SkyCompBase.h.


Constructor & Destructor Documentation

virtual casa::SkyCompBase::~SkyCompBase ( ) [virtual]

The destructor does not anything.


Member Function Documentation

virtual const Flux<Double>& casa::SkyCompBase::flux ( ) const [pure virtual]

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.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual Flux<Double>& casa::SkyCompBase::flux ( ) [pure virtual]

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual Bool casa::SkyCompBase::fromRecord ( String errorMessage,
const RecordInterface record 
) [pure virtual]

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.

Implements casa::RecordTransformable.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual Bool casa::SkyCompBase::isPhysical ( ) const [pure virtual]

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

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual String& casa::SkyCompBase::label ( ) [pure virtual]

return a reference to the label associated with this component.

The label is a text string for general use.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual const String& casa::SkyCompBase::label ( ) const [pure virtual]

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual Bool casa::SkyCompBase::ok ( ) const [pure virtual]

Function which checks the internal data of this class for correct dimensionality and consistant values.

Returns True if everything is fine otherwise returns False.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual Vector<Double>& casa::SkyCompBase::optionalParameters ( ) [pure virtual]

return a reference to the label associated with this component.

The label is a text string for general use.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual const Vector<Double>& casa::SkyCompBase::optionalParameters ( ) const [pure virtual]

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual Flux<Double> casa::SkyCompBase::sample ( const MDirection direction,
const MVAngle pixelLatSize,
const MVAngle pixelLongSize,
const MFrequency centerFrequency 
) const [pure virtual]

Calculate the flux at the specified direction & frequency, in a pixel of specified x & y size.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual void casa::SkyCompBase::sample ( Cube< Double > &  samples,
const Unit reqUnit,
const Vector< MVDirection > &  directions,
const MeasRef< MDirection > &  dirRef,
const MVAngle pixelLatSize,
const MVAngle pixelLongSize,
const Vector< MVFrequency > &  frequencies,
const MeasRef< MFrequency > &  freqRef 
) const [pure virtual]

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.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual void casa::SkyCompBase::setShape ( const ComponentShape newShape) [pure virtual]

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual void casa::SkyCompBase::setSpectrum ( const SpectralModel newSpectrum) [pure virtual]

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual const ComponentShape& casa::SkyCompBase::shape ( ) const [pure virtual]

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.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual ComponentShape& casa::SkyCompBase::shape ( ) [pure virtual]

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual const SpectralModel& casa::SkyCompBase::spectrum ( ) const [pure virtual]

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.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual SpectralModel& casa::SkyCompBase::spectrum ( ) [pure virtual]

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual Bool casa::SkyCompBase::toRecord ( String error,
RecordInterface outRecord 
) const [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 casa::RecordTransformable.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual Flux<Double> casa::SkyCompBase::visibility ( const Vector< Double > &  uvw,
const Double frequency 
) const [pure virtual]

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.

Implemented in casa::SkyCompRep, and casa::SkyComponent.

virtual void casa::SkyCompBase::visibility ( Cube< DComplex > &  visibilities,
const Matrix< Double > &  uvws,
const Vector< Double > &  frequencies 
) const [pure virtual]

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.

Implemented in casa::SkyCompRep, and casa::SkyComponent.


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