casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Attributes
casa::Flux< T > Class Template Reference

A class that represents the Flux (reference semantics) More...

#include <Flux.h>

List of all members.

Public Member Functions

 Flux ()
 The default constructor makes an object with I = 1, Q=U=V=0, a Stokes representation, and units of "Jy".
 Flux (T i)
 The default constructor makes an object with I = 1, Q=U=V=0, a Stokes representation, and units of "Jy".
 Flux (T i, T q, T u, T v)
 This constructor makes an object where I,Q,U,V are all specified.
 Flux (typename NumericTraits< T >::ConjugateType xx, typename NumericTraits< T >::ConjugateType xy, typename NumericTraits< T >::ConjugateType yx, typename NumericTraits< T >::ConjugateType yy, ComponentType::Polarisation pol)
 This constructor makes an object where the flux values and polarisation representation are specified.
 Flux (const Vector< T > &flux)
 This constructor makes an object where I,Q,U,V are all specified by a Vector that must have four elements.
 Flux (const Vector< typename NumericTraits< T >::ConjugateType > &flux, ComponentType::Polarisation pol)
 This constructor makes an object where the flux values are all specified by a Vector that must have four elements.
 Flux (const Quantum< Vector< T > > &flux)
 This constructor makes an object where the flux values are all specified by a Quantum<Vector> that must have four elements.
 Flux (const Quantum< Vector< typename NumericTraits< T >::ConjugateType > > &flux, ComponentType::Polarisation pol)
 This constructor makes an object where the flux values are all specified by a Quantum<Vector> that must have four elements.
 Flux (const Flux< T > &other)
 The copy constructor uses reference semantics.
 ~Flux ()
 The destructor is trivial.
Flux< T > & operator= (const Flux< T > &other)
 The assignment operator uses reference semantics.
Flux< T > copy () const
 Return a distinct copy of this flux.
const Unitunit () const
 These two functions return the current units.
void unit (Unit &unit) const
void setUnit (const Unit &unit)
 This function sets the current unit.
void convertUnit (const Unit &unit)
 This function sets the current units to the supplied value and additionally converts the internal flux values to the correspond to the new unit.
ComponentType::Polarisation pol () const
 These two functions return the current polarisation representation.
void pol (ComponentType::Polarisation &pol) const
void setPol (ComponentType::Polarisation pol)
 This function sets the current polarisation representation.
void convertPol (ComponentType::Polarisation pol)
 This function sets the current polarisation representation to the supplied value and additionally converts the internal flux values to the correspond to the new polarisation representation.
const Vector< typename
NumericTraits< T >
::ConjugateType > & 
value () const
 This function returns the flux values.
const NumericTraits< T >
::ConjugateType & 
value (uInt p) const
 This function returns the specified component of the flux values.
void value (Vector< T > &value)
 This function returns the flux values after converting it to the Stokes representation.
void value (Vector< typename NumericTraits< T >::ConjugateType > &value) const
 This function returns the flux values.
void value (Quantum< Vector< T > > &value)
 This function returns the flux values after converting it to the Stokes representation.
void value (Quantum< Vector< typename NumericTraits< T >::ConjugateType > > &value) const
 This function returns the flux values.
Quantum< T > value (Stokes::StokesTypes stokes, Bool toJy=True)
 Return the flux value in a Quantum for the specified Stokes.
void setValue (T value)
 This function sets the Flux values assuming the supplied value represents the Stokes I flux in the current units.
void setValue (const Vector< T > &value)
 This function sets the Flux values assuming the supplied values represent the flux in the Stokes representation and is in the current units.
void setValue (const Vector< typename NumericTraits< T >::ConjugateType > &value)
 This function sets the Flux values assuming the supplied values represent the flux in the current representation and units.
void setValue (const Quantum< Vector< T > > &value)
 This function sets the flux values and units assuming the supplied values represent the flux in the Stokes representation.
void setValue (const Quantum< Vector< typename NumericTraits< T >::ConjugateType > > &value, ComponentType::Polarisation pol)
 This function sets the flux values, units and polarisation assuming the supplied values represent the flux in the specified representation.
void setValue (const Quantum< T > &value, Stokes::StokesTypes stokes)
 Set flux for given Stokes from Quantum.
void scaleValue (const T &factor)
 Scale the Flux value by the specified amount.
