FluxCalcVQS.h

Go to the documentation of this file.
00001 //# FluxCalcVQS.h: Base class for flux standard calculations taking into account for 
00002 //# time variability 
00003 //# Copyright (C) 2013
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be adressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //#
00028 #ifndef COMPONENTS_FLUXCALCVQS_H
00029 #define COMPONENTS_FLUXCALCVQS_H
00030 
00031 #include <components/ComponentModels/FluxStandard.h>
00032 #include <components/ComponentModels/FluxStdSrcs.h>
00033 #include <casa/BasicSL/String.h>
00034 #include <casa/OS/Path.h>
00035 #include <measures/Measures/MDirection.h>
00036 #include <tables/Tables/Table.h>
00037 
00038 //# Handy for passing anonymous arrays to functions.
00039 #include <scimath/Mathematics/RigidVector.h>
00040 
00041 #include <scimath/Functionals/Interpolate1D.h>
00042 #include <map>
00043 
00044 
00045 namespace casa { //# NAMESPACE CASA - BEGIN
00046 
00047 //class Flux;
00048 class MFrequency;
00049 //class Vector;
00050 
00051 // <summary> 
00052 // FluxCalcVQS: Base class for flux standard calculations taking account for  
00053 // time variability of the sources. 
00054 // </summary>
00055 
00056 // <use visibility=export>
00057 
00058 // <reviewed reviewer="" date="" tests="" demos="">
00059 
00060 // <prerequisite>
00061 // <li><linkto class="FluxStandard">FluxStandard</linkto> module
00062 // </prerequisite>
00063 //
00064 // <etymology>
00065 // From "flux density", "calculator", "variable", and "quasistatic".
00066 // </etymology>
00067 //
00068 // <synopsis>
00069 // The FluxCalcVQS class provides an interface and a small amount of machinery
00070 // for computing total flux densities of calibrators which may be variable in time.
00071 // For the source with significant enough time variability, inteploation in time
00072 // with choice of nearest neighbour, linear, cubic, or cubic spline, is performed. 
00073 // See FluxStdsQS for actual definitions of the standards. The polynomial coefficents
00074 // for the standard include time-variable sources are assumed to be stored in an external
00075 // table.
00076 // </synopsis>
00077 //
00078 // <example>
00079 // <srcblock>
00080 // </srcblock>
00081 // </example>
00082 //
00083 // <motivation>
00084 // Provide a base interface for calculating standard flux
00085 // densities, and include any common functions.
00086 // </motivation>
00087 
00088 class FluxCalcVQS: public FluxStdSrcs
00089 {
00090 public:
00091 
00092   typedef FluxCalcVQS FCVQS;
00093   typedef RigidVector<String, 4> RVS4;
00094   typedef RigidVector<String, 5> RVS5;
00095 
00096   // Source identifiers.
00097   /****
00098   enum Source {
00099     THREEC286 = 0,      // 3C286
00100     THREEC48,
00101     THREEC147,
00102     THREEC138,
00103     NINETEEN34M638,   // 1934-638
00104     THREEC295,
00105     THREEC196,
00106     THREEC123,
00107     // The number of standards in this enumerator.
00108     NUMBER_SOURCES,
00109     UNKNOWN_SOURCE = NUMBER_SOURCES
00110   };
00111   ***/
00112   virtual ~FluxCalcVQS();
00113 
00114   virtual Bool operator()(Flux<Double>& value, Flux<Double>& error,
00115                           const MFrequency& mfreq, const Bool updatecoeffs) = 0;
00116   Bool operator()(Vector<Flux<Double> >& values,
00117                   Vector<Flux<Double> >& errors,
00118                   const Vector<MFrequency>& mfreqs);
00119   
00120   //for time variable case with interpolation method 
00121   Bool operator()(Vector<Flux<Double> >& values,
00122                   Vector<Flux<Double> >& errors,
00123                   const Vector<MFrequency>& mfreqs, 
00124                   const MEpoch& mtime,
00125                   const String& interpmethod);
00126 
00127   // If a FS::Source enum matches srcName, returns the enum.
00128   // Otherwise, FCQS::UNKNOWN_SOURCE.
00129   //FCQS::Source srcNameToEnum(const String& srcName) const;
00130 
00131   // Sets srcEnum_p = srcNameToEnum(sourceName), and returns
00132   // srcEnum_p != FCQS::UNKNOWN_SOURCE
00133   virtual Bool setSource(const String& sourceName, const MDirection& sourceDir);
00134 
00135   FCVQS::Source getSrcEnum();
00136 
00137   //MDirection getDirection() {return directions_p[srcEnum_p];}
00138   MDirection getDirection() {return FluxStdSrcs::getDirection(srcEnum_p);}
00139 
00140   // Read the coefficient data table
00141   void readQSCoeffsTable(const Path& fileName);
00142   // Interpolate for time variable source
00143   void interpolate(const String& interpmethod);
00144   // Set the coefficients from one epoch where i is row number in the original data table  
00145   void setSourceCoeffsfromVec(uInt& i);
00146   // Get currently set coefficients
00147   RigidVector<Vector<Float>,2 >  getCurrentCoeffs() {return tvcoeffs_p;}
00148 
00149   //keep track if it is non-time var source for Perley-Butler2013
00150   void isTimeVar(Bool istimevar); 
00151 
00152 protected:
00153   FluxCalcVQS();   // Initializes names_p.
00154 
00155 private:
00156   FCVQS::Source srcEnum_p;       // The source identifier.
00157 
00158   // A map from an FS::Source enum to a list of recognized names for it.
00159   //std::map<FCQS::Source, Vector<String> > names_p;
00160 
00161   // A map from an FS::Source enum to its J2000 direction.
00162   //std::map<FCQS::Source, MDirection> directions_p;
00163 
00164   // get interpolate method enum
00165   Interpolate1D<Double,Float>::Method getInterpMethod_p(const String& interpmethod);
00166 
00167   //convert epochs in year.frac to mjds
00168   void convertYearFracToMjd(const Vector<Double>& yearfrac, Vector<Double>& mjds);
00169 
00170   Vector<Double> epochvec_p;
00171   Matrix<Float> coeffsmat_p;
00172   Matrix<Float> coefferrsmat_p;
00173   Vector<Float> fluxes_p;
00174   //Vector<Float> tvcoeffs_p;
00175   RigidVector<Vector<Float>,2> tvcoeffs_p;
00176   Table Table_p;
00177   Bool istimevar_p;
00178   //virtual Bool setCoeffs() = 0;
00179   //
00180 };
00181 
00182 } //# NAMESPACE CASA - END
00183 
00184 #endif /* COMPONENTS_FLUXCALCVQS_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1