Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/functional.py: 58%
106 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +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.
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
41try:
42 _swig_property = property
43except NameError:
44 pass # Python < 2.2 doesn't have 'property'.
46try:
47 import builtins as __builtin__
48except ImportError:
49 import __builtin__
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)
70def _swig_setattr(self, class_type, name, value):
71 return _swig_setattr_nondynamic(self, class_type, name, value, 0)
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))
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,)
90try:
91 _object = object
92 _newclass = 1
93except __builtin__.Exception:
94 class _object:
95 pass
96 _newclass = 0
98class functional(_object):
99 """Proxy of C++ casac::functional class."""
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
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
115 def f(self, *args, **kwargs):
116 """
117 f(self, _x) -> variant *
121 Summary:
122 Calculate the value of the functional
124 Description:
128 Calculate the value of the functional.
130 Input Parameters:
131 x real argument values
133 Example:
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])
141 --------------------------------------------------------------------------------
143 """
144 return _functional.functional_f(self, *args, **kwargs)
147 def ndim(self):
148 """
149 ndim(self) -> long
153 Summary:
154 Get the number of dimensions
156 Description:
159 Return the number of dimensions.
161 Example:
163 a = fn.gaussian1d()
164 # nd is set to 1
165 nd = fn.ndim()
167 --------------------------------------------------------------------------------
169 """
170 return _functional.functional_ndim(self)
173 def done(self):
174 """
175 done(self) -> bool
179 Summary:
180 Free resources of the functional
182 Description:
186 Free the functional's resources.
188 Example:
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
202 --------------------------------------------------------------------------------
204 """
205 return _functional.functional_done(self)
208 def gaussian1d(self, *args, **kwargs):
209 """
210 gaussian1d(self, _amplitude, _center, _fwhm) -> functional
214 Summary:
215 Create and return a new functional tool representing a 1D Gaussian function
217 Description:
221 Create a 1-dimensional Gaussian with the specified amplitude, fwhm, and
222 center.
224 Input Parameters:
225 amplitude amplitude of Gaussian
226 center center of Gaussian
227 fwhm FWHM of Gaussian
229 Example:
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)
235 # returns array([ 0.125, 2. , 0.125])
236 vals = gfn.f([0, 1, 2])
238 --------------------------------------------------------------------------------
240 """
241 return _functional.functional_gaussian1d(self, *args, **kwargs)
244 def gaussian2d(self, *args, **kwargs):
245 """
246 gaussian2d(self, _amplitude, _center, _fwhm, _pa) -> functional
250 Summary:
251 Create a 2D Gaussian function
253 Description:
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.
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.
268 Example:
270 # major axis along the y axis
271 g2d = fn.gaussian2d(1,[0,0],[3,2],'90deg')
273 # both these commands return 0.5
274 v = g2d([0, 1])
275 v = g2d([1.5, 0])
277 # returns array([ 0.5, 0.5])
278 v = g2d.f([0,1,1.5,0])
280 --------------------------------------------------------------------------------
282 """
283 return _functional.functional_gaussian2d(self, *args, **kwargs)
286 def polynomial(self, *args, **kwargs):
287 """
288 polynomial(self, _coefficients) -> functional
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
295 Description:
299 Create a 1-dimensional polynomial function with the specified coefficents.
301 Input Parameters:
302 coefficients Array of coefficients. Number of coefficients determines order of polynomial.
304 Example:
306 # get the value and derivatives of 3 + 2*x + 4*x*x
307 poly = fn.powerlogpoly(3, 2, 4)
309 # value at 3
310 vals = poly.f(3)
312 --------------------------------------------------------------------------------
314 """
315 return _functional.functional_polynomial(self, *args, **kwargs)
318 def powerlogpoly(self, *args, **kwargs):
319 """
320 powerlogpoly(self, _coefficients) -> functional
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)
327 Description:
331 Create a 1-dimensional power log polynomial function with the specified coefficents.
333 Input Parameters:
334 coefficients Array of coefficients.
336 Example:
338 # get the value and derivatives of 2*x**(1+ln(x))
339 plp = fn.powerlogpoly(2,1,1)
341 # value at 3
342 vals = plp.f(3)
344 --------------------------------------------------------------------------------
346 """
347 return _functional.functional_powerlogpoly(self, *args, **kwargs)
349 __swig_destroy__ = _functional.delete_functional
350 __del__ = lambda self: None
351functional_swigregister = _functional.functional_swigregister
352functional_swigregister(functional)
354# This file is compatible with both classic and new-style classes.