Coverage for /wheeldirectory/casa-6.7.0-11-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/vpmanager.py: 56%

55 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-23 15:54 +0000

1##################### generated by xml-casa (v2) from vpmanager.xml ################# 

2##################### 5d35ac075fad57789813a8b6b1890749 ############################## 

3from __future__ import absolute_import 

4from .__casac__.vpmanager import vpmanager as _vpmanager 

5 

6from .errors import create_error_string 

7from .typecheck import CasaValidator as _validator 

8_pc = _validator( ) 

9from .coercetype import coerce as _coerce 

10 

11 

12class vpmanager: 

13 _info_group_ = """imager""" 

14 _info_desc_ = """Tool for specifying voltage patterns and primary beams""" 

15 ### self 

16 def __init__(self, *args, **kwargs): 

17 """The vpmanager constructor has no arguments. 

18 """ 

19 self._swigobj = kwargs.get('swig_object',None) 

20 if self._swigobj is None: 

21 self._swigobj = _vpmanager() 

22 

23 def saveastable(self, tablename=''): 

24 """Save the vp or pb descriptions as a table. Each description is in a different 

25 row of the table. 

26 """ 

27 return self._swigobj.saveastable(tablename) 

28 

29 def loadfromtable(self, tablename=''): 

30 """Load the vp or pb descriptions from a table created, e.g., with saveastable(). 

31 """ 

32 return self._swigobj.loadfromtable(tablename) 

33 

34 def summarizevps(self, verbose=False): 

35 """Summarize the currently accumulated VP descriptions to the logger. 

36 """ 

37 return self._swigobj.summarizevps(verbose) 

38 

39 def setcannedpb(self, telescope='VLA', othertelescope='', dopb=True, commonpb='DEFAULT', dosquint=False, paincrement=[ ], usesymmetricbeam=False): 

40 """We have many vp/pb models ready to go for a variety of telescopes. If 'DEFAULT' isselected, the system default for that telescope and frequency is used. 

41 """ 

42 return self._swigobj.setcannedpb(telescope, othertelescope, dopb, commonpb, dosquint, paincrement, usesymmetricbeam) 

43 

44 def setpbairy(self, telescope='VLA', othertelescope='', dopb=True, dishdiam=[ ], blockagediam=[ ], maxrad=[ ], reffreq=[ ], squintdir=[ ], squintreffreq=[ ], dosquint=False, paincrement=[ ], usesymmetricbeam=False): 

45 """Information sufficient to create a portion of the Airy disk voltage pattern. 

46 The Airy disk pattern is formed by Fourier transforming a uniformly illuminated 

47 aperture and is given by 

48 begin{equation} 

49 vp_p(i) = ( areaRatio * 2.0 * j_{1}(x)/x 

50 - 2.0 * j_{1}(x*lengthRatio)/(x*lengthRatio) )/ areaNorm, 

51 end{equation} 

52 where areaRatio is the dish area divided by the blockage area, lengthRatio 

53 is the dish diameter divided by the blockage diameter, and 

54 begin{equation} 

55 x = frac{i * maxrad * 7.016 * dishdiam/24.5m}{N_{samples} * 1.566 * 60}. 

56 end{equation} 

57 """ 

58 return self._swigobj.setpbairy(telescope, othertelescope, dopb, dishdiam, blockagediam, maxrad, reffreq, squintdir, squintreffreq, dosquint, paincrement, usesymmetricbeam) 

59 

60 def setpbcospoly(self, telescope='VLA', othertelescope='', dopb=True, coeff=[ float(-1) ], scale=[ float(-1) ], maxrad=[ ], reffreq=[ ], isthispb='PB', squintdir=[ ], squintreffreq=[ ], dosquint=False, paincrement=[ ], usesymmetricbeam=False): 

61 """A voltage pattern or primary beam of the form 

62 begin{equation} 

63 VP(x) = sum_{i} ( coeff_{i} cos^{2i}( scale_{i} x). 

64 end{equation} 

65 This is a generalization of the WSRT primary beam model. 

66 """ 

67 return self._swigobj.setpbcospoly(telescope, othertelescope, dopb, coeff, scale, maxrad, reffreq, isthispb, squintdir, squintreffreq, dosquint, paincrement, usesymmetricbeam) 

68 

69 def setpbgauss(self, telescope='VLA', othertelescope='', dopb=True, halfwidth=[ ], maxrad=[ ], reffreq=[ ], isthispb='PB', squintdir=[ ], squintreffreq=[ ], dosquint=False, paincrement=[ ], usesymmetricbeam=False): 

70 """Make a Gaussian primary beam given by 

71 begin{equation} 

72 PB(x) = e^{- (x/(halfwidth*sqrt{1/log(2)})) }. 

73 end{equation} 

74 """ 

