casa
$Rev:20696$
|
A class that represents the Flux (reference semantics) More...
#include <Flux.h>
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 Unit & | unit () 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 |
A class that represents the Flux (reference semantics)
Public interface
<h3>Review Status</h3><dl><dt>Date Reviewed:<dd>yyyy/mm/dd</dl>
The Flux class is used to represent the flux of a component on the sky
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.
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); }
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.
casa::Flux< T >::Flux | ( | ) |
The default constructor makes an object with I = 1, Q=U=V=0
, a Stokes representation, and units of "Jy".
casa::Flux< T >::Flux | ( | T | i | ) |
The default constructor makes an object with I = 1, Q=U=V=0
, a Stokes representation, and units of "Jy".
casa::Flux< T >::Flux | ( | T | i, |
T | q, | ||
T | u, | ||
T | v | ||
) |
This constructor makes an object where I,Q,U,V are all specified.
It assumes a Stokes representation, and units of "Jy".
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".
casa::Flux< T >::Flux | ( | const Vector< T > & | flux | ) |
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".
casa::Flux< T >::Flux | ( | const Quantum< Vector< T > > & | flux | ) |
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.
casa::Flux< T >::Flux | ( | const Flux< T > & | other | ) |
The copy constructor uses reference semantics.
casa::Flux< T >::~Flux | ( | ) |
The destructor is trivial.
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.
static void casa::Flux< T >::circularToStokes | ( | Vector< T > & | out, |
const Vector< typename NumericTraits< T >::ConjugateType > & | in | ||
) | [static] |
static void casa::Flux< T >::circularToStokes | ( | Vector< typename NumericTraits< T >::ConjugateType > & | out, |
const Vector< typename NumericTraits< T >::ConjugateType > & | in | ||
) | [static] |
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.
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.
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.
const Vector<typename NumericTraits<T>::ConjugateType>& casa::Flux< T >::errors | ( | ) | const |
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.
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.
static void casa::Flux< T >::linearToStokes | ( | Vector< T > & | out, |
const Vector< typename NumericTraits< T >::ConjugateType > & | in | ||
) | [static] |
static void casa::Flux< T >::linearToStokes | ( | Vector< typename NumericTraits< T >::ConjugateType > & | out, |
const Vector< typename NumericTraits< T >::ConjugateType > & | in | ||
) | [static] |
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.
Flux<T>& casa::Flux< T >::operator= | ( | const Flux< T > & | other | ) |
The assignment operator uses reference semantics.
ComponentType::Polarisation casa::Flux< T >::pol | ( | ) | const |
These two functions return the current polarisation representation.
void casa::Flux< T >::pol | ( | ComponentType::Polarisation & | pol | ) | const |
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.
void casa::Flux< T >::scaleValue | ( | const T & | factor0, |
const T & | factor1, | ||
const T & | factor2, | ||
const T & | factor3 | ||
) |
void casa::Flux< T >::scaleValue | ( | const typename NumericTraits< T >::ConjugateType & | factor | ) |
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 | ||
) |
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.
void casa::Flux< T >::setErrors | ( | const Vector< typename NumericTraits< T >::ConjugateType > & | errors | ) |
void casa::Flux< T >::setPol | ( | ComponentType::Polarisation | pol | ) |
This function sets the current polarisation representation.
It does NOT convert the flux values.
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".
void casa::Flux< T >::setValue | ( | T | value | ) |
void casa::Flux< T >::setValue | ( | const Vector< T > & | value | ) |
void casa::Flux< T >::setValue | ( | const Vector< typename NumericTraits< T >::ConjugateType > & | value | ) |
void casa::Flux< T >::setValue | ( | const Quantum< Vector< T > > & | value | ) |
void casa::Flux< T >::setValue | ( | const Quantum< Vector< typename NumericTraits< T >::ConjugateType > > & | value, |
ComponentType::Polarisation | pol | ||
) |
void casa::Flux< T >::setValue | ( | const Quantum< T > & | value, |
Stokes::StokesTypes | stokes | ||
) |
static void casa::Flux< T >::stokesToCircular | ( | Vector< typename NumericTraits< T >::ConjugateType > & | out, |
const Vector< T > & | in | ||
) | [static] |
static void casa::Flux< T >::stokesToCircular | ( | Vector< typename NumericTraits< T >::ConjugateType > & | out, |
const Vector< typename NumericTraits< T >::ConjugateType > & | in | ||
) | [static] |
static void casa::Flux< T >::stokesToLinear | ( | Vector< typename NumericTraits< T >::ConjugateType > & | out, |
const Vector< T > & | in | ||
) | [static] |
static void casa::Flux< T >::stokesToLinear | ( | Vector< typename NumericTraits< T >::ConjugateType > & | out, |
const Vector< typename NumericTraits< T >::ConjugateType > & | in | ||
) | [static] |
Bool casa::Flux< T >::toRecord | ( | String & | errorMessage, |
RecordInterface & | record | ||
) | const |
const Unit& casa::Flux< T >::unit | ( | ) | const |
These two functions return the current units.
void casa::Flux< T >::unit | ( | Unit & | unit | ) | const |
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.
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.
void casa::Flux< T >::value | ( | Vector< T > & | value | ) |
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.
void casa::Flux< T >::value | ( | Quantum< Vector< T > > & | value | ) |
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.
Quantum<T> casa::Flux< T >::value | ( | Stokes::StokesTypes | stokes, |
Bool | toJy = True |
||
) |
CountedPtr<FluxRep<T> > casa::Flux< T >::itsFluxPtr [private] |