casa
5.7.0-16
|
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 casacore::Stokes representation, and units of "Jy". More... | |
FluxRep (T i) | |
This constructor makes an object where I is specified and Q=U=V=0 . More... | |
FluxRep (T i, T q, T u, T v) | |
This constructor makes an object where I,Q,U,V are all specified. More... | |
FluxRep (typename casacore::NumericTraits< T >::ConjugateType xx, typename casacore::NumericTraits< T >::ConjugateType xy, typename casacore::NumericTraits< T >::ConjugateType yx, typename casacore::NumericTraits< T >::ConjugateType yy, ComponentType::Polarisation pol) | |
This constructor makes an object where the flux values and polarisation representation are specified. More... | |
FluxRep (const casacore::Vector< T > &flux) | |
This constructor makes an object where I,Q,U,V are all specified by a casacore::Vector that must have four elements. More... | |
FluxRep (const casacore::Vector< typename casacore::NumericTraits< T >::ConjugateType > &flux, ComponentType::Polarisation pol) | |
This constructor makes an object where the flux values are all specified by a casacore::Vector that must have four elements. More... | |
FluxRep (const casacore::Quantum< casacore::Vector< T > > &flux) | |
This constructor makes an object where the flux values are all specified by a casacore::Quantum<casacore::Vector> that must have four elements. More... | |
FluxRep (const casacore::Quantum< casacore::Vector< typename casacore::NumericTraits< T >::ConjugateType > > &flux, ComponentType::Polarisation pol) | |
This constructor makes an object where the flux values are all specified by a casacore::Quantum<casacore::Vector> that must have four elements. More... | |
FluxRep (const FluxRep< T > &other) | |
The copy constructor uses copy semantics. More... | |
~FluxRep () | |
The destructor is trivial. More... | |
FluxRep< T > & | operator= (const FluxRep< T > &other) |
The assignment operator uses copy semantics. More... | |
const casacore::Unit & | unit () const |
These two functions return the current units. More... | |
void | unit (casacore::Unit &unit) const |
void | setUnit (const casacore::Unit &unit) |
This function sets the current unit. More... | |
void | convertUnit (const casacore::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. More... | |
ComponentType::Polarisation | pol () const |
These two functions return the current polarisation representation. More... | |
void | pol (ComponentType::Polarisation &pol) const |
void | setPol (ComponentType::Polarisation pol) |
This function sets the current polarisation representation. More... | |
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. More... | |
const casacore::Vector < typename casacore::NumericTraits< T > ::ConjugateType > & | value () const |
This function returns the flux values. More... | |
const casacore::NumericTraits < T >::ConjugateType & | value (casacore::uInt p) const |
This function returns the specified component of the flux values. More... | |
void | value (casacore::Vector< T > &value) |
This function returns the flux values after converting it to the Stokes representation. More... | |
void | value (casacore::Vector< typename casacore::NumericTraits< T >::ConjugateType > &value) const |
This function returns the flux values. More... | |
void | value (casacore::Quantum< casacore::Vector< T > > &value) |
This function returns the flux values after converting it to the Stokes representation. More... | |
void | value (casacore::Quantum< casacore::Vector< typename casacore::NumericTraits< T >::ConjugateType > > &value) const |
This function returns the flux values. More... | |
casacore::Quantum< T > | value (casacore::Stokes::StokesTypes stokes, casacore::Bool toJy=true) |
Return the flux value in a casacore::Quantum for the specified Stokes. More... | |
void | setValue (T value) |
This function sets the Flux values assuming the supplied value represents the casacore::Stokes I flux in the current units. More... | |
void | setValue (const casacore::Vector< T > &value) |
This function sets the Flux values assuming the supplied values represent the flux in the casacore::Stokes representation and is in the current units. More... | |
void | setValue (const casacore::Vector< typename casacore::NumericTraits< T >::ConjugateType > &value) |
This function sets the Flux values assuming the supplied values represent the flux in the current representation and units. More... | |
void | setValue (const casacore::Quantum< casacore::Vector< T > > &value) |
This function sets the flux values and units assuming the supplied values represent the flux in the casacore::Stokes representation. More... | |
void | setValue (const casacore::Quantum< casacore::Vector< typename casacore::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. More... | |
void | setValue (const casacore::Quantum< T > &value, casacore::Stokes::StokesTypes stokes) |
Set flux for given casacore::Stokes from Quantum. More... | |
void | scaleValue (const T &factor) |
Scale the Flux value by the specified amount. More... | |
void | scaleValue (const T &factor0, const T &factor1, const T &factor2, const T &factor3) |
void | scaleValue (const typename casacore::NumericTraits< T >::ConjugateType &factor) |
void | scaleValue (const typename casacore::NumericTraits< T >::ConjugateType &factor0, const typename casacore::NumericTraits< T >::ConjugateType &factor1, const typename casacore::NumericTraits< T >::ConjugateType &factor2, const typename casacore::NumericTraits< T >::ConjugateType &factor3) |
void | setErrors (const typename casacore::NumericTraits< T >::ConjugateType &error0, const typename casacore::NumericTraits< T >::ConjugateType &error1, const typename casacore::NumericTraits< T >::ConjugateType &error2, const typename casacore::NumericTraits< T >::ConjugateType &error3) |
Set/get the errors in the flux. More... | |
void | setErrors (const casacore::Vector< typename casacore::NumericTraits< T >::ConjugateType > &errors) |
const casacore::Vector < typename casacore::NumericTraits< T > ::ConjugateType > & | errors () const |
casacore::Bool | fromRecord (casacore::String &errorMessage, const casacore::RecordInterface &record) |
This functions convert between a casacore::RecordInterface and a FluxRep object and define how the FluxRep is represented in glish. More... | |
casacore::Bool | toRecord (casacore::String &errorMessage, casacore::RecordInterface &record) const |
casacore::Bool | ok () const |
casacore::Function which checks the internal data of this class for correct dimensionality and consistent values. More... | |
Static Private Member Functions | |
static casacore::Unit | _getConversionUnit (const casacore::Unit &unit) |
returns the conversion unit to which unit conforms. More... | |
Private Attributes | |
casacore::Vector< typename casacore::NumericTraits< T > ::ConjugateType > | itsVal |
ComponentType::Polarisation | itsPol |
casacore::Unit | itsUnit |
casacore::Vector< typename casacore::NumericTraits< T > ::ConjugateType > | itsErr |
Static Private Attributes | |
static const std::vector < casacore::Unit > | _allowedUnits |
A class that represents the Flux (copy semantics)
Public interface
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 casacore::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 casacore::Stokes representation (eg., when calling the value(casacore::Vector<T>&)
function).
Because this class using casacore::Complex numbers with a precision that depends on the template type many of the function arguments are of type casacore::NumericTraits<T>
. This simply a type that maps to casacore::Complex if T is casacore::Float and casacore::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 casacore::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 casacore::Vector with the [XX,XY,YX,YY] values (still in "WU")
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 casacore::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 casacore::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 casacore::Stokes representation, and units of "Jy".
casa::FluxRep< T >::FluxRep | ( | typename casacore::NumericTraits< T >::ConjugateType | xx, |
typename casacore::NumericTraits< T >::ConjugateType | xy, | ||
typename casacore::NumericTraits< T >::ConjugateType | yx, | ||
typename casacore::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 casacore::Vector< T > & | flux | ) |
This constructor makes an object where I,Q,U,V are all specified by a casacore::Vector that must have four elements.
It assumes a casacore::Stokes representation, and units of "Jy".
casa::FluxRep< T >::FluxRep | ( | const casacore::Vector< typename casacore::NumericTraits< T >::ConjugateType > & | flux, |
ComponentType::Polarisation | pol | ||
) |
This constructor makes an object where the flux values are all specified by a casacore::Vector that must have four elements.
The polarisation representation must also be specified. It assumes the units are "Jy".
casa::FluxRep< T >::FluxRep | ( | const casacore::Quantum< casacore::Vector< T > > & | flux | ) |
This constructor makes an object where the flux values are all specified by a casacore::Quantum<casacore::Vector> that must have four elements.
The casacore::Quantum must have units that are dimensionally equivalent to the "Jy" and these are the units of the FluxRep object. A casacore::Stokes polarisation representation is assumed.
casa::FluxRep< T >::FluxRep | ( | const casacore::Quantum< casacore::Vector< typename casacore::NumericTraits< T >::ConjugateType > > & | flux, |
ComponentType::Polarisation | pol | ||
) |
This constructor makes an object where the flux values are all specified by a casacore::Quantum<casacore::Vector> that must have four elements.
The casacore::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.
|
staticprivate |
returns the conversion unit to which unit
conforms.
If unit
does not conform to a supported unit, an exception is thrown.
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 casacore::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 casacore::Vector<typename casacore::NumericTraits<T>::ConjugateType>& casa::FluxRep< T >::errors | ( | ) | const |
casacore::Bool casa::FluxRep< T >::fromRecord | ( | casacore::String & | errorMessage, |
const casacore::RecordInterface & | record | ||
) |
This functions convert between a casacore::RecordInterface and a FluxRep object and define how the FluxRep is represented in glish.
They return false if the casacore::RecordInterface is malformed and append an error message to the supplied string giving the reason.
casacore::Bool casa::FluxRep< T >::ok | ( | ) | const |
casacore::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 casacore::NumericTraits< T >::ConjugateType & | factor | ) |
void casa::FluxRep< T >::scaleValue | ( | const typename casacore::NumericTraits< T >::ConjugateType & | factor0, |
const typename casacore::NumericTraits< T >::ConjugateType & | factor1, | ||
const typename casacore::NumericTraits< T >::ConjugateType & | factor2, | ||
const typename casacore::NumericTraits< T >::ConjugateType & | factor3 | ||
) |
void casa::FluxRep< T >::setErrors | ( | const typename casacore::NumericTraits< T >::ConjugateType & | error0, |
const typename casacore::NumericTraits< T >::ConjugateType & | error1, | ||
const typename casacore::NumericTraits< T >::ConjugateType & | error2, | ||
const typename casacore::NumericTraits< T >::ConjugateType & | error3 | ||
) |
Set/get the errors in the flux.
void casa::FluxRep< T >::setErrors | ( | const casacore::Vector< typename casacore::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 casacore::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 | ) |
This function sets the Flux values assuming the supplied value represents the casacore::Stokes I flux in the current units.
The other casacore::Stokes parameters are set to zero.
void casa::FluxRep< T >::setValue | ( | const casacore::Vector< T > & | value | ) |
This function sets the Flux values assuming the supplied values represent the flux in the casacore::Stokes representation and is in the current units.
The casacore::Vector must have four elements.
void casa::FluxRep< T >::setValue | ( | const casacore::Vector< typename casacore::NumericTraits< T >::ConjugateType > & | value | ) |
This function sets the Flux values assuming the supplied values represent the flux in the current representation and units.
The casacore::Vector must have four elements.
void casa::FluxRep< T >::setValue | ( | const casacore::Quantum< casacore::Vector< T > > & | value | ) |
This function sets the flux values and units assuming the supplied values represent the flux in the casacore::Stokes representation.
The units of the Quantum must be dimensionally equivalent to the "Jy" and the casacore::Vector must have four elements.
void casa::FluxRep< T >::setValue | ( | const casacore::Quantum< casacore::Vector< typename casacore::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 casacore::Quantum must be dimensionally equivalent to the "Jy" and the casacore::Vector must have four elements.
void casa::FluxRep< T >::setValue | ( | const casacore::Quantum< T > & | value, |
casacore::Stokes::StokesTypes | stokes | ||
) |
Set flux for given casacore::Stokes from Quantum.
casacore::Bool casa::FluxRep< T >::toRecord | ( | casacore::String & | errorMessage, |
casacore::RecordInterface & | record | ||
) | const |
const casacore::Unit& casa::FluxRep< T >::unit | ( | ) | const |
These two functions return the current units.
void casa::FluxRep< T >::unit | ( | casacore::Unit & | unit | ) | const |
const casacore::Vector<typename casacore::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 casacore::NumericTraits<T>::ConjugateType& casa::FluxRep< T >::value | ( | casacore::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 | ( | casacore::Vector< T > & | value | ) |
This function returns the flux values after converting it to the Stokes representation.
The units of the returned casacore::Vector are the current units.
void casa::FluxRep< T >::value | ( | casacore::Vector< typename casacore::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 | ( | casacore::Quantum< casacore::Vector< T > > & | value | ) |
This function returns the flux values after converting it to the Stokes representation.
The units of the returned casacore::Quantum are the current units of the FluxRep object. The length of the casacore::Vector in the casacore::Quantum will be resized to 4 elements if it is not already that length.
void casa::FluxRep< T >::value | ( | casacore::Quantum< casacore::Vector< typename casacore::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 casacore::Quantum is the current polarisation representation. The length of the casacore::Vector in the casacore::Quantum will be resized to 4 elements if it is not already that length.
casacore::Quantum<T> casa::FluxRep< T >::value | ( | casacore::Stokes::StokesTypes | stokes, |
casacore::Bool | toJy = true |
||
) |
Return the flux value in a casacore::Quantum for the specified Stokes.
Can convert to Jy if requested.
|
staticprivate |
|
private |
|
private |
|
private |
|
private |