LCOV - code coverage report
Current view: top level - components/ComponentModels - FluxCalcVQS.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 3 3 100.0 %
Date: 2024-11-06 17:42:47 Functions: 3 3 100.0 %

          Line data    Source code
       1             : //# FluxCalcVQS.h: Base class for flux standard calculations taking into account for 
       2             : //# time variability 
       3             : //# Copyright (C) 2013
       4             : //# Associated Universities, Inc. Washington DC, USA.
       5             : //#
       6             : //# This library is free software; you can redistribute it and/or modify it
       7             : //# under the terms of the GNU Library General Public License as published by
       8             : //# the Free Software Foundation; either version 2 of the License, or (at your
       9             : //# option) any later version.
      10             : //#
      11             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      12             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      14             : //# License for more details.
      15             : //#
      16             : //# You should have received a copy of the GNU Library General Public License
      17             : //# along with this library; if not, write to the Free Software Foundation,
      18             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      19             : //#
      20             : //# Correspondence concerning AIPS++ should be adressed as follows:
      21             : //#        Internet email: casa-feedback@nrao.edu.
      22             : //#        Postal address: AIPS++ Project Office
      23             : //#                        National Radio Astronomy Observatory
      24             : //#                        520 Edgemont Road
      25             : //#                        Charlottesville, VA 22903-2475 USA
      26             : //#
      27             : //#
      28             : #ifndef COMPONENTS_FLUXCALCVQS_H
      29             : #define COMPONENTS_FLUXCALCVQS_H
      30             : 
      31             : #include <components/ComponentModels/FluxStandard.h>
      32             : #include <components/ComponentModels/FluxStdSrcs.h>
      33             : #include <casacore/casa/BasicSL/String.h>
      34             : #include <casacore/casa/OS/Path.h>
      35             : #include <casacore/measures/Measures/MDirection.h>
      36             : #include <casacore/tables/Tables/Table.h>
      37             : 
      38             : //# Handy for passing anonymous arrays to functions.
      39             : #include <casacore/scimath/Mathematics/RigidVector.h>
      40             : 
      41             : #include <casacore/scimath/Functionals/Interpolate1D.h>
      42             : #include <map>
      43             : 
      44             : 
      45             : namespace casacore{
      46             : 
      47             : class MFrequency;
      48             : //class Vector;
      49             : }
      50             : 
      51             : namespace casa { //# NAMESPACE CASA - BEGIN
      52             : 
      53             : //class Flux;
      54             : 
      55             : // <summary> 
      56             : // FluxCalcVQS: Base class for flux standard calculations taking account for  
      57             : // time variability of the sources. 
      58             : // </summary>
      59             : 
      60             : // <use visibility=export>
      61             : 
      62             : // <reviewed reviewer="" date="" tests="" demos="">
      63             : 
      64             : // <prerequisite>
      65             : // <li><linkto class="FluxStandard">FluxStandard</linkto> module
      66             : // </prerequisite>
      67             : //
      68             : // <etymology>
      69             : // From "flux density", "calculator", "variable", and "quasistatic".
      70             : // </etymology>
      71             : //
      72             : // <synopsis>
      73             : // The FluxCalcVQS class provides an interface and a small amount of machinery
      74             : // for computing total flux densities of calibrators which may be variable in time.
      75             : // For the source with significant enough time variability, inteploation in time
      76             : // with choice of nearest neighbour, linear, cubic, or cubic spline, is performed. 
      77             : // See FluxStdsQS for actual definitions of the standards. The polynomial coefficents
      78             : // for the standard include time-variable sources are assumed to be stored in an external
      79             : // table.
      80             : // </synopsis>
      81             : //
      82             : // <example>
      83             : // <srcblock>
      84             : // </srcblock>
      85             : // </example>
      86             : //
      87             : // <motivation>
      88             : // Provide a base interface for calculating standard flux
      89             : // densities, and include any common functions.
      90             : // </motivation>
      91             : 
      92             : class FluxCalcVQS: public FluxStdSrcs
      93             : {
      94             : public:
      95             : 
      96             :   typedef FluxCalcVQS FCVQS;
      97             :   typedef casacore::RigidVector<casacore::String, 4> RVS4;
      98             :   typedef casacore::RigidVector<casacore::String, 5> RVS5;
      99             : 
     100             :   // Source identifiers.
     101             :   /****
     102             :   enum Source {
     103             :     THREEC286 = 0,      // 3C286
     104             :     THREEC48,
     105             :     THREEC147,
     106             :     THREEC138,
     107             :     NINETEEN34M638,   // 1934-638
     108             :     THREEC295,
     109             :     THREEC196,
     110             :     THREEC123,
     111             :     // The number of standards in this enumerator.
     112             :     NUMBER_SOURCES,
     113             :     UNKNOWN_SOURCE = NUMBER_SOURCES
     114             :   };
     115             :   ***/
     116             :   virtual ~FluxCalcVQS();
     117             : 
     118             :   virtual casacore::Bool operator()(Flux<casacore::Double>& value, Flux<casacore::Double>& error,
     119             :                           const casacore::MFrequency& mfreq, const casacore::Bool updatecoeffs) = 0;
     120             :   casacore::Bool operator()(casacore::Vector<Flux<casacore::Double> >& values,
     121             :                   casacore::Vector<Flux<casacore::Double> >& errors,
     122             :                   const casacore::Vector<casacore::MFrequency>& mfreqs);
     123             :   
     124             :   //for time variable case with interpolation method 
     125             :   casacore::Bool operator()(casacore::Vector<Flux<casacore::Double> >& values,
     126             :                   casacore::Vector<Flux<casacore::Double> >& errors,
     127             :                   const casacore::Vector<casacore::MFrequency>& mfreqs, 
     128             :                   const casacore::MEpoch& mtime,
     129             :                   const casacore::String& interpmethod);
     130             : 
     131             :   // If a FS::Source enum matches srcName, returns the enum.
     132             :   // Otherwise, FCQS::UNKNOWN_SOURCE.
     133             :   //FCQS::Source srcNameToEnum(const casacore::String& srcName) const;
     134             : 
     135             :   // Sets srcEnum_p = srcNameToEnum(sourceName), and returns
     136             :   // srcEnum_p != FCQS::UNKNOWN_SOURCE
     137             :   virtual casacore::Bool setSource(const casacore::String& sourceName, const casacore::MDirection& sourceDir);
     138             : 
     139             :   FCVQS::Source getSrcEnum();
     140             : 
     141             :   //casacore::MDirection getDirection() {return directions_p[srcEnum_p];}
     142         103 :   casacore::MDirection getDirection() {return FluxStdSrcs::getDirection(srcEnum_p);}
     143             : 
     144             :   // Read the coefficient data table
     145             :   void readQSCoeffsTable(const casacore::Path& fileName);
     146             :   // Interpolate for time variable source
     147             :   void interpolate(const casacore::String& interpmethod);
     148             :   // Set the coefficients from one epoch where i is row number in the original data table  
     149             :   void setSourceCoeffsfromVec(casacore::uInt& i);
     150             :   // Get currently set coefficients
     151       12094 :   casacore::RigidVector<casacore::Vector<casacore::Float>,2 >  getCurrentCoeffs() {return tvcoeffs_p;}
     152             :   //casacore::RigidVector<casacore::Double,2 >  getValidFreqRange() {return validfreqrange_p;}
     153       12104 :   casacore::Vector<casacore::MFrequency>  getValidFreqRange() {return validfreqrange_p;}
     154             : 
     155             :   //keep track if it is non-time var source for Perley-Butler2013
     156             :   void isTimeVar(casacore::Bool istimevar); 
     157             : 
     158             : protected:
     159             :   FluxCalcVQS();   // Initializes names_p.
     160             : 
     161             : private:
     162             :   FCVQS::Source srcEnum_p;       // The source identifier.
     163             : 
     164             :   // A map from an FS::Source enum to a list of recognized names for it.
     165             :   //std::map<FCQS::Source, casacore::Vector<casacore::String> > names_p;
     166             : 
     167             :   // A map from an FS::Source enum to its J2000 direction.
     168             :   //std::map<FCQS::Source, casacore::MDirection> directions_p;
     169             : 
     170             :   // get interpolate method enum
     171             :   casacore::Interpolate1D<casacore::Double,casacore::Float>::Method getInterpMethod_p(const casacore::String& interpmethod);
     172             : 
     173             :   //convert epochs in year.frac to mjds
     174             :   void convertYearFracToMjd(const casacore::Vector<casacore::Double>& yearfrac, casacore::Vector<casacore::Double>& mjds);
     175             : 
     176             :   casacore::Vector<casacore::Double> epochvec_p;
     177             :   casacore::Matrix<casacore::Float> coeffsmat_p;
     178             :   casacore::Matrix<casacore::Float> coefferrsmat_p;
     179             :   casacore::Vector<casacore::Float> fluxes_p;
     180             :   //casacore::Vector<casacore::Float> tvcoeffs_p;
     181             :   casacore::RigidVector<casacore::Vector<casacore::Float>,2> tvcoeffs_p;
     182             :   casacore::Vector<casacore::MFrequency> validfreqrange_p;
     183             :   casacore::Table Table_p;
     184             :   casacore::Bool istimevar_p;
     185             :   //virtual casacore::Bool setCoeffs() = 0;
     186             :   //
     187             : };
     188             : 
     189             : } //# NAMESPACE CASA - END
     190             : 
     191             : #endif /* COMPONENTS_FLUXCALCVQS_H */

Generated by: LCOV version 1.16