void scaleValue (const T &factor0, const T &factor1, const T &factor2, const T &factor3)
void scaleValue (const typename NumericTraits< T >::ConjugateType &factor)
void scaleValue (const typename NumericTraits< T >::ConjugateType &factor0, const typename NumericTraits< T >::ConjugateType &factor1, const typename NumericTraits< T >::ConjugateType &factor2, const typename NumericTraits< T >::ConjugateType &factor3)
void setErrors (const typename NumericTraits< T >::ConjugateType &error0, const typename NumericTraits< T >::ConjugateType &error1, const typename NumericTraits< T >::ConjugateType &error2, const typename NumericTraits< T >::ConjugateType &error3)
 Set/get the errors in the flux.
void setErrors (const Vector< typename NumericTraits< T >::ConjugateType > &errors)
const Vector< typename
NumericTraits< T >
::ConjugateType > & 
errors () const
Bool fromRecord (String &errorMessage, const RecordInterface &record)
 This functions convert between a RecordInterface and a Flux object and define how the Flux is represented in glish.
Bool toRecord (String &errorMessage, RecordInterface &record) const
Bool ok () const
 Function which checks the internal data of this class for correct dimensionality and consistent values.

Static Public Member Functions

static void stokesToCircular (Vector< typename NumericTraits< T >::ConjugateType > &out, const Vector< T > &in)
 This function converts between a Vector in Stokes representation and one in Circular representation.
static void stokesToCircular (Vector< typename NumericTraits< T >::ConjugateType > &out, const Vector< typename NumericTraits< T >::ConjugateType > &in)
 This function converts between a Vector in Stokes representation and one in Circular representation.
static void circularToStokes (Vector< T > &out, const Vector< typename NumericTraits< T >::ConjugateType > &in)
 This function converts between a Vector in Circular representation and one in Stokes representation.
static void circularToStokes (Vector< typename NumericTraits< T >::ConjugateType > &out, const Vector< typename NumericTraits< T >::ConjugateType > &in)
 This function converts between a Vector in Circular representation and one in Stokes representation.
static void stokesToLinear (Vector< typename NumericTraits< T >::ConjugateType > &out, const Vector< T > &in)
 This function converts between a Vector in Stokes representation and one in Linear representation.
static void stokesToLinear (Vector< typename NumericTraits< T >::ConjugateType > &out, const Vector< typename NumericTraits< T >::ConjugateType > &in)
 This function converts between a Vector in Stokes representation and one in Linear representation.
static void linearToStokes (Vector< T > &out, const Vector< typename NumericTraits< T >::ConjugateType > &in)
 This function converts between a Vector in Linear representation and one in Stokes representation.
static void linearToStokes (Vector< typename NumericTraits< T >::ConjugateType > &out, const Vector< typename NumericTraits< T >::ConjugateType > &in)
 This function converts between a Vector in Linear representation and one in Stokes representation.
static void linearToCircular (Vector< typename NumericTraits< T >::ConjugateType > &out, const Vector< typename NumericTraits< T >::ConjugateType > &in)
 This function converts between a Vector in Linear representation and one in Circular representation.
static void circularToLinear (Vector< typename NumericTraits< T >::ConjugateType > &out, const Vector< typename NumericTraits< T >::ConjugateType > &in)
 This function converts between a Vector in Circular representation and one in Linear representation.

Private Attributes

CountedPtr< FluxRep< T > > itsFluxPtr

Detailed Description

template<class T>
class casa::Flux< T >

A class that represents the Flux (reference semantics)

Intended use:

Public interface

 <h3>Review Status</h3><dl><dt>Date Reviewed:<dd>yyyy/mm/dd</dl> 

Prerequisite

Etymology

The Flux class is used to represent the flux of a component on the sky

Synopsis

This class is nearly identical to the FluxRep class and the reader is referred to the documentation of this class for a general explanation of this class. Most of the functions in this class just call the functions in the FluxRep class.

There are two important differences between the Flux class and the FluxRep class.

The functions for converting between different polarisation representations require that the supplied and returned vector have all four polarisations. In the Stokes representation the order of the elements is I,Q,U,V, in the linear representation it is XX,XY,YX,YY, and in the circular representation it is RR,RL,LR,LL.

These functions will correctly convert between Linear/Circular representations and the Stokes representation even if the linear or circular polarisation cannot represent a physically realisable polarisation (eg if XY != conj(YX)). In these cases the stokes representation will have an imaginary component and be complex. When converting the complex Stokes representation to a real one the imaginary components are simply discarded.

