Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/functional.py: 38%

106 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-31 17:39 +0000

1# This file was automatically generated by SWIG (http://www.swig.org). 

2# Version 3.0.12 

3# 

4# Do not make changes to this file unless you know what you are doing--modify 

5# the SWIG interface file instead. 

6 

7from sys import version_info as _swig_python_version_info 

8if _swig_python_version_info >= (2, 7, 0): 

9 def swig_import_helper(): 

10 import importlib 

11 pkg = __name__.rpartition('.')[0] 

12 mname = '.'.join((pkg, '_functional')).lstrip('.') 

13 try: 

14 return importlib.import_module(mname) 

15 except ImportError: 

16 return importlib.import_module('_functional') 

17 _functional = swig_import_helper() 

18 del swig_import_helper 

19elif _swig_python_version_info >= (2, 6, 0): 

20 def swig_import_helper(): 

21 from os.path import dirname 

22 import imp 

23 fp = None 

24 try: 

25 fp, pathname, description = imp.find_module('_functional', [dirname(__file__)]) 

26 except ImportError: 

27 import _functional 

28 return _functional 

29 try: 

30 _mod = imp.load_module('_functional', fp, pathname, description) 

31 finally: 

32 if fp is not None: 

33 fp.close() 

34 return _mod 

35 _functional = swig_import_helper() 

36 del swig_import_helper 

37else: 

38 import _functional 

39del _swig_python_version_info 

40 

41try: 

42 _swig_property = property 

43except NameError: 

44 pass # Python < 2.2 doesn't have 'property'. 

45 

46try: 

47 import builtins as __builtin__ 

48except ImportError: 

49 import __builtin__ 

50 

51def _swig_setattr_nondynamic(self, class_type, name, value, static=1): 

52 if (name == "thisown"): 

53 return self.this.own(value) 

54 if (name == "this"): 

55 if type(value).__name__ == 'SwigPyObject': 

56 self.__dict__[name] = value 

57 return 

58 method = class_type.__swig_setmethods__.get(name, None) 

59 if method: 

60 return method(self, value) 

61 if (not static): 

62 if _newclass: 

63 object.__setattr__(self, name, value) 

64 else: 

65 self.__dict__[name] = value 

66 else: 

67 raise AttributeError("You cannot add attributes to %s" % self) 

68 

69 

70def _swig_setattr(self, class_type, name, value): 

71 return _swig_setattr_nondynamic(self, class_type, name, value, 0) 

72 

73 

74def _swig_getattr(self, class_type, name): 

75 if (name == "thisown"): 

76 return self.this.own() 

77 method = class_type.__swig_getmethods__.get(name, None) 

78 if method: 

79 return method(self) 

80 raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) 

81 

82 

83def _swig_repr(self): 

84 try: 

85 strthis = "proxy of " + self.this.__repr__() 

86 except __builtin__.Exception: 

87 strthis = "" 

88 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) 

89 

90try: 

91 _object = object 

92 _newclass = 1 

93except __builtin__.Exception: 

94 class _object: 

95 pass 

96 _newclass = 0 

97 

98class functional(_object): 

99 """Proxy of C++ casac::functional class.""" 

100 

101 __swig_setmethods__ = {} 

102 __setattr__ = lambda self, name, value: _swig_setattr(self, functional, name, value) 

103 __swig_getmethods__ = {} 

104 __getattr__ = lambda self, name: _swig_getattr(self, functional, name) 

105 __repr__ = _swig_repr 

106 

107 def __init__(self): 

108 """__init__(self) -> functional""" 

109 this = _functional.new_functional() 

110 try: 

111 self.this.append(this) 

112 except __builtin__.Exception: 

113 self.this = this 

114 

115 def f(self, *args, **kwargs): 

116 """ 

117 f(self, _x) -> variant * 

118 

119 

120 

121 Summary: 

122 Calculate the value of the functional 

123 

124 Description: 

125 

126 

127 

128 Calculate the value of the functional. 

129 

130 Input Parameters: 

131 x real argument values 

132 

133 Example: 

134 

135 gfn = fn.gaussian1d(2, 0, 1) 

136 #returns 0.125 

137 gfn.f(1) 

138 # returns array([ 1.25000000e-01, 3.05175781e-05]) 

139 gfn.f([1,2]) 

140 

141 -------------------------------------------------------------------------------- 

142 

143 """ 

144 return _functional.functional_f(self, *args, **kwargs) 

145 

146 

147 def ndim(self): 

148 """ 

149 ndim(self) -> long 

150 

151 

152 

153 Summary: 

154 Get the number of dimensions 

155 

156 Description: 

157 

158 

159 Return the number of dimensions. 

160 

161 Example: 

162 

163 a = fn.gaussian1d() 

164 # nd is set to 1 

165 nd = fn.ndim() 

166 

167 -------------------------------------------------------------------------------- 

168 

169 """ 

170 return _functional.functional_ndim(self) 

171 

172 

173 def done(self): 

