casa
$Rev:20696$
|
00001 //# VPManager functionality sits here; 00002 //# Copyright (C) 1996-2011 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# Copyright by ESO (in the framework of the ALMA collaboration) 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 addressed 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 //# 00026 //# $Id$ 00027 00028 #ifndef SYNTHESIS_VPMANAGER_H 00029 #define SYNTHESIS_VPMANAGER_H 00030 00031 #include <imageanalysis/ImageAnalysis/AntennaResponses.h> 00032 00033 namespace casa { 00034 //Forward declarations 00035 class Record; 00036 00037 class VPManager 00038 { 00039 00040 public: 00041 // no need of enums here use the one from PBMathInterface 00042 // enum Type{NONE, COMMONPB, AIRY, GAUSS, POLY, IPOLY, COSPOLY, 00043 // NUMERIC, IMAGE, ZERNIKE, MAX=ZERNIKE}; 00044 00045 // this is a SINGLETON class 00046 static VPManager* Instance(); 00047 00048 void reset(Bool verbose=False); 00049 00050 Bool saveastable(const String& tablename); 00051 00052 Bool loadfromtable(const String& tablename); 00053 00054 Bool summarizevps(const Bool verbose); 00055 00056 00057 Bool setcannedpb(const String& tel, 00058 const String& other, 00059 const Bool dopb, 00060 const String& commonpb, 00061 const Bool dosquint, 00062 const Quantity& paincrement, 00063 const Bool usesymmetricbeam, 00064 Record& rec); 00065 00066 Bool setpbairy(const String& telescope, const String& othertelescope, 00067 const Bool dopb, const Quantity& dishdiam, 00068 const Quantity& blockagediam, 00069 const Quantity& maxrad, 00070 const Quantity& reffreq, 00071 MDirection& squintdir, 00072 const Quantity& squintreffreq, const Bool dosquint, 00073 const Quantity& paincrement, 00074 const Bool usesymmetricbeam, 00075 Record& rec); 00076 00077 Bool setpbcospoly(const String& telescope, const String& othertelescope, 00078 const Bool dopb, const Vector<Double>& coeff, 00079 const Vector<Double>& scale, 00080 const Quantity& maxrad, 00081 const Quantity& reffreq, 00082 const String& isthispb, 00083 MDirection& squintdir, 00084 const Quantity& squintreffreq, const Bool dosquint, 00085 const Quantity& paincrement, 00086 const Bool usesymmetricbeam, 00087 Record& rec); 00088 00089 Bool setpbgauss(const String& tel, const String& other, const Bool dopb, 00090 const Quantity& halfwidth, const Quantity maxrad, 00091 const Quantity& reffreq, const String& isthispb, 00092 MDirection& squintdir, const Quantity& squintreffreq, 00093 const Bool dosquint, const Quantity& paincrement, 00094 const Bool usesymmetricbeam, Record& rec); 00095 00096 Bool setpbinvpoly(const String& telescope, const String& othertelescope, 00097 const Bool dopb, const Vector<Double>& coeff, 00098 const Quantity& maxrad, 00099 const Quantity& reffreq, 00100 const String& isthispb, 00101 MDirection& squintdir, 00102 const Quantity& squintreffreq, const Bool dosquint, 00103 const Quantity& paincrement, 00104 const Bool usesymmetricbeam, 00105 Record& rec); 00106 00107 Bool setpbnumeric(const String& telescope, const String& othertelescope, 00108 const Bool dopb, const Vector<Double>& vect, 00109 const Quantity& maxrad, 00110 const Quantity& reffreq, 00111 const String& isthispb, 00112 MDirection& squintdir, 00113 const Quantity& squintreffreq, const Bool dosquint, 00114 const Quantity& paincrement, 00115 const Bool usesymmetricbeam, 00116 Record &rec); 00117 00118 Bool setpbimage(const String& telescope, const String& othertelescope, 00119 const Bool dopb, const String& realimage, 00120 const String& imagimage, const String& compleximage, Record& rec); 00121 00122 Bool setpbpoly(const String& telescope, const String& othertelescope, 00123 const Bool dopb, const Vector<Double>& coeff, 00124 const Quantity& maxrad, 00125 const Quantity& reffreq, 00126 const String& isthispb, 00127 MDirection& squintdir, 00128 const Quantity& squintreffreq, const Bool dosquint, 00129 const Quantity& paincrement, 00130 const Bool usesymmetricbeam, 00131 Record &rec); 00132 00133 00134 Bool setpbantresptable(const String& telescope, const String& othertelescope, 00135 const Bool dopb, const String& tablepath); 00136 // no record filled, need to access via getvp() 00137 00138 // set the default voltage pattern for the given telescope 00139 Bool setuserdefault(const Int vplistfield, 00140 const String& telescope, 00141 const String& antennatype=""); 00142 00143 Bool getuserdefault(Int& vplistfield, 00144 const String& telescope, 00145 const String& antennatype=""); 00146 00147 Bool getanttypes(Vector<String>& anttypes, 00148 const String& telescope, 00149 const MEpoch& obstime, 00150 const MFrequency& freq, 00151 const MDirection& obsdirection); // default: Zenith 00152 00153 // return number of voltage patterns satisfying the given constraints 00154 Int numvps(const String& telescope, 00155 const MEpoch& obstime, 00156 const MFrequency& freq, 00157 const MDirection& obsdirection=MDirection(Quantity( 0., "deg"), // default is the Zenith 00158 Quantity(90., "deg"), 00159 MDirection::AZEL) 00160 ); 00161 00162 00163 // get the voltage pattern satisfying the given constraints 00164 Bool getvp(Record &rec, 00165 const String& telescope, 00166 const MEpoch& obstime, 00167 const MFrequency& freq, 00168 const String& antennatype="", 00169 const MDirection& obsdirection=MDirection(Quantity( 0., "deg"), // default is the Zenith 00170 Quantity(90., "deg"), 00171 MDirection::AZEL) 00172 ); 00173 00174 // get a general voltage pattern for the given telescope and ant type if available 00175 Bool getvp(Record &rec, 00176 const String& telescope, 00177 const String& antennatype="" 00178 ); 00179 00180 protected: 00181 VPManager(Bool verbose=False); 00182 00183 private: 00184 static VPManager* instance_p; 00185 00186 static Mutex mutex_p; 00187 00188 Record vplist_p; 00189 SimpleOrderedMap<String, Int > vplistdefaults_p; 00190 AntennaResponses aR_p; 00191 00192 inline String antennaDescription(const String& telescope, 00193 const String& antennatype){ 00194 if(antennatype.empty()) return telescope; 00195 return telescope + " " + antennatype; 00196 }; 00197 00198 inline String telFromAntDesc(const String& antDesc){ 00199 String tempstr = antDesc; 00200 if(tempstr.contains(" ")) return tempstr.before(" "); 00201 return tempstr; 00202 }; 00203 00204 inline String antTypeFromAntDesc(const String& antDesc){ 00205 String tempstr = antDesc; 00206 if(tempstr.contains(" ")) return tempstr.after(" "); 00207 tempstr = ""; 00208 return tempstr; 00209 }; 00210 00211 }; 00212 00213 } //# NAMESPACE CASA - END 00214 #endif