Example

The function in this example calculates the total flux of all the components in a list. It accumulates the flux in a Vector after ensuring that the flux is in the appropriate units and Polarisation. It then returns the sum as a Flux object. Because this class uses reference semantics the returned object is passed by reference and hence this is a relatively cheap operation.

    Flux<Double> totalFlux(ComponentList& list) {
      Vector<DComplex> sum(4, DComplex(0.0, 0.0));
      for (uInt i = 0; i < list.nelements(); i++) {
        list.component(i).flux().convertPol(ComponentType::STOKES);
        list.component(i).flux().convertUnit("Jy");
        sum += list.component(i).flux().value()
      }
      return Flux<Double>(value, ComponentType::STOKES);
    }

Motivation

This class was needed to contain the flux in the ComponentModels class. It centralizes a lot of code that would otherwise be duplicated. The reference semantics further simplify the interface that the component classes use.

Thrown Exceptions

To Do

Definition at line 450 of file Flux.h.


Constructor & Destructor Documentation

template<class T>
casa::Flux< T >::Flux ( )

The default constructor makes an object with I = 1, Q=U=V=0, a Stokes representation, and units of "Jy".

template<class T>
casa::Flux< T >::Flux ( i)

The default constructor makes an object with I = 1, Q=U=V=0, a Stokes representation, and units of "Jy".

template<class T>
casa::Flux< T >::Flux ( i,
q,
u,
v 
)

This constructor makes an object where I,Q,U,V are all specified.

It assumes a Stokes representation, and units of "Jy".

template<class T>
casa::Flux< T >::Flux ( typename NumericTraits< T >::ConjugateType  xx,
typename NumericTraits< T >::ConjugateType  xy,
typename NumericTraits< T >::ConjugateType  yx,
typename NumericTraits< T >::ConjugateType  yy,
ComponentType::Polarisation  pol 
)

This constructor makes an object where the flux values and polarisation representation are specified.

It assumes the units are "Jy".

template<class T>
casa::Flux< T >::Flux ( const Vector< T > &  flux)

This constructor makes an object where I,Q,U,V are all specified by a Vector that must have four elements.

It assumes a Stokes representation, and units of "Jy".

template<class T>
casa::Flux< T >::Flux ( const Vector< typename NumericTraits< T >::ConjugateType > &  flux,
ComponentType::Polarisation  pol 
)

This constructor makes an object where the flux values are all specified by a Vector that must have four elements.

The polarisation representation must also be specified. It assumes the units are "Jy".

template<class T>
casa::Flux< T >::Flux ( const Quantum< Vector< T > > &  flux)

This constructor makes an object where the flux values are all specified by a Quantum<Vector> that must have four elements.

The Quantum must have units that are dimensionally equivalent to the "Jy" and these are the units of the FluxRep object. A Stokes polarisation representation is assumed.

template<class T>
casa::Flux< T >::Flux ( const Quantum< Vector< typename NumericTraits< T >::ConjugateType > > &  flux,
ComponentType::Polarisation  pol 
)

This constructor makes an object where the flux values are all specified by a Quantum<Vector> that must have four elements.

The Quantum must have units that are dimensionally equivalent to the "Jy" and these are the units of the FluxRep object. The polarisation representation must also be specified.

template<class T>
casa::Flux< T >::Flux ( const Flux< T > &  other)

The copy constructor uses reference semantics.

template<class T>
casa::Flux< T >::~Flux ( )

The destructor is trivial.


Member Function Documentation

template<class T>
static void casa::Flux< T >::circularToLinear ( Vector< typename NumericTraits< T >::ConjugateType > &  out,
const Vector< typename NumericTraits< T >::ConjugateType > &  in 
) [static]

This function converts between a Vector in Circular representation and one in Linear representation.

template<class T>
static void casa::Flux< T >::circularToStokes ( Vector< T > &  out,
const Vector< typename NumericTraits< T >::ConjugateType > &  in 
) [static]

This function converts between a Vector in Circular representation and one in Stokes representation.

The imaginary components of the Stokes vector are discarded.

template<class T>
static void casa::Flux< T >::circularToStokes ( Vector< typename NumericTraits< T >::ConjugateType > &  out,
const Vector< typename NumericTraits< T >::ConjugateType > &  in 
) [static]

This function converts between a Vector in Circular representation and one in Stokes representation.

The imaginary components of the Stokes vector are NOT ignored.