174 """ 

175 done(self) -> bool 

176 

177 

178 

179 Summary: 

180 Free resources of the functional 

181 

182 Description: 

183 

184 

185 

186 Free the functional's resources. 

187 

188 Example: 

189 

190 - a:=dfs.gaussian1d() 

191 - a.setparameters([2,1,3]) 

192 T 

193 - a.state() 

194 [type=0, order=-1, ndim=1, npar=3, params=[2 1 3] , masks=[T T T] ] 

195 - a.done() 

196 T 

197 - is_functional(a) 

198 F 

199 - a 

200 F 

201 

202 -------------------------------------------------------------------------------- 

203 

204 """ 

205 return _functional.functional_done(self) 

206 

207 

208 def gaussian1d(self, *args, **kwargs): 

209 """ 

210 gaussian1d(self, _amplitude, _center, _fwhm) -> functional 

211 

212 

213 

214 Summary: 

215 Create and return a new functional tool representing a 1D Gaussian function 

216 

217 Description: 

218 

219 

220 

221 Create a 1-dimensional Gaussian with the specified amplitude, fwhm, and 

222 center. 

223 

224 Input Parameters: 

225 amplitude amplitude of Gaussian 

226 center center of Gaussian 

227 fwhm FWHM of Gaussian 

228 

229 Example: 

230 

231 # get the value and derivatives of a Gaussian with 

232 # height=2; center at x=1; a width of 1 at x=[0,1,2] 

233 gfn = fn.gaussian1d(2,1,1) 

234 

235 # returns array([ 0.125, 2. , 0.125]) 

236 vals = gfn.f([0, 1, 2]) 

237 

238 -------------------------------------------------------------------------------- 

239 

240 """ 

241 return _functional.functional_gaussian1d(self, *args, **kwargs) 

242 

243 

244 def gaussian2d(self, *args, **kwargs): 

245 """ 

246 gaussian2d(self, _amplitude, _center, _fwhm, _pa) -> functional 

247 

248 

249 

250 Summary: 

251 Create a 2D Gaussian function 

252 

253 Description: 

254 

255 

256 

257 Create a 2-dimensional Gaussian with the specified amplitude, fwhms, and 

258 center. The created functional has method {em f} to 

259 calculate the function value at a series of {em x, y} values, or the 

260 value. 

261 

262 Input Parameters: 

263 amplitude Amplitude of Gaussian 

264 center Center (x,y) position. Must have exactly 2 elements. 

265 fwhm FWHM of the axes. Must have exactly 2 elements. 

266 pa The angle between the positive y axis and the major axis, measured counterclockwise. 

267 

268 Example: 

269 

270 # major axis along the y axis 

271 g2d = fn.gaussian2d(1,[0,0],[3,2],'90deg') 

272 

273 # both these commands return 0.5 

274 v = g2d([0, 1]) 

275 v = g2d([1.5, 0]) 

276 

277 # returns array([ 0.5, 0.5]) 

278 v = g2d.f([0,1,1.5,0]) 

279 

280 -------------------------------------------------------------------------------- 

281 

282 """ 

283 return _functional.functional_gaussian2d(self, *args, **kwargs) 

284 

285 

286 def polynomial(self, *args, **kwargs): 

287 """ 

288 polynomial(self, _coefficients) -> functional 

289 

290 

291 

292 Summary: 

293 Create and return a new functional tool representing a 1D polynomial function, y = c_0 + c_1*x + c_2*x**2 + ... + c_n*x**n 

294 

295 Description: 

296 

297 

298 

299 Create a 1-dimensional polynomial function with the specified coefficents. 

300 

301 Input Parameters: 

302 coefficients Array of coefficients. Number of coefficients determines order of polynomial. 

303 

304 Example: 

305 

306 # get the value and derivatives of 3 + 2*x + 4*x*x 

307 poly = fn.powerlogpoly(3, 2, 4) 

308 

309 # value at 3 

310 vals = poly.f(3) 

311 

312 -------------------------------------------------------------------------------- 

313 

314 """ 

315 return _functional.functional_polynomial(self, *args, **kwargs) 

316 

317 

318 def powerlogpoly(self, *args, **kwargs): 

319 """ 

320 powerlogpoly(self, _coefficients) -> functional 

321 

322 

323 

324 Summary: 

325 Create and return a new functional tool representing a 1D power log polynomial function, y = c_0 * x**( c_1 + c_2*ln(x) + c_3*ln(x)**2 + ... c_n*ln(x)**(n-1) 

326 

327 Description: 

328 

329 

330 

331 Create a 1-dimensional power log polynomial function with the specified coefficents. 

332 

333 Input Parameters: 

334 coefficients Array of coefficients. 

335 

336 Example: 

337 

338 # get the value and derivatives of 2*x**(1+ln(x)) 

339 plp = fn.powerlogpoly(2,1,1) 

340 

341 # value at 3 

342 vals = plp.f(3) 

343 

344 -------------------------------------------------------------------------------- 

345 

346 """ 

347 return _functional.functional_powerlogpoly(self, *args, **kwargs) 

348 

349 __swig_destroy__ = _functional.delete_functional 

350 __del__ = lambda self: None 

351functional_swigregister = _functional.functional_swigregister 

352functional_swigregister(functional) 

353 

354# This file is compatible with both classic and new-style classes. 

355 

356