LCOV - code coverage report
Current view: top level - synthesis/MeasurementEquations - VPManager.h (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 2 12 16.7 %
Date: 2023-11-06 10:06:49 Functions: 1 3 33.3 %

          Line data    Source code
       1             : //# VPManager functionality sits here; 
       2             : //# Copyright (C) 1996-2011
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //# Copyright by ESO (in the framework of the ALMA collaboration)
       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 addressed as follows:
      21             : //#        Internet email: aips2-request@nrao.edu.
      22             : //#        Postal address: AIPS++ Project Office
      23             : //#                        National Radio Astronomy Observatory
      24             : //#                        520 Edgemont Road
      25             : //#
      26             : //# $Id$
      27             : 
      28             : #ifndef SYNTHESIS_VPMANAGER_H
      29             : #define SYNTHESIS_VPMANAGER_H
      30             : 
      31             : #include <map>
      32             : #include <mutex>
      33             : #include <synthesis/MeasurementEquations/AntennaResponses.h>
      34             : 
      35             : namespace casacore{
      36             : 
      37             :   class Record;
      38             : }
      39             : 
      40             : namespace casa {
      41             :   //Forward declarations
      42             : 
      43             :   class VPManager
      44             :     {
      45             :       
      46             :     public: 
      47             :       // no need of enums here use the one from PBMathInterface
      48             :       //      enum Type{NONE, COMMONPB, AIRY, GAUSS, POLY, IPOLY, COSPOLY,
      49             :       //                NUMERIC, IMAGE, ZERNIKE, MAX=ZERNIKE};
      50             : 
      51             :       // this is a SINGLETON class
      52             :       static VPManager* Instance();
      53             : 
      54             :       void reset(casacore::Bool verbose=false);
      55             : 
      56             :       casacore::Bool saveastable(const casacore::String& tablename);
      57             : 
      58             :       casacore::Bool loadfromtable(const casacore::String& tablename);
      59             : 
      60             :       casacore::Bool summarizevps(const casacore::Bool verbose);
      61             : 
      62             : 
      63             :       casacore::Bool setcannedpb(const casacore::String& tel, 
      64             :                        const casacore::String& other, 
      65             :                        const casacore::Bool dopb,
      66             :                        const casacore::String& commonpb,
      67             :                        const casacore::Bool dosquint, 
      68             :                        const casacore::Quantity& paincrement, 
      69             :                        const casacore::Bool usesymmetricbeam,
      70             :                        casacore::Record& rec);
      71             : 
      72             :       casacore::Bool setpbairy(const casacore::String& telescope, const casacore::String& othertelescope, 
      73             :                      const casacore::Bool dopb, const casacore::Quantity& dishdiam, 
      74             :                      const casacore::Quantity& blockagediam, 
      75             :                      const casacore::Quantity& maxrad, 
      76             :                      const casacore::Quantity& reffreq, 
      77             :                      casacore::MDirection& squintdir, 
      78             :                      const casacore::Quantity& squintreffreq, const casacore::Bool dosquint, 
      79             :                      const casacore::Quantity& paincrement, 
      80             :                      const casacore::Bool usesymmetricbeam,
      81             :                      casacore::Record& rec);
      82             : 
      83             :       casacore::Bool setpbcospoly(const casacore::String& telescope, const casacore::String& othertelescope,
      84             :                         const casacore::Bool dopb, const casacore::Vector<casacore::Double>& coeff,
      85             :                         const casacore::Vector<casacore::Double>& scale,
      86             :                         const casacore::Quantity& maxrad,
      87             :                         const casacore::Quantity& reffreq,
      88             :                         const casacore::String& isthispb,
      89             :                         casacore::MDirection& squintdir,
      90             :                         const casacore::Quantity& squintreffreq, const casacore::Bool dosquint,
      91             :                         const casacore::Quantity& paincrement,
      92             :                         const casacore::Bool usesymmetricbeam,
      93             :                         casacore::Record& rec);
      94             : 
      95             :       casacore::Bool setpbgauss(const casacore::String& tel, const casacore::String& other, const casacore::Bool dopb,
      96             :                       const casacore::Quantity& halfwidth, const casacore::Quantity maxrad, 
      97             :                       const casacore::Quantity& reffreq, const casacore::String& isthispb, 
      98             :                       casacore::MDirection& squintdir, const casacore::Quantity& squintreffreq,
      99             :                       const casacore::Bool dosquint, const casacore::Quantity& paincrement, 
     100             :                       const casacore::Bool usesymmetricbeam, casacore::Record& rec);
     101             : 
     102             :       
     103             :      
     104             : 
     105             :       casacore::Bool setpbinvpoly(const casacore::String& telescope, const casacore::String& othertelescope,
     106             :                         const casacore::Bool dopb, const casacore::Vector<casacore::Double>& coeff,
     107             :                         const casacore::Quantity& maxrad,
     108             :                         const casacore::Quantity& reffreq,
     109             :                         const casacore::String& isthispb,
     110             :                         casacore::MDirection& squintdir,
     111             :                         const casacore::Quantity& squintreffreq, const casacore::Bool dosquint,
     112             :                         const casacore::Quantity& paincrement,
     113             :                         const casacore::Bool usesymmetricbeam,
     114             :                         casacore::Record& rec);
     115             : 
     116             :       casacore::Bool setpbinvpoly(const casacore::String& telescope, const casacore::String& othertelescope,
     117             :                         const casacore::Bool dopb, const casacore::Matrix<casacore::Double>& coeff,
     118             :                         const casacore::Vector<casacore::Double>& freqs,
     119             :                         const casacore::Quantity& maxrad,
     120             :                         const casacore::Quantity& reffreq,
     121             :                         const casacore::String& isthispb,
     122             :                         casacore::MDirection& squintdir,
     123             :                         const casacore::Quantity& squintreffreq, const casacore::Bool dosquint,
     124             :                         const casacore::Quantity& paincrement,
     125             :                         const casacore::Bool usesymmetricbeam,
     126             :                         casacore::Record& rec);
     127             : 
     128             :       casacore::Bool setpbnumeric(const casacore::String& telescope, const casacore::String& othertelescope,
     129             :                         const casacore::Bool dopb, const casacore::Vector<casacore::Double>& vect,
     130             :                         const casacore::Quantity& maxrad,
     131             :                         const casacore::Quantity& reffreq,
     132             :                         const casacore::String& isthispb,
     133             :                         casacore::MDirection& squintdir,
     134             :                         const casacore::Quantity& squintreffreq, const casacore::Bool dosquint,
     135             :                         const casacore::Quantity& paincrement,
     136             :                         const casacore::Bool usesymmetricbeam,
     137             :                         casacore::Record &rec);
     138             : 
     139             :       ///antnames => Antenna names for which this PB image applies. "*" is for all 
     140             :       casacore::Bool setpbimage(const casacore::String& telescope, const casacore::String& othertelescope, 
     141             :                       const casacore::Bool dopb, const casacore::String& realimage, 
     142             :                       const casacore::String& imagimage, const casacore::String& compleximage, const casacore::Vector<casacore::String>& antnames,  casacore::Record& rec);
     143             :       ///////Returns the image beam that the vpmananger has in state
     144             :       ////// antnames contains the antenna names for which each element of the image beams apply
     145             :       casacore::Bool imagepbinfo(casacore::Vector<casacore::Vector<casacore::String> >& antnames, casacore::Vector<casacore::Record>& imagebeams);
     146             : 
     147             :       casacore::Bool setpbpoly(const casacore::String& telescope, const casacore::String& othertelescope,
     148             :                      const casacore::Bool dopb, const casacore::Vector<casacore::Double>& coeff,
     149             :                      const casacore::Quantity& maxrad,
     150             :                      const casacore::Quantity& reffreq,
     151             :                      const casacore::String& isthispb,
     152             :                      casacore::MDirection& squintdir,
     153             :                      const casacore::Quantity& squintreffreq, const casacore::Bool dosquint,
     154             :                      const casacore::Quantity& paincrement,
     155             :                      const casacore::Bool usesymmetricbeam,
     156             :                      casacore::Record &rec);
     157             :       
     158             : 
     159             :       casacore::Bool setpbantresptable(const casacore::String& telescope, const casacore::String& othertelescope,
     160             :                              const casacore::Bool dopb, const casacore::String& tablepath);
     161             :                             // no record filled, need to access via getvp()
     162             : 
     163             :       // set the default voltage pattern for the given telescope
     164             :       casacore::Bool setuserdefault(const casacore::Int vplistfield,
     165             :                           const casacore::String& telescope,
     166             :                           const casacore::String& antennatype="");
     167             : 
     168             :       casacore::Bool getuserdefault(casacore::Int& vplistfield,
     169             :                           const casacore::String& telescope,
     170             :                           const casacore::String& antennatype="");
     171             : 
     172             :       casacore::Bool getanttypes(casacore::Vector<casacore::String>& anttypes,
     173             :                        const casacore::String& telescope,
     174             :                        const casacore::MEpoch& obstime,
     175             :                        const casacore::MFrequency& freq, 
     176             :                        const casacore::MDirection& obsdirection); // default: Zenith
     177             :                               
     178             :       // return number of voltage patterns satisfying the given constraints
     179             :       casacore::Int numvps(const casacore::String& telescope,
     180             :                  const casacore::MEpoch& obstime,
     181             :                  const casacore::MFrequency& freq, 
     182             :                  const casacore::MDirection& obsdirection=casacore::MDirection(casacore::Quantity( 0., "deg"), // default is the Zenith
     183             :                                                            casacore::Quantity(90., "deg"), 
     184             :                                                            casacore::MDirection::AZEL)
     185             :                  ); 
     186             : 
     187             : 
     188             :       // get the voltage pattern satisfying the given constraints
     189             :       casacore::Bool getvp(casacore::Record &rec,
     190             :                  const casacore::String& telescope,
     191             :                  const casacore::MEpoch& obstime,
     192             :                  const casacore::MFrequency& freq, 
     193             :                  const casacore::String& antennatype="", 
     194             :                  const casacore::MDirection& obsdirection=casacore::MDirection(casacore::Quantity( 0., "deg"), // default is the Zenith
     195             :                                                            casacore::Quantity(90., "deg"), 
     196             :                                                            casacore::MDirection::AZEL)
     197             :                  ); 
     198             : 
     199             :       // get a general voltage pattern for the given telescope and ant type if available
     200             :       casacore::Bool getvp(casacore::Record &rec,
     201             :                  const casacore::String& telescope,
     202             :                  const casacore::String& antennatype=""
     203             :                  ); 
     204             : 
     205             :       // get a set of all necessary beams and their properties for a given antenna list
     206             :       casacore::Bool getvps(casacore::Vector<casacore::Record> & unique_out_rec_list, // the list of unique beam records
     207             :                   casacore::Vector<casacore::Vector<casacore::uInt> >& beam_index, // indices to the above vectors in sync with AntennaNames
     208             :                   const casacore::String& telescope,
     209             :                   const casacore::Vector<casacore::MEpoch>& inpTimeRange, // only elements 0 and 1 are used; if 1 is not present it is assumed to be inf
     210             :                   const casacore::Vector<casacore::MFrequency>& inpFreqRange, // must contain at least one element; beams will be provided for each element 
     211             :                   const casacore::Vector<casacore::String>& AntennaNames, // characters 0 and 1 are used for ALMA to determine the antenna type
     212             :                   const casacore::MDirection& obsdirection=casacore::MDirection(casacore::Quantity( 0., "deg"), // default is the Zenith
     213             :                                                             casacore::Quantity(90., "deg"), 
     214             :                                                             casacore::MDirection::AZEL)
     215             :                   );
     216             : 
     217             :       casacore::Bool vpRecIsIdentical(const casacore::Record& rec0, const casacore::Record& rec1);
     218             : 
     219             :     protected:
     220             :       VPManager(casacore::Bool verbose=false);
     221             : 
     222             :     private:
     223             :       static VPManager* instance_p;
     224             : 
     225             :       static std::recursive_mutex mutex_p;
     226             : 
     227             :       casacore::Record vplist_p; 
     228             :       std::map<casacore::String, casacore::Int > vplistdefaults_p; 
     229             :       AntennaResponses aR_p; 
     230             : 
     231         648 :       inline casacore::String antennaDescription(const casacore::String& telescope,
     232             :                                        const casacore::String& antennatype){
     233         648 :         if(antennatype.empty()) return telescope;
     234           0 :         return telescope + " " + antennatype;
     235             :       };
     236             : 
     237           0 :       inline casacore::String telFromAntDesc(const casacore::String& antDesc){
     238           0 :         casacore::String tempstr = antDesc;
     239           0 :         if(tempstr.contains(" ")) return tempstr.before(" ");
     240           0 :         return tempstr;
     241             :       };
     242             : 
     243           0 :       inline casacore::String antTypeFromAntDesc(const casacore::String& antDesc){
     244           0 :         casacore::String tempstr = antDesc;
     245           0 :         if(tempstr.contains(" ")) return tempstr.after(" ");
     246           0 :         tempstr = "";
     247           0 :         return tempstr;
     248             :       };
     249             : 
     250             :     };
     251             : 
     252             : } //# NAMESPACE CASA - END
     253             : #endif

Generated by: LCOV version 1.16