template<class T>
void casa::Flux< T >::convertPol ( ComponentType::Polarisation  pol)

This function sets the current polarisation representation to the supplied value and additionally converts the internal flux values to the correspond to the new polarisation representation.

template<class T>
void casa::Flux< T >::convertUnit ( const Unit unit)

This function sets the current units to the supplied value and additionally converts the internal flux values to the correspond to the new unit.

template<class T>
Flux<T> casa::Flux< T >::copy ( ) const

Return a distinct copy of this flux.

As both the assignment operator and the copy constructor use reference semantics this is the only way to get a real copy.

template<class T>
const Vector<typename NumericTraits<T>::ConjugateType>& casa::Flux< T >::errors ( ) const
template<class T>
Bool casa::Flux< T >::fromRecord ( String errorMessage,
const RecordInterface record 
)

This functions convert between a RecordInterface and a Flux object and define how the Flux is represented in glish.

They return False if the RecordInterface is malformed and append an error message to the supplied string giving the reason.

template<class T>
static void casa::Flux< T >::linearToCircular ( Vector< typename NumericTraits< T >::ConjugateType > &  out,
const Vector< typename NumericTraits< T >::ConjugateType > &  in 
) [static]

This function converts between a Vector in Linear representation and one in Circular representation.

template<class T>
static void casa::Flux< T >::linearToStokes ( Vector< T > &  out,
const Vector< typename NumericTraits< T >::ConjugateType > &  in 
) [static]

This function converts between a Vector in Linear representation and one in Stokes representation.

The imaginary components of the Stokes vector are discarded.

template<class T>
static void casa::Flux< T >::linearToStokes ( Vector< typename NumericTraits< T >::ConjugateType > &  out,
const Vector< typename NumericTraits< T >::ConjugateType > &  in 
) [static]

This function converts between a Vector in Linear representation and one in Stokes representation.

The imaginary components of the Stokes vector are NOT ignored.

template<class T>
Bool casa::Flux< T >::ok ( ) const

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

Returns True if everything is fine otherwise returns False.

template<class T>
Flux<T>& casa::Flux< T >::operator= ( const Flux< T > &  other)

The assignment operator uses reference semantics.

template<class T>
ComponentType::Polarisation casa::Flux< T >::pol ( ) const

These two functions return the current polarisation representation.

template<class T>
void casa::Flux< T >::pol ( ComponentType::Polarisation pol) const
template<class T>
void casa::Flux< T >::scaleValue ( const T &  factor)

Scale the Flux value by the specified amount.

These functions multiply the flux values irrespective of the current polarisation representation. If only one scale factor is supplied then only the first component of the flux is scaled.

template<class T>
void casa::Flux< T >::scaleValue ( const T &  factor0,
const T &  factor1,
const T &  factor2,
const T &  factor3 
)
template<class T>
void casa::Flux< T >::scaleValue ( const typename NumericTraits< T >::ConjugateType &  factor)
template<class T>
void casa::Flux< T >::scaleValue ( const typename NumericTraits< T >::ConjugateType &  factor0,
const typename NumericTraits< T >::ConjugateType &  factor1,
const typename NumericTraits< T >::ConjugateType &  factor2,
const typename NumericTraits< T >::ConjugateType &  factor3 
)
template<class T>
void casa::Flux< T >::setErrors ( const typename NumericTraits< T >::ConjugateType &  error0,
const typename NumericTraits< T >::ConjugateType &  error1,
const typename NumericTraits< T >::ConjugateType &  error2,
const typename NumericTraits< T >::ConjugateType &  error3 
)

Set/get the errors in the flux.

template<class T>
void casa::Flux< T >::setErrors ( const Vector< typename NumericTraits< T >::ConjugateType > &  errors)
template<class T>
void casa::Flux< T >::setPol ( ComponentType::Polarisation  pol)

This function sets the current polarisation representation.

It does NOT convert the flux values.

template<class T>
void casa::Flux< T >::setUnit ( const Unit unit)

This function sets the current unit.

It does NOT convert the flux values to correspond to the new unit. The new unit must be dimensionally equivalent to the "Jy".

template<class T>
void casa::Flux< T >::setValue ( value)

This function sets the Flux values assuming the supplied value represents the Stokes I flux in the current units.

The other Stokes parameters are set to zero.

template<class T>
void casa::Flux< T >::setValue ( const Vector< T > &  value)

This function sets the Flux values assuming the supplied values represent the flux in the Stokes representation and is in the current units.

The Vector must have four elements.

template<class T>
void casa::Flux< T >::setValue ( const Vector< typename NumericTraits< T >::ConjugateType > &  value)

This function sets the Flux values assuming the supplied values represent the flux in the current representation and units.

The Vector must have four elements.

template<class T>
void casa::Flux< T >::setValue ( const Quantum< Vector< T > > &  value)

This function sets the flux values and units assuming the supplied values represent the flux in the Stokes representation.

The units of the Quantum must be dimensionally equivalent to the "Jy" and the Vector must have four elements.

template<class T>
void casa::Flux< T >::setValue ( const Quantum< Vector< typename NumericTraits< T >::ConjugateType > > &  value,
ComponentType::Polarisation  pol 
)

This function sets the flux values, units and polarisation assuming the supplied values represent the flux in the specified representation.

The units of the Quantum must be dimensionally equivalent to the "Jy" and the Vector must have four elements.

template<class T>
void casa::Flux< T >::setValue ( const Quantum< T > &  value,
Stokes::StokesTypes  stokes 
)

Set flux for given Stokes from Quantum.

template<class T>
static void casa::Flux< T >::stokesToCircular ( Vector< typename NumericTraits< T >::ConjugateType > &  out,
const Vector< T > &  in 
) [static]

This function converts between a Vector in Stokes representation and one in Circular representation.

template<class T>
static void casa::Flux< T >::stokesToCircular ( Vector< typename NumericTraits< T >::ConjugateType > &  out,
const Vector< typename NumericTraits< T >::ConjugateType > &  in 
) [static]

This function converts between a Vector in Stokes representation and one in Circular representation.

The imaginary components of the Stokes vector are NOT ignored.

template<class T>
static void casa::Flux< T >::stokesToLinear ( Vector< typename NumericTraits< T >::ConjugateType > &  out,
const Vector< T > &  in 
) [static]

This function converts between a Vector in Stokes representation and one in Linear representation.

template<class T>
static void casa::Flux< T >::stokesToLinear ( Vector< typename NumericTraits< T >::ConjugateType > &  out,
const Vector< typename NumericTraits< T >::ConjugateType > &  in 
) [static]

This function converts between a Vector in Stokes representation and one in Linear representation.

The imaginary components of the Stokes vector are NOT ignored.

template<class T>
Bool casa::Flux< T >::toRecord ( String errorMessage,
RecordInterface record 
) const
template<class T>
const Unit& casa::Flux< T >::unit ( ) const

These two functions return the current units.

template<class T>
void casa::Flux< T >::unit ( Unit unit) const
template<class T>
const Vector<typename NumericTraits<T>::ConjugateType>& casa::Flux< T >::value ( ) const

This function returns the flux values.

The polarisation representation and units are in whatever is current.

template<class T>
const NumericTraits<T>::ConjugateType& casa::Flux< T >::value ( uInt  p) const

This function returns the specified component of the flux values.

The polarisation representation and units are in whatever is current.

template<class T>
void casa::Flux< T >::value ( Vector< T > &  value)

This function returns the flux values after converting it to the Stokes representation.

The units of the returned Vector are the current units.

template<class T>
void casa::Flux< T >::value ( Vector< typename NumericTraits< T >::ConjugateType > &  value) const

This function returns the flux values.

The polarisation representation and units are in whatever is current.

template<class T>
void casa::Flux< T >::value ( Quantum< Vector< T > > &  value)

This function returns the flux values after converting it to the Stokes representation.

The units of the returned Quantum are the current units of the FluxRep object. The length of the Vector in the Quantum will be resized to 4 elements if it is not already that length.

template<class T>
void casa::Flux< T >::value ( Quantum< Vector< typename NumericTraits< T >::ConjugateType > > &  value) const

This function returns the flux values.

The units of the returned Quantum are the current units of the FluxRep object. Similarly the polarisation representation of the returned Quantum is the current polarisation representation. The length of the Vector in the Quantum will be resized to 4 elements if it is not already that length.

template<class T>
Quantum<T> casa::Flux< T >::value ( Stokes::StokesTypes  stokes,
Bool  toJy = True 
)

Return the flux value in a Quantum for the specified Stokes.

Can convert to Jy if requested.


Member Data Documentation

template<class T>
CountedPtr<FluxRep<T> > casa::Flux< T >::itsFluxPtr [private]

Definition at line 725 of file Flux.h.


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