75 return self._swigobj.setpbgauss(telescope, othertelescope, dopb, halfwidth, maxrad, reffreq, isthispb, squintdir, squintreffreq, dosquint, paincrement, usesymmetricbeam) 

76 

77 def setpbinvpoly(self, telescope='VLA', othertelescope='', dopb=True, coeff=[ float(-1) ], maxrad=[ ], reffreq=[ ], isthispb='PB', squintdir=[ ], squintreffreq=[ ], dosquint=False, paincrement=[ ], usesymmetricbeam=False): 

78 """The inverse polynomial describes the inverse of the VP or PB 

79 as a polynomial of even powers: 

80 begin{equation} 

81 1/VP(x) = sum_{i} coeff_{i} * x^{2i}. 

82 end{equation} 

83 """ 

84 return self._swigobj.setpbinvpoly(telescope, othertelescope, dopb, coeff, maxrad, reffreq, isthispb, squintdir, squintreffreq, dosquint, paincrement, usesymmetricbeam) 

85 

86 def setpbnumeric(self, telescope='VLA', othertelescope='', dopb=True, vect=[ float(-1) ], maxrad=[ ], reffreq=[ ], isthispb='PB', squintdir=[ ], squintreffreq=[ ], dosquint=False, paincrement=[ ], usesymmetricbeam=False): 

87 """Supply a vector of vp/pb sample values taken on a regular grid between x=0 and 

88 x=maxrad. We perform sinc interpolation to fill in the lookup table. 

89 """ 

90 return self._swigobj.setpbnumeric(telescope, othertelescope, dopb, vect, maxrad, reffreq, isthispb, squintdir, squintreffreq, dosquint, paincrement, usesymmetricbeam) 

91 

92 def setpbimage(self, telescope='VLA', othertelescope='', dopb=True, realimage='', imagimage='', compleximage='', antnames=[ '*' ]): 

93 """Experimental: Supply an image of the E Jones elements. The format of the 

94 image is: 

95 begin{description} 

96 item[Shape] nx by ny by 4 complex polarizations (RR, RL, LR, LL or 

97 XX, XY, YX, YY) by 1 channel. 

98 item[Direction coordinate] Az, El 

99 item[Stokes coordinate] All four ``stokes'' parameters must be present 

100 in the sequence RR, RL, LR, LL or XX, XY, YX, YY. 

101 item[Frequency] Only one channel is currently needed - frequency 

102 dependence beyond that is ignored. 

103 end{description} 

104  

105 If a compleximage is specified the real and imaginary images is to be left empty. 

106  

107 The other option is to provide the real and imaginary part of the E-Jones as seperale {tt float} images 

108 On that case 

109 one or two images may be specified - the real (must be present) and 

110 imaginary parts (optional). 

111  

112 Note that beamsquint must be intrinsic to the images themselves. 

113 This will be accounted for correctly by regridding of the images 

114 from Az-El to Ra-Dec according to the parallactic angle. 

115  

116 antnames is the Vector of names for which this response pattern apply '*' is for all 

117 The name has to match exactly the name of the Antennas in the ANTENNA table of the MS with which 

118 you want to use this VPManager table or object. 

119 """ 

120 return self._swigobj.setpbimage(telescope, othertelescope, dopb, realimage, imagimage, compleximage, antnames) 

121 

122 def setpbpoly(self, telescope='VLA', othertelescope='', dopb=True, coeff=[ float(-1) ], maxrad=[ ], reffreq=[ ], isthispb='PB', squintdir=[ ], squintreffreq=[ ], dosquint=False, paincrement=[ ], usesymmetricbeam=False): 

123 """The VP or PB is described as a polynomial of even powers: 

124 begin{equation} 

125 VP(x) = sum_{i} coeff_{i} * x^{2i}. 

126 end{equation} 

127 """ 

128 return self._swigobj.setpbpoly(telescope, othertelescope, dopb, coeff, maxrad, reffreq, isthispb, squintdir, squintreffreq, dosquint, paincrement, usesymmetricbeam) 

129 

130 def setpbantresptable(self, telescope='', othertelescope='', dopb=True, antresppath=''): 

131 """Declare a reference to an antenna responses table containing a set of VP/PB definitions. 

132 """ 

133 return self._swigobj.setpbantresptable(telescope, othertelescope, dopb, antresppath) 

134 

135 def reset(self): 

136 """Reinitialize the VPManager database. 

137 Erase all VPs and defaults defined on the command line. 

138 """ 

139 return self._swigobj.reset() 

140 

141 def setuserdefault(self, vplistnum=int(-1), telescope='', anttype=''): 

142 """Selects the VP which is to be used by the imager for the given telescope and antenna type. 

143 Overwrites a previous default. Returns True if successful. 

144 """ 

145 return self._swigobj.setuserdefault(vplistnum, telescope, anttype) 

146 

147 def getuserdefault(self, telescope='', anttype=''): 

148 """Get the vp list number of the present default VP/PB for the given parameters. 

149 """ 

150 return self._swigobj.getuserdefault(telescope, anttype) 

151 

152 def getanttypes(self, telescope='', obstime=[ ], freq=[ ], obsdirection=[ ]): 

153 """Get a list of the available antenna types. 

154 """ 

155 return self._swigobj.getanttypes(telescope, obstime, freq, obsdirection) 

156 

157 def numvps(self, telescope='', obstime=[ ], freq=[ ], obsdirection=[ ]): 

158 """Can be used to, e.g., determine the number of antenna types. 

159 Note: if a global response is defined for the telescope, this will increase the count of 

160 available vps/pbs by 1. 

161 """ 

162 return self._swigobj.numvps(telescope, obstime, freq, obsdirection) 

163 

164 def getvp(self, telescope='', antennatype='', obstime=[ ], freq=[ ], obsdirection='AZEL 0deg 90deg'): 

165 """Record is empty if no matching vp/pb could be found. 

166 """ 

167 return self._swigobj.getvp(telescope, antennatype, obstime, freq, obsdirection) 

168 

169 def getvps(self, telescope='', antennas=[ ], obstimestart='1970/01/01T00:00:00', obstimeend='1970/01/01T00:00:00', minfreq='1GHz', maxfreq='1GHz', obsdirection='AZEL 0deg 90deg'): 

170 """Record is empty if no matching vp/pb could be found. 

171 """ 

172 return self._swigobj.getvps(telescope, antennas, obstimestart, obstimeend, minfreq, maxfreq, obsdirection) 

173 

174 def createantresp(self, imdir='', starttime='', bandnames=[ ], bandminfreq=[ ], bandmaxfreq=[ ]): 

175 """The AntennaResponses table serves CASA to look up the location of images describing the 

176 response of observatory antennas. Three types of images are supported: "VP" - real voltage patterns, 

177 "AIF" - complex aperture illumination patterns, "EFP" - complex electric field patterns. 

178 For each image, a validity range can be defined in Azimuth, Elevation, and Frequency. 

179 Furthermore, an antenna type (for heterogeneous arrays), a receiver type (for the case of 

180 several receivers on the same antenna having overlapping frequency bands), and a beam number 

181 (for the case of multiple beams per antenna) are associated with each response image. 

182  

183 The images need to be stored in a single directory DIR of arbitrary name and need to 

184 have file names following the pattern 

185 begin{verbatim} 

186 obsname_beamnum_anttype_rectype_azmin_aznom_azmax_elmin_elnom_elmax_freqmin_freqnom_freqmax_frequnit_comment_functype.im 

187 end{verbatim} 

188 where the individual name elements mean the following (none of the elements may contain 

189 the space character, but they may be empty strings if they are not numerical values): 

190 begin{description} 

191 item[obsname] - name of the observatory as in the Observatories table, e.g. "ALMA" 

192 item[beamnum] - the numerical beam number (integer) for the case of multiple beams, e.g. 0 

193 item[anttype] - name of the antenna type, e.g. "DV" 

194 item[rectype] - name of the receiver type, e.g. "" 

195 item[azmin, aznom, azmax] - numerical value (degrees) of the minimal, the nominal, and 

196 the maximal Azimuth where this response is valid, e.g. "-10.5_0._10.5" 

197 item[elmin, elnom, elmax] - numerical value (degrees) of the minimal, the nominal, and 

198 the maximal Elevation where this response is valid, e.g. "10._45._80." 

199 item[freqmin, freqnom, freqmax] - numerical value (degrees) of the minimal, the nominal, and 

200 the maximal Frequency (in units of frequnit) where this response is valid, e.g. "84._100._116." 

201 item[frequnit] - the unit of the previous three frequencies, e.g. "GHz" 

202 item[comment] - any string containing only characters permitted in file names and not empty space 

203 item[functype] - the type of the image as defined above ("VP", "AIF", or "EFP") 

204 end{description} 

205  

206 The createantresp method will then extract the parameters from all the images in DIR 

207 and create the lookup table in the same directory. 

208 """ 

209 return self._swigobj.createantresp(imdir, starttime, bandnames, bandminfreq, bandmaxfreq) 

210 

211 def getrespimagename(self, telescope='', starttime='', frequency='', functype='ANY', anttype='', azimuth='0deg', elevation='45deg', rectype='', beamnumber=int(0)): 

212 """Given the observatory name, the antenna type, the receiver type, the observing frequency, the 

213 observing direction, and the beam number, find the applicable response image and return its name. 

214 """ 

215 return self._swigobj.getrespimagename(telescope, starttime, frequency, functype, anttype, azimuth, elevation, rectype, beamnumber) 

216