casa
$Rev:20696$
|
A class that represents the Flux (copy semantics) More...
#include <Flux.h>
Public Member Functions | |
FluxRep () | |
The default constructor makes an object with I = 1, Q=U=V=0 , a Stokes representation, and units of "Jy". | |
FluxRep (T i) | |
This constructor makes an object where I is specified and Q=U=V=0 . | |
FluxRep (T i, T q, T u, T v) | |
This constructor makes an object where I,Q,U,V are all specified. | |
FluxRep (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. | |
FluxRep (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. | |
FluxRep (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. | |
FluxRep (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. | |
FluxRep (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. | |
FluxRep (const FluxRep< T > &other) | |
The copy constructor uses copy semantics. | |
~FluxRep () | |
The destructor is trivial. | |
FluxRep< T > & | operator= (const FluxRep< T > &other) |
The assignment operator uses copy semantics. | |
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 FluxRep object and define how the FluxRep 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 | setAllowedUnits (const Vector< String > &allowedUnits) |
in addition to Jy, allow these "flux" units. | |
static void | clearAllowedUnits () |
clear all allowed units set by setAllowedUnits | |
Private Attributes | |
Vector< typename NumericTraits < T >::ConjugateType > | itsVal |
ComponentType::Polarisation | itsPol |
Unit | itsUnit |
Vector< typename NumericTraits < T >::ConjugateType > | itsErr |
Static Private Attributes | |
static Vector< String > | _allowedUnits |
A class that represents the Flux (copy semantics)
Public interface
<h3>Review Status</h3><dl><dt>Date Reviewed:<dd>yyyy/mm/dd</dl>
This class actually contains the flux values as distinct from the Flux class which is a pointer to this class. Hence this class name is a shortening of "Flux Representation". The Flux class is probably of more general user utility as its reference semantics can cut down on the number of temporary objects that get constructed.
This class encapsulates three quantities that are needed to more completely represent the polarised flux of a component. These quantities are:
This class is templated but only two templated types are valid. These are:
The template type defines the precision of the Flux Values.
This class uses functions in the Flux class which convert between the different polarisation representations. They assume (until a decision has been made on this) that the total intensity is the average of the linear or circular correlation products. ie., I = (RR+LL)/2 = (XX+YY)/2
.
In order to represent the Flux using the circular or linear representations the Flux values need to be complex (eg.,XY = I + iV, YX = I - iV
) This class does not require, or check a number of constraints such as XY = conj(YX)
and hence it is possible to define a flux using a linear or circular representation that cannot be completely represented using the Stokes representation. Because this class stores the flux values as complex numbers there is no loss of accuracy when converting between different polarisation representations. But it discards the imaginary component of the flux when externally representing the flux using with a Stokes representation (eg., when calling the value(Vector<T>&)
function).
Because this class using Complex numbers with a precision that depends on the template type many of the function arguments are of type NumericTraits<T>
. This simply a type that maps to Complex if T is Float and DComplex if T is a Double. Because of problems with the the gnu compiler functions which use this type as an argument MUST be inline. Hopefully this problem will go away sometime.
The following example creates a FluxRep object using a Stokes representation and converts it to "WU" (Westerbork Units). After printing out the converted I flux it converts the Flux to a linear representation and prints out a Vector with the [XX,XY,YX,YY] values (still in "WU")
FluxRep<Double> flux(1.0, 0.0, 0.0, 0.1); // I = 1.0, V = 0.1 flux.convertUnit("WU"); cout << "The I flux (in WU is)" << flux.value(0) << endl; flux.convertPol(ComponentType::LINEAR); cout << "The XX,XY,YX,YY flux (in WU is)" << flux.value() << endl;
This class was needed to contain the flux in the ComponentModels module and centralizes a lot of code that would otherwise be duplicated in disparate places.
casa::FluxRep< T >::FluxRep | ( | ) |
The default constructor makes an object with I = 1, Q=U=V=0
, a Stokes representation, and units of "Jy".
casa::FluxRep< T >::FluxRep | ( | T | i | ) |
This constructor makes an object where I is specified and Q=U=V=0
.
It assumes a Stokes representation, and units of "Jy".
casa::FluxRep< T >::FluxRep | ( | 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::FluxRep< T >::FluxRep | ( | 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::FluxRep< T >::FluxRep | ( | const Vector< T > & | flux | ) |
casa::FluxRep< T >::FluxRep | ( | 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::FluxRep< T >::FluxRep | ( | const Quantum< Vector< T > > & | flux | ) |
casa::FluxRep< T >::FluxRep | ( | 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::FluxRep< T >::FluxRep | ( | const FluxRep< T > & | other | ) |
The copy constructor uses copy semantics.
casa::FluxRep< T >::~FluxRep | ( | ) |
The destructor is trivial.
static void casa::FluxRep< T >::clearAllowedUnits | ( | ) | [static] |
clear all allowed units set by setAllowedUnits
void casa::FluxRep< 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::FluxRep< 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.
const Vector<typename NumericTraits<T>::ConjugateType>& casa::FluxRep< T >::errors | ( | ) | const |
Bool casa::FluxRep< T >::fromRecord | ( | String & | errorMessage, |
const RecordInterface & | record | ||
) |
This functions convert between a RecordInterface and a FluxRep object and define how the FluxRep is represented in glish.
They return False if the RecordInterface is malformed and append an error message to the supplied string giving the reason.
Bool casa::FluxRep< 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.
FluxRep<T>& casa::FluxRep< T >::operator= | ( | const FluxRep< T > & | other | ) |
The assignment operator uses copy semantics.
ComponentType::Polarisation casa::FluxRep< T >::pol | ( | ) | const |
These two functions return the current polarisation representation.
void casa::FluxRep< T >::pol | ( | ComponentType::Polarisation & | pol | ) | const |
void casa::FluxRep< 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::FluxRep< T >::scaleValue | ( | const T & | factor0, |
const T & | factor1, | ||
const T & | factor2, | ||
const T & | factor3 | ||
) |
void casa::FluxRep< T >::scaleValue | ( | const typename NumericTraits< T >::ConjugateType & | factor | ) |
void casa::FluxRep< 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 | ||
) |
static void casa::FluxRep< T >::setAllowedUnits | ( | const Vector< String > & | allowedUnits | ) | [static] |
in addition to Jy, allow these "flux" units.
Useful when images have "flux-like" units such as Jy.km/s
void casa::FluxRep< 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::FluxRep< T >::setErrors | ( | const Vector< typename NumericTraits< T >::ConjugateType > & | errors | ) |
void casa::FluxRep< T >::setPol | ( | ComponentType::Polarisation | pol | ) |
This function sets the current polarisation representation.
It does NOT convert the flux values.
void casa::FluxRep< 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::FluxRep< T >::setValue | ( | T | value | ) |
void casa::FluxRep< T >::setValue | ( | const Vector< T > & | value | ) |
void casa::FluxRep< T >::setValue | ( | const Vector< typename NumericTraits< T >::ConjugateType > & | value | ) |
void casa::FluxRep< T >::setValue | ( | const Quantum< Vector< T > > & | value | ) |
void casa::FluxRep< T >::setValue | ( | const Quantum< Vector< typename NumericTraits< T >::ConjugateType > > & | value, |
ComponentType::Polarisation | pol | ||
) |
void casa::FluxRep< T >::setValue | ( | const Quantum< T > & | value, |
Stokes::StokesTypes | stokes | ||
) |
Bool casa::FluxRep< T >::toRecord | ( | String & | errorMessage, |
RecordInterface & | record | ||
) | const |
const Unit& casa::FluxRep< T >::unit | ( | ) | const |
These two functions return the current units.
void casa::FluxRep< T >::unit | ( | Unit & | unit | ) | const |
const Vector<typename NumericTraits<T>::ConjugateType>& casa::FluxRep< T >::value | ( | ) | const |
This function returns the flux values.
The polarisation representation and units are in whatever is current.
const NumericTraits<T>::ConjugateType& casa::FluxRep< 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::FluxRep< T >::value | ( | Vector< T > & | value | ) |
void casa::FluxRep< 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::FluxRep< T >::value | ( | Quantum< Vector< T > > & | value | ) |
void casa::FluxRep< 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::FluxRep< T >::value | ( | Stokes::StokesTypes | stokes, |
Bool | toJy = True |
||
) |
Vector<String> casa::FluxRep< T >::_allowedUnits [static, private] |
Vector<typename NumericTraits<T>::ConjugateType> casa::FluxRep< T >::itsErr [private] |
ComponentType::Polarisation casa::FluxRep< T >::itsPol [private] |
Unit casa::FluxRep< T >::itsUnit [private] |
Vector<typename NumericTraits<T>::ConjugateType> casa::FluxRep< T >::itsVal [private] |