Flux.h

Go to the documentation of this file.
00001 //# Flux.h:
00002 //# Copyright (C) 1998,1999,2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id: Flux.h 21130 2011-10-18 07:39:05Z gervandiepen $
00028 
00029 #ifndef COMPONENTS_FLUX_H
00030 #define COMPONENTS_FLUX_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/Arrays/Vector.h>
00034 #include <scimath/Mathematics/NumericTraits.h>
00035 #include <measures/Measures/Stokes.h>
00036 #include <casa/Quanta/Unit.h>
00037 #include <casa/Utilities/CountedPtr.h>
00038 #include <components/ComponentModels/ComponentType.h>
00039 
00040 namespace casa { //# NAMESPACE CASA - BEGIN
00041 
00042 class RecordInterface;
00043 template <class Qtype> class Quantum;
00044 
00045 // <summary>A class that represents the Flux (copy semantics)</summary>
00046 
00047 // <use visibility=export>
00048 
00049 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00050 // </reviewed>
00051 
00052 // <prerequisite>
00053 //   <li> <linkto class="Vector">Vector</linkto>
00054 //   <li> <linkto class="Unit">Unit</linkto>
00055 // </prerequisite>
00056 //
00057 // <etymology>
00058 // This class actually contains the flux values as distinct from the Flux class
00059 // which is a pointer to this class. Hence this class name is a shortening of
00060 // "Flux Representation". The Flux class is probably of more general user
00061 // utility as its reference semantics can cut down on the number of temporary
00062 // objects that get constructed.
00063 // </etymology>
00064 //
00065 // <synopsis>
00066 // This class encapsulates three quantities that are needed to more completely
00067 // represent the polarised flux of a component. These quantities are:
00068 // <dl>
00069 // <dt> Flux values.
00070 // <dd> These are four numbers which are the numerical value of the flux in all
00071 //      four polarisations. The values can be represented in either single or
00072 //      double precision depending on the template type.
00073 // <dt> Flux units.
00074 // <dd> These are the units for the flux values. The units must have dimensions
00075 //      of W/m^2/Hz and are represented using the
00076 //      <linkto class="Unit">Unit</linkto> class. The most common unit is "Jy".
00077 // <dt> Polarisation representation.
00078 // <dd> This describes how the polarised flux is represented. It can be one of
00079 //      the following:
00080 //      <dl compact><dt>Stokes<dd>
00081 //      The flux is representing using the Stokes I, Q, U, V components
00082 //      respectively.
00083 //      <dt>Linear<dd>
00084 //      The flux is representing using the XX,XY,YX,YY correlation products
00085 //      resp. X and Y is the signal from linear feeds at zero parallactic
00086 //      angle.
00087 //      <dt>Circular<dd>
00088 //      The flux is representing using the RR,RL,LR,LL correlation products
00089 //      resp. R and L is the signal from right and left handed circular feeds.
00090 //      </dl>
00091 // </dl>
00092 // This class is templated but only two templated types are valid. These are:
00093 // <ul> 
00094 // <li> T = Float
00095 // <li> T = Double
00096 // </ul>
00097 // The template type defines the precision of the Flux Values.
00098 //
00099 // This class uses functions in the Flux class which convert between the
00100 // different polarisation representations. They assume (until a decision has
00101 // been made on this) that the total intensity is the average of the linear or
00102 // circular correlation products. ie., <src>I = (RR+LL)/2 = (XX+YY)/2</src>.
00103 //
00104 // In order to represent the Flux using the circular or linear representations
00105 // the Flux values need to be complex (eg.,<src>XY = I + iV, YX = I - iV</src>)
00106 // This class does not require, or check a number of constraints such as
00107 // <src>XY = conj(YX)</src> and hence it is possible to define a flux using a
00108 // linear or circular representation that cannot be completely represented
00109 // using the Stokes representation. Because this class stores the flux values
00110 // as complex numbers there is no loss of accuracy when converting between
00111 // different polarisation representations. But it discards the imaginary
00112 // component of the flux when externally representing the flux using with a
00113 // Stokes representation (eg., when calling the <src>value(Vector<T>&)</src>
00114 // function).
00115 //
00116 // Because this class using Complex numbers with a precision that depends on
00117 // the template type many of the function arguments are of type
00118 // <src>NumericTraits<T></src>. This simply a type that maps to Complex if T is
00119 // Float and DComplex if T is a Double. Because of problems with the the gnu
00120 // compiler functions which use this type as an argument MUST be
00121 // inline. Hopefully this problem will go away sometime.
00122 // </synopsis>
00123 //
00124 // <example>
00125 // The following example creates a FluxRep object using a Stokes representation
00126 // and converts it to "WU" (Westerbork Units). After printing out the converted
00127 // I flux it converts the Flux to a linear representation and prints out a
00128 // Vector with the [XX,XY,YX,YY] values (still in "WU")
00129 // <srcblock>
00130 // FluxRep<Double> flux(1.0, 0.0, 0.0, 0.1); // I = 1.0, V = 0.1
00131 // flux.convertUnit("WU");
00132 // cout << "The I flux (in WU is)" << flux.value(0) << endl;
00133 // flux.convertPol(ComponentType::LINEAR);
00134 // cout << "The XX,XY,YX,YY flux (in WU is)" << flux.value() << endl;
00135 // </srcblock>
00136 // </example>
00137 //
00138 // <motivation>
00139 // This class was needed to contain the flux in the ComponentModels module and
00140 // centralizes a lot of code that would otherwise be duplicated in disparate
00141 // places. 
00142 // </motivation>
00143 //
00144 // <thrown>
00145 //    <li> AipsError, When the Vectors are not of length 4 or when indices are
00146 //          greater than 4
00147 // </thrown>
00148 //
00149 // <todo asof="1998/03/11">
00150 //   <li> get this class reviewed.
00151 // </todo>
00152 
00153 template<class T> class FluxRep
00154 {
00155 public:
00156 
00157   // The default constructor makes an object with <src>I = 1, Q=U=V=0</src>,
00158   // a Stokes representation, and units of "Jy".
00159   FluxRep();
00160 
00161   // This constructor makes an object where I is specified and
00162   // <src>Q=U=V=0</src>. It assumes a Stokes representation, and units of "Jy".
00163   FluxRep(T i);
00164 
00165   // This constructor makes an object where I,Q,U,V are all specified. It
00166   // assumes a Stokes representation, and units of "Jy".
00167   FluxRep(T i, T q, T u, T v);
00168 
00169   // This constructor makes an object where the flux values and polarisation
00170   // representation are specified. It assumes the units are "Jy".
00171   FluxRep(typename NumericTraits<T>::ConjugateType xx,
00172           typename NumericTraits<T>::ConjugateType xy,
00173           typename NumericTraits<T>::ConjugateType yx,
00174           typename NumericTraits<T>::ConjugateType yy,
00175           ComponentType::Polarisation pol);
00176   
00177   // This constructor makes an object where I,Q,U,V are all specified by a
00178   // Vector that must have four elements. It assumes a Stokes representation,
00179   // and units of "Jy".
00180   FluxRep(const Vector<T>& flux);
00181 
00182   // This constructor makes an object where the flux values are all specified
00183   // by a Vector that must have four elements. The polarisation representation
00184   // must also be specified. It assumes the units are "Jy".
00185   FluxRep(const Vector<typename NumericTraits<T>::ConjugateType>& flux,
00186           ComponentType::Polarisation pol);
00187   
00188   // This constructor makes an object where the flux values are all specified
00189   // by a Quantum<Vector> that must have four elements.  The Quantum must have
00190   // units that are dimensionally equivalent to the "Jy" and these are the
00191   // units of the FluxRep object. A Stokes polarisation representation is
00192   // assumed.
00193   FluxRep(const Quantum<Vector<T> >& flux);
00194 
00195   // This constructor makes an object where the flux values are all specified
00196   // by a Quantum<Vector> that must have four elements. The Quantum must have
00197   // units that are dimensionally equivalent to the "Jy" and these are the
00198   // units of the FluxRep object. The polarisation representation must also be
00199   // specified.
00200   FluxRep(const
00201           Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& flux,
00202           ComponentType::Polarisation pol);
00203 
00204   // The copy constructor uses copy semantics.
00205   FluxRep(const FluxRep<T>& other);
00206 
00207   // The destructor is trivial
00208   ~FluxRep();
00209 
00210   // The assignment operator uses copy semantics.
00211   FluxRep<T>& operator=(const FluxRep<T>& other);
00212 
00213   // These two functions return the current units
00214   // <group>
00215   const Unit& unit() const;
00216   void unit(Unit& unit) const;
00217   // </group>
00218 
00219   // This function sets the current unit. It does NOT convert the flux values
00220   // to correspond to the new unit. The new unit must be dimensionally
00221   // equivalent to the "Jy".
00222   void setUnit(const Unit& unit);
00223 
00224   // This function sets the current units to the supplied value and
00225   // additionally converts the internal flux values to the correspond to the
00226   // new unit.
00227   void convertUnit(const Unit& unit);
00228 
00229   // These two functions return the current polarisation representation.
00230   // <group>
00231   ComponentType::Polarisation pol() const;
00232   void pol(ComponentType::Polarisation& pol) const;
00233   // </group>
00234 
00235   // This function sets the current polarisation representation. It does NOT
00236   // convert the flux values.
00237   void setPol(ComponentType::Polarisation pol);
00238 
00239   // This function sets the current polarisation representation to the supplied
00240   // value and additionally converts the internal flux values to the correspond
00241   // to the new polarisation representation.
00242   void convertPol(ComponentType::Polarisation pol);
00243 
00244   // This function returns the flux values. The polarisation representation and
00245   // units are in whatever is current.
00246   const Vector<typename NumericTraits<T>::ConjugateType>& value() const;
00247 
00248   // This function returns the specified component of the flux values.
00249   // The polarisation representation and units are in whatever is current.
00250   const typename NumericTraits<T>::ConjugateType& value(uInt p) const;
00251 
00252   // This function returns the flux values after converting it to the Stokes
00253   // representation. The units of the returned Vector are the current units.
00254   void value(Vector<T>& value);
00255 
00256   // This function returns the flux values. The polarisation representation and
00257   // units are in whatever is current.
00258   void value(Vector<typename NumericTraits<T>::ConjugateType>& value) const;
00259 
00260   // This function returns the flux values after converting it to the Stokes
00261   // representation. The units of the returned Quantum are the current units of
00262   // the FluxRep object. The length of the Vector in the Quantum will be
00263   // resized to 4 elements if it is not already that length.
00264   void value(Quantum<Vector<T> >& value);
00265 
00266   // This function returns the flux values. The units of the returned Quantum
00267   // are the current units of the FluxRep object. Similarly the polarisation
00268   // representation of the returned Quantum is the current polarisation
00269   // representation. The length of the Vector in the Quantum will be resized to
00270   // 4 elements if it is not already that length.
00271   void value(Quantum
00272              <Vector<typename NumericTraits<T>::ConjugateType> >& value) const;
00273 
00274   // Return the flux value in a Quantum for the specified Stokes.  Can convert
00275   // to Jy if requested.  
00276   Quantum<T> value (Stokes::StokesTypes stokes, Bool toJy=True);
00277 
00278   // This function sets the Flux values assuming the supplied value represents
00279   // the Stokes I flux in the current units. The other Stokes parameters are
00280   // set to zero.
00281   void setValue(T value);
00282  
00283   // This function sets the Flux values assuming the supplied values represent
00284   // the flux in the Stokes representation and is in the current units. The
00285   // Vector must have four elements.
00286   void setValue(const Vector<T>& value); 
00287 
00288   // This function sets the Flux values assuming the supplied values represent
00289   // the flux in the current representation and units. The Vector must have
00290   // four elements.
00291   void setValue(const Vector<typename NumericTraits<T>::ConjugateType>& value);
00292 
00293   // This function sets the flux values and units assuming the supplied values
00294   // represent the flux in the Stokes representation. The units of the Quantum
00295   // must be dimensionally equivalent to the "Jy" and the Vector must have four
00296   // elements.
00297   void setValue(const Quantum<Vector<T> >& value);
00298 
00299   // This function sets the flux values, units and polarisation assuming the
00300   // supplied values represent the flux in the specified representation. The
00301   // units of the Quantum must be dimensionally equivalent to the "Jy" and the
00302   // Vector must have four elements.
00303   void setValue(const
00304                 Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& value,
00305                 ComponentType::Polarisation pol);
00306 
00307   // Set flux for given Stokes from Quantum. 
00308   void setValue (const Quantum<T>& value, Stokes::StokesTypes stokes);
00309 
00310   // Scale the Flux value by the specified amount. These functions multiply the
00311   // flux values irrespective of the current polarisation representation. If
00312   // only one scale factor is supplied then only the first component of the
00313   // flux is scaled.
00314   // <group>
00315   void scaleValue(const T& factor);
00316   void scaleValue(const T& factor0, const T& factor1,
00317                   const T& factor2, const T& factor3);
00318   void scaleValue(const typename NumericTraits<T>::ConjugateType& factor);
00319   void scaleValue(const typename NumericTraits<T>::ConjugateType& factor0,
00320                   const typename NumericTraits<T>::ConjugateType& factor1,
00321                   const typename NumericTraits<T>::ConjugateType& factor2,
00322                   const typename NumericTraits<T>::ConjugateType& factor3);
00323   // </group>
00324 
00325   // Set/get the errors in the flux
00326   // <group>
00327   void setErrors(const typename NumericTraits<T>::ConjugateType& error0,
00328                  const typename NumericTraits<T>::ConjugateType& error1,
00329                  const typename NumericTraits<T>::ConjugateType& error2,
00330                  const typename NumericTraits<T>::ConjugateType& error3);
00331 
00332   void setErrors(const Vector<typename NumericTraits<T>::ConjugateType>& errors);
00333 
00334   const Vector<typename NumericTraits<T>::ConjugateType>& errors() const;
00335   // </group>
00336 
00337   // This functions convert between a RecordInterface and a FluxRep object and
00338   // define how the FluxRep is represented in glish.  They return False if the
00339   // RecordInterface is malformed and append an error message to the supplied
00340   // string giving the reason.
00341   // <group>
00342   Bool fromRecord(String& errorMessage, const RecordInterface& record);
00343   Bool toRecord(String& errorMessage, RecordInterface& record) const;
00344   // </group>
00345 
00346   // Function which checks the internal data of this class for correct
00347   // dimensionality and consistent values. Returns True if everything is fine
00348   // otherwise returns False.
00349   Bool ok() const;
00350 
00351 private:
00352   Vector<typename NumericTraits<T>::ConjugateType> itsVal;
00353   ComponentType::Polarisation itsPol;
00354   Unit itsUnit;
00355   Vector<typename NumericTraits<T>::ConjugateType> itsErr;
00356   static const std::vector<Unit> _allowedUnits;
00357 
00358     // returns the conversion unit to which <src>unit</src> conforms.
00359     // If <src>unit</src> does not conform to a supported unit, an
00360     // exception is thrown.
00361     static Unit _getConversionUnit(const Unit& unit);
00362 
00363 };
00364 
00365 // <summary>A class that represents the Flux (reference semantics)</summary>
00366 
00367 // <use visibility=export>
00368 
00369 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00370 // </reviewed>
00371 
00372 // <prerequisite>
00373 //   <li> <linkto class="Vector">Vector</linkto>
00374 //   <li> <linkto class="Unit">Unit</linkto>
00375 //   <li> <linkto class="FluxRep">FluxRep</linkto>
00376 // </prerequisite>
00377 //
00378 // <etymology>
00379 // The Flux class is used to represent the flux of a component on the sky
00380 // </etymology>
00381 //
00382 // <synopsis>
00383 
00384 // This class is nearly identical to the <linkto
00385 // class="FluxRep">FluxRep</linkto> class and the reader is referred to the
00386 // documentation of this class for a general explanation of this class.  Most
00387 // of the functions in this class just call the functions in the FluxRep class.
00388 
00389 // There are two important differences between the Flux class and the FluxRep
00390 // class. 
00391 // <ul>
00392 // <li> This class uses reference semantics rather than copy semantics. This
00393 // aids in cutting down on the number of temporary objects that need to be
00394 // constructed. An example of this is illustrated in the examples section
00395 // below.
00396 // <li> This class contains functions for converting between different
00397 // polarisation representations. 
00398 // </ul>
00399 // The functions for converting between different polarisation representations
00400 // require that the supplied and returned vector have all four polarisations.
00401 // In the Stokes representation the order of the elements is I,Q,U,V, in the
00402 // linear representation it is XX,XY,YX,YY, and in the circular representation
00403 // it is RR,RL,LR,LL.
00404 //
00405 // These functions will correctly convert between Linear/Circular
00406 // representations and the Stokes representation even if the linear or circular
00407 // polarisation cannot represent a physically realisable polarisation (eg if
00408 // <src>XY != conj(YX)</src>). In these cases the stokes representation will
00409 // have an imaginary component and be complex. When converting the complex
00410 // Stokes representation to a real one the imaginary components are simply
00411 // discarded.
00412 // </synopsis>
00413 //
00414 // <example>
00415 // The function in this example calculates the total flux of all the
00416 // components in a list. It accumulates the flux in a Vector after ensuring
00417 // that the flux is in the appropriate units and Polarisation. It then returns
00418 // the sum as a Flux object. Because this class uses reference semantics the
00419 // returned object is passed by reference and hence this is a relatively cheap
00420 // operation.
00421 // <srcblock>
00422 // Flux<Double> totalFlux(ComponentList& list) {
00423 //   Vector<DComplex> sum(4, DComplex(0.0, 0.0));
00424 //   for (uInt i = 0; i < list.nelements(); i++) {
00425 //     list.component(i).flux().convertPol(ComponentType::STOKES);
00426 //     list.component(i).flux().convertUnit("Jy");
00427 //     sum += list.component(i).flux().value()
00428 //   }
00429 //   return Flux<Double>(value, ComponentType::STOKES);
00430 // }
00431 // </srcblock>
00432 // </example>
00433 //
00434 // <motivation>
00435 // This class was needed to contain the flux in the ComponentModels class. It
00436 // centralizes a lot of code that would otherwise be duplicated. The reference
00437 // semantics further simplify the interface that the component classes use.
00438 // </motivation>
00439 //
00440 // <thrown>
00441 //    <li> AipsError, When the Vectors are not of length 4 or when indices are
00442 //          greater than 4
00443 // </thrown>
00444 //
00445 // <todo asof="1998/03/11">
00446 //   <li> get this class reviewed.
00447 // </todo>
00448 
00449 template<class T> class Flux
00450 {
00451 public:
00452   // The default constructor makes an object with <src>I = 1, Q=U=V=0</src>,
00453   // a Stokes representation, and units of "Jy".
00454   Flux();
00455 
00456   // The default constructor makes an object with <src>I = 1, Q=U=V=0</src>,
00457   // a Stokes representation, and units of "Jy".
00458    Flux(T i);
00459 
00460   // This constructor makes an object where I,Q,U,V are all specified. It
00461   // assumes a Stokes representation, and units of "Jy".
00462   Flux(T i, T q, T u, T v);
00463 
00464   // This constructor makes an object where the flux values and polarisation
00465   // representation are specified. It assumes the units are "Jy".
00466   Flux(typename NumericTraits<T>::ConjugateType xx,
00467        typename NumericTraits<T>::ConjugateType xy,
00468        typename NumericTraits<T>::ConjugateType yx,
00469        typename NumericTraits<T>::ConjugateType yy, 
00470        ComponentType::Polarisation pol);
00471 
00472   // This constructor makes an object where I,Q,U,V are all specified by a
00473   // Vector that must have four elements. It assumes a Stokes representation,
00474   // and units of "Jy".
00475   Flux(const Vector<T>& flux);
00476 
00477   // This constructor makes an object where the flux values are all specified
00478   // by a Vector that must have four elements. The polarisation representation
00479   // must also be specified. It assumes the units are "Jy".
00480   Flux(const Vector<typename NumericTraits<T>::ConjugateType>& flux,
00481        ComponentType::Polarisation pol);
00482   
00483   // This constructor makes an object where the flux values are all specified
00484   // by a Quantum<Vector> that must have four elements.  The Quantum must have
00485   // units that are dimensionally equivalent to the "Jy" and these are the
00486   // units of the FluxRep object. A Stokes polarisation representation is
00487   // assumed.
00488   Flux(const Quantum<Vector<T> >& flux);
00489 
00490   // This constructor makes an object where the flux values are all specified
00491   // by a Quantum<Vector> that must have four elements. The Quantum must have
00492   // units that are dimensionally equivalent to the "Jy" and these are the
00493   // units of the FluxRep object. The polarisation representation must also be
00494   // specified.
00495   Flux(const Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& flux,
00496        ComponentType::Polarisation pol);
00497 
00498   // The copy constructor uses reference semantics.
00499   Flux(const Flux<T>& other);
00500 
00501   // The destructor is trivial
00502   ~Flux();
00503 
00504   // The assignment operator uses reference semantics.
00505   Flux<T>& operator=(const Flux<T>& other);
00506 
00507   // Return a distinct copy of this flux. As both the assignment operator
00508   // and the copy constructor use reference semantics this is the only way to
00509   // get a real copy.
00510   Flux<T> copy() const;
00511 
00512   // These two functions return the current units.
00513   // <group>
00514   const Unit& unit() const;
00515   void unit(Unit& unit) const;
00516   // </group>
00517 
00518   // This function sets the current unit. It does NOT convert the flux values
00519   // to correspond to the new unit. The new unit must be dimensionally
00520   // equivalent to the "Jy".
00521   void setUnit(const Unit& unit);
00522 
00523   // This function sets the current units to the supplied value and
00524   // additionally converts the internal flux values to the correspond to the
00525   // new unit.
00526   void convertUnit(const Unit& unit);
00527 
00528   // These two functions return the current polarisation representation.
00529   // <group>
00530   ComponentType::Polarisation pol() const;
00531   void pol(ComponentType::Polarisation& pol) const;
00532   // </group>
00533 
00534   // This function sets the current polarisation representation. It does NOT
00535   // convert the flux values.
00536   void setPol(ComponentType::Polarisation pol);
00537 
00538   // This function sets the current polarisation representation to the supplied
00539   // value and additionally converts the internal flux values to the correspond
00540   // to the new polarisation representation.
00541   void convertPol(ComponentType::Polarisation pol);
00542 
00543   // This function returns the flux values. The polarisation representation and
00544   // units are in whatever is current.
00545   const Vector<typename NumericTraits<T>::ConjugateType>& value() const;
00546 
00547   // This function returns the specified component of the flux values.
00548   // The polarisation representation and units are in whatever is current.
00549   const typename NumericTraits<T>::ConjugateType& value(uInt p) const;
00550 
00551   // This function returns the flux values after converting it to the Stokes
00552   // representation. The units of the returned Vector are the current units.
00553   void value(Vector<T>& value);
00554 
00555   // This function returns the flux values. The polarisation representation and
00556   // units are in whatever is current.
00557   void value(Vector<typename NumericTraits<T>::ConjugateType>& value) const;
00558 
00559   // This function returns the flux values after converting it to the Stokes
00560   // representation. The units of the returned Quantum are the current units of
00561   // the FluxRep object. The length of the Vector in the Quantum will be
00562   // resized to 4 elements if it is not already that length.
00563   void value(Quantum<Vector<T> >& value);
00564 
00565   // This function returns the flux values. The units of the returned Quantum
00566   // are the current units of the FluxRep object. Similarly the polarisation
00567   // representation of the returned Quantum is the current polarisation
00568   // representation. The length of the Vector in the Quantum will be resized to
00569   // 4 elements if it is not already that length.
00570   void value(Quantum
00571              <Vector<typename NumericTraits<T>::ConjugateType> >& value) const;
00572 
00573   // Return the flux value in a Quantum for the specified Stokes. Can convert
00574   // to Jy if requested.  
00575    Quantum<T> value (Stokes::StokesTypes stokes, Bool toJy=True);
00576 
00577   // This function sets the Flux values assuming the supplied value represents
00578   // the Stokes I flux in the current units. The other Stokes parameters are
00579   // set to zero.
00580   void setValue(T value);
00581 
00582   // This function sets the Flux values assuming the supplied values represent
00583   // the flux in the Stokes representation and is in the current units. The
00584   // Vector must have four elements.
00585   void setValue(const Vector<T>& value); 
00586 
00587   // This function sets the Flux values assuming the supplied values represent
00588   // the flux in the current representation and units. The Vector must have
00589   // four elements.
00590   void setValue(const Vector<typename NumericTraits<T>::ConjugateType>& value);
00591 
00592   // This function sets the flux values and units assuming the supplied values
00593   // represent the flux in the Stokes representation. The units of the Quantum
00594   // must be dimensionally equivalent to the "Jy" and the Vector must have four
00595   // elements.
00596   void setValue(const Quantum<Vector<T> >& value);
00597 
00598   // This function sets the flux values, units and polarisation assuming the
00599   // supplied values represent the flux in the specified representation. The
00600   // units of the Quantum must be dimensionally equivalent to the "Jy" and the
00601   // Vector must have four elements.
00602   void setValue(const
00603                 Quantum<Vector<typename NumericTraits<T>::ConjugateType> >& value,
00604                 ComponentType::Polarisation pol);
00605 
00606 // Set flux for given Stokes from Quantum. 
00607   void setValue (const Quantum<T>& value, Stokes::StokesTypes stokes);
00608 
00609   // Scale the Flux value by the specified amount. These functions multiply the
00610   // flux values irrespective of the current polarisation representation. If
00611   // only one scale factor is supplied then only the first component of the
00612   // flux is scaled.
00613   // <group>
00614   void scaleValue(const T& factor);
00615   void scaleValue(const T& factor0, const T& factor1,
00616                   const T& factor2, const T& factor3);
00617   void scaleValue(const typename NumericTraits<T>::ConjugateType& factor);
00618   void scaleValue(const typename NumericTraits<T>::ConjugateType& factor0,
00619                   const typename NumericTraits<T>::ConjugateType& factor1,
00620                   const typename NumericTraits<T>::ConjugateType& factor2,
00621                   const typename NumericTraits<T>::ConjugateType& factor3);
00622   // </group>
00623 
00624   // Set/get the errors in the flux
00625   // <group>
00626   void setErrors(const typename NumericTraits<T>::ConjugateType& error0,
00627                  const typename NumericTraits<T>::ConjugateType& error1,
00628                  const typename NumericTraits<T>::ConjugateType& error2,
00629                  const typename NumericTraits<T>::ConjugateType& error3);
00630 
00631   void setErrors(const Vector<typename NumericTraits<T>::ConjugateType>& errors);
00632 
00633   const Vector<typename NumericTraits<T>::ConjugateType>& errors() const;
00634   // </group>
00635 
00636   // This functions convert between a RecordInterface and a Flux object and
00637   // define how the Flux is represented in glish.  They return False if the
00638   // RecordInterface is malformed and append an error message to the supplied
00639   // string giving the reason.
00640   // <group>
00641   Bool fromRecord(String& errorMessage, const RecordInterface& record);
00642   Bool toRecord(String& errorMessage, RecordInterface& record) const;
00643   // </group>
00644 
00645   // Function which checks the internal data of this class for correct
00646   // dimensionality and consistent values. Returns True if everything is fine
00647   // otherwise returns False.
00648   Bool ok() const;
00649 
00650   // This function converts between a Vector in Stokes representation and one
00651   // in Circular representation.
00652   static void 
00653     stokesToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, 
00654                      const Vector<T>& in);
00655 
00656   // This function converts between a Vector in Stokes representation and one
00657   // in Circular representation. The imaginary components of the Stokes vector
00658   // are NOT ignored.
00659   static void 
00660     stokesToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, 
00661                      const
00662                      Vector<typename NumericTraits<T>::ConjugateType>& in);
00663 
00664   // This function converts between a Vector in Circular representation and one
00665   // in Stokes representation. The imaginary components of the Stokes vector
00666   // are discarded.
00667   static 
00668   void circularToStokes(Vector<T>& out,
00669                         const
00670                         Vector<typename NumericTraits<T>::ConjugateType>& in);
00671 
00672   // This function converts between a Vector in Circular representation and one
00673   // in Stokes representation. The imaginary components of the Stokes vector
00674   // are NOT ignored.
00675   static 
00676   void circularToStokes(Vector<typename NumericTraits<T>::ConjugateType>& out,
00677                         const
00678                         Vector<typename NumericTraits<T>::ConjugateType>& in);
00679 
00680   // This function converts between a Vector in Stokes representation and one
00681   // in Linear representation.
00682   static void
00683     stokesToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, 
00684                    const Vector<T>& in);
00685 
00686   // This function converts between a Vector in Stokes representation and one
00687   // in Linear representation. The imaginary components of the Stokes vector
00688   // are NOT ignored.
00689   static 
00690   void stokesToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, 
00691                       const
00692                       Vector<typename NumericTraits<T>::ConjugateType>& in);
00693 
00694   // This function converts between a Vector in Linear representation and one
00695   // in Stokes representation. The imaginary components of the Stokes vector
00696   // are discarded.
00697   static void
00698     linearToStokes(Vector<T>& out, 
00699                    const
00700                    Vector<typename NumericTraits<T>::ConjugateType>& in);
00701 
00702   // This function converts between a Vector in Linear representation and one
00703   // in Stokes representation. The imaginary components of the Stokes vector
00704   // are NOT ignored.
00705   static void
00706     linearToStokes(Vector<typename NumericTraits<T>::ConjugateType>& out, 
00707                    const Vector<typename NumericTraits<T>::ConjugateType>& in);
00708 
00709   // This function converts between a Vector in Linear representation and one
00710   // in Circular representation.
00711   static void
00712     linearToCircular(Vector<typename NumericTraits<T>::ConjugateType>& out, 
00713                      const
00714                      Vector<typename NumericTraits<T>::ConjugateType>& in);
00715 
00716   // This function converts between a Vector in Circular representation and one
00717   // in Linear representation.
00718   static void
00719     circularToLinear(Vector<typename NumericTraits<T>::ConjugateType>& out, 
00720                      const
00721                      Vector<typename NumericTraits<T>::ConjugateType>& in);
00722 
00723 private:
00724   CountedPtr<FluxRep<T> > itsFluxPtr;
00725 };
00726 
00727 
00728 } //# NAMESPACE CASA - END
00729 
00730 #ifndef CASACORE_NO_AUTO_TEMPLATES
00731 #include <components/ComponentModels/Flux.tcc>
00732 #endif //# CASACORE_NO_AUTO_TEMPLATES
00733 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1