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.
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 constructor makes an object where I is specified and Q=U=V=0. It assumes a Stokes representation, and units of "Jy".
This constructor makes an object where I,Q,U,V are all specified. It assumes a Stokes representation, and units of "Jy".
This constructor makes an object where the flux values and polarisation representation are specified. It assumes the units are "Jy".
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".
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".
This constructor makes an object where the flux values are all specified
by a Quantum
This constructor makes an object where the flux values are all specified
by a Quantum
The copy constructor uses copy semantics.
The destructor is trivial
The assignment operator uses copy semantics.
These two functions return the current units
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".
This function sets the current units to the supplied value and
additionally converts the internal flux values to the correspond to the
new unit.
These two functions return the current polarisation representation.
This function sets the current polarisation representation. It does NOT
convert the flux values.
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.
This function returns the flux values. The polarisation representation and
units are in whatever is current.
This function returns the specified component of the flux values.
The polarisation representation and units are in whatever is current.
This function returns the flux values after converting it to the Stokes
representation. The units of the returned Vector are the current units.
This function returns the flux values. The polarisation representation and
units are in whatever is current.
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.
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.
Return the flux value in a Quantum for the specified Stokes. Can convert
to Jy if requested.
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.
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.
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.
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.
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.
Set flux for given Stokes from Quantum.
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.
Set/get the errors in the flux
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.
Function which checks the internal data of this class for correct
dimensionality and consistent values. Returns True if everything is fine
otherwise returns False.
This class is nearly identical to the
There are two important differences between the Flux class and the FluxRep
class.
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 default constructor makes an object with I = 1, Q=U=V=0,
a Stokes representation, and units of "Jy".
This constructor makes an object where I,Q,U,V are all specified. It
assumes a Stokes representation, and units of "Jy".
This constructor makes an object where the flux values and polarisation
representation are specified. It assumes the units are "Jy".
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".
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".
This constructor makes an object where the flux values are all specified
by a Quantum
This constructor makes an object where the flux values are all specified
by a Quantum
The copy constructor uses reference semantics.
The destructor is trivial
The assignment operator uses reference semantics.
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.
These two functions return the current units.
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".
This function sets the current units to the supplied value and
additionally converts the internal flux values to the correspond to the
new unit.
These two functions return the current polarisation representation.
This function sets the current polarisation representation. It does NOT
convert the flux values.
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.
This function returns the flux values. The polarisation representation and
units are in whatever is current.
This function returns the specified component of the flux values.
The polarisation representation and units are in whatever is current.
This function returns the flux values after converting it to the Stokes
representation. The units of the returned Vector are the current units.
This function returns the flux values. The polarisation representation and
units are in whatever is current.
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.
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.
Return the flux value in a Quantum for the specified Stokes. Can convert
to Jy if requested.
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.
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.
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.
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.
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.
Set flux for given Stokes from Quantum.
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.
Set/get the errors in the flux
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.
Function which checks the internal data of this class for correct
dimensionality and consistent values. Returns True if everything is fine
otherwise returns False.
This function converts between a Vector in Stokes representation and one
in Circular representation.
This function converts between a Vector in Stokes representation and one
in Circular representation. The imaginary components of the Stokes vector
are NOT ignored.
This function converts between a Vector in Circular representation and one
in Stokes representation. The imaginary components of the Stokes vector
are discarded.
This function converts between a Vector in Circular representation and one
in Stokes representation. The imaginary components of the Stokes vector
are NOT ignored.
This function converts between a Vector in Stokes representation and one
in Linear representation.
This function converts between a Vector in Stokes representation and one
in Linear representation. The imaginary components of the Stokes vector
are NOT ignored.
This function converts between a Vector in Linear representation and one
in Stokes representation. The imaginary components of the Stokes vector
are discarded.
This function converts between a Vector in Linear representation and one
in Stokes representation. The imaginary components of the Stokes vector
are NOT ignored.
This function converts between a Vector in Linear representation and one
in Circular representation.
This function converts between a Vector in Circular representation and one
in Linear representation.
FluxRep(const Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& flux, ComponentType::Polarisation pol)
FluxRep(const FluxRep<T>& other)
~FluxRep()
FluxRep<T>& operator=(const FluxRep<T>& other)
const Unit& unit() const
void unit(Unit& unit) const
void setUnit(const Unit& unit)
void convertUnit(const Unit& unit)
ComponentType::Polarisation pol() const
void pol(ComponentType::Polarisation& pol) const
void setPol(ComponentType::Polarisation pol)
void convertPol(ComponentType::Polarisation pol)
const Vector<typename NumericTraits<T>::ConjugateType>& value() const
const typename NumericTraits<T>::ConjugateType& value(uInt p) const
void value(Vector<T>& value)
void value(Vector<typename NumericTraits<T>::ConjugateType>& value) const
void value(Quantum<Vector<T> >& value)
void value(Quantum <Vector<typename NumericTraits<T>::ConjugateType> >& value) const
Quantum<T> value (Stokes::StokesTypes stokes, Bool toJy=True)
void setValue(T value)
void setValue(const Vector<T>& value)
void setValue(const Vector<typename NumericTraits<T>::ConjugateType>& value)
void setValue(const Quantum<Vector<T> >& value)
void setValue(const Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& value, ComponentType::Polarisation pol)
void setValue (const Quantum<T>& value, Stokes::StokesTypes stokes)
void scaleValue(const T& factor)
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)
const Vector<typename NumericTraits<T>::ConjugateType>& errors() const
Bool fromRecord(String& errorMessage, const RecordInterface& record)
Bool toRecord(String& errorMessage, RecordInterface& record) const
Bool ok() const
template<class T> class Flux
Interface
Description
Review Status
Prerequisite
Etymology
The Flux class is used to represent the flux of a component on the sky
Synopsis
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.
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
Member Description
Flux()
The default constructor makes an object with I = 1, Q=U=V=0,
a Stokes representation, and units of "Jy".
Flux(T i)
Flux(T i, T q, T u, T v)
Flux(typename NumericTraits<T>::ConjugateType xx, typename NumericTraits<T>::ConjugateType xy, typename NumericTraits<T>::ConjugateType yx, typename NumericTraits<T>::ConjugateType yy, ComponentType::Polarisation pol)
Flux(const Vector<T>& flux)
Flux(const Vector<typename NumericTraits<T>::ConjugateType>& flux, ComponentType::Polarisation pol)
Flux(const Quantum<Vector<T> >& flux)
Flux(const Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& flux, ComponentType::Polarisation pol)
Flux(const Flux<T>& other)
~Flux()
Flux<T>& operator=(const Flux<T>& other)
Flux<T> copy() const
const Unit& unit() const
void unit(Unit& unit) const
void setUnit(const Unit& unit)
void convertUnit(const Unit& unit)
ComponentType::Polarisation pol() const
void pol(ComponentType::Polarisation& pol) const
void setPol(ComponentType::Polarisation pol)
void convertPol(ComponentType::Polarisation pol)
const Vector<typename NumericTraits<T>::ConjugateType>& value() const
const typename NumericTraits<T>::ConjugateType& value(uInt p) const
void value(Vector<T>& value)
void value(Vector<typename NumericTraits<T>::ConjugateType>& value) const
void value(Quantum<Vector<T> >& value)
void value(Quantum <Vector<typename NumericTraits<T>::ConjugateType> >& value) const
Quantum<T> value (Stokes::StokesTypes stokes, Bool toJy=True)
void setValue(T value)
void setValue(const Vector<T>& value)
void setValue(const Vector<typename NumericTraits<T>::ConjugateType>& value)
void setValue(const Quantum<Vector<T> >& value)
void setValue(const Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& value, ComponentType::Polarisation pol)
void setValue (const Quantum<T>& value, Stokes::StokesTypes stokes)
void scaleValue(const T& factor)
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)
const Vector<typename NumericTraits<T>::ConjugateType>& errors() const
Bool fromRecord(String& errorMessage, const RecordInterface& record)
Bool toRecord(String& errorMessage, RecordInterface& record) const
Bool ok() const
static void stokesToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, const Vector<T>& in)
static void stokesToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, const Vector<typename NumericTraits<T>::ConjugateType>& in)
static void circularToStokes(Vector<T>& out, const Vector<typename NumericTraits<T>::ConjugateType>& in)
static void circularToStokes(Vector<typename NumericTraits<T>::ConjugateType>& out, const Vector<typename NumericTraits<T>::ConjugateType>& in)
static void stokesToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, const Vector<T>& in)
static void stokesToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, const Vector<typename NumericTraits<T>::ConjugateType>& in)
static void linearToStokes(Vector<T>& out, const Vector<typename NumericTraits<T>::ConjugateType>& in)
static void linearToStokes(Vector<typename NumericTraits<T>::ConjugateType>& out, const Vector<typename NumericTraits<T>::ConjugateType>& in)
static void linearToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, const Vector<typename NumericTraits<T>::ConjugateType>& in)
static void circularToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, const Vector<typename NumericTraits<T>::ConjugateType>& in)