Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/quanta.py: 59%
127 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
1##################### generated by xml-casa (v2) from quanta.xml ####################
2##################### c60b82eff813fa8938533b4f7a1d5566 ##############################
3from __future__ import absolute_import
4from .__casac__.quanta import quanta as _quanta
6from .errors import create_error_string
7from .typecheck import CasaValidator as _validator
8_pc = _validator( )
9from .coercetype import coerce as _coerce
12class quanta:
13 _info_group_ = """quanta"""
14 _info_desc_ = """quanta tool handles units and quantities
15 """
16 ### self
17 def __init__(self, *args, **kwargs):
18 """Create a quanta tool on the specified host (or by default the
19 host you are running on).
20 """
21 self._swigobj = kwargs.get('swig_object',None)
22 if self._swigobj is None:
23 self._swigobj = _quanta()
25 def convertfreq(self, v=[ ], outunit='Hz'):
26 """convertfreq converts a frequency quantity to another unit.
27 """
28 return self._swigobj.convertfreq(v, outunit)
30 def convertdop(self, v=[ ], outunit='km/s'):
31 """convertfreq converts a velocity quantity to another unit. Units are either
32 velocity or dimensionless.
33 """
34 return self._swigobj.convertdop(v, outunit)
36 def quantity(self, v=[ ], unitname='', keepshape=False):
37 """quantity makes a quantity from a string, or from a value and a
38 string. Note that a function unit exists which is a synonym for
39 quantity. If only a string is given, it can be a scalar string.
40 The result will be a scalar quantity.
43 If a numeric value and a unit string
44 are given, the numeric value can be any numeric type, and can also be
45 a vector of numeric values. print qa.map() to get a list of recognized units.
46 'd' is usually days, but can be degrees (see example).
48 The keepshape input parameter is only relevant if v is a multi-dimensional array.
49 In this case, if true, the output value array will have the same shape as v. If false,
50 a one-dimensional array is returned with length equal to the number of elements in
51 v. The default value is false in order to preserve backward compatibility with
52 previous versions.
53 """
54 return self._swigobj.quantity(v, unitname, keepshape)
56 def getvalue(self, v=[ ]):
57 """getvalue returns the internal value of a quantity. It also can handle a 1-D
58 array of quantities, but multi-dimensional arrays are not supported.
59 """
60 return self._swigobj.getvalue(v)
62 def getunit(self, v=[ ]):
63 """getunit returns the internal unit string of a quantity. Note that 1-D arrays
64 are supported, but multi-dimensional arrays are not.
65 """
66 return self._swigobj.getunit(v)
68 def canonical(self, v=[ ]):
69 """canonical (with alias canon) gets the canonical value of a quantity
70 """
71 return self._swigobj.canonical(v)
73 def canon(self, v=[ ]):
74 """canon gets the canonical value of a quantity
75 """
76 return self._swigobj.canon(v)
78 def convert(self, v=[ ], outunit=[ ]):
79 """convert converts a quantity to another unit. If no output unit given,
80 conversion is to canonical units
81 """
82 return self._swigobj.convert(v, outunit)
84 def define(self, name, v=[ ]):
85 """define defines the name and value of a user defined unit
86 """
87 return self._swigobj.define(name, v)
89 def map(self, v='all'):
90 """map lists the known mapping of units and constants. It has a single argument,
91 which can be a coded string (no-case, minimax match):
92 begin{description}
93 item[all] all of the following units (not constants): also the default
94 item[Prefix] known decimal prefixes
95 item[SI] known SI units
96 item[Customary] a set of customary units known to programs
97 item[User] units defined by the user
98 item[Constants] known constants (note: only 'const', 'Const', 'constants'
99 and 'Constants' recognised).
100 end{description}
101 """
102 return self._swigobj.map(v)
104 def maprec(self, v='all'):
105 """maprec returns a record with the known mapping of units and constants. It has a single argument,
106 which can be a coded string (no-case, minimax match):
107 begin{description}
108 item[all] all of the following units (not constants): also the default
109 item[Prefix] known decimal prefixes
110 item[SI] known SI units
111 item[Customary] a set of customary units known to programs
112 item[User] units defined by the user
113 end{description}
114 """
115 return self._swigobj.maprec(v)
117 def fits(self):
118 """fits defines some unit names used in reading and writing FITS files.
119 """
120 return self._swigobj.fits()
122 def angle(self, v=[ ], prec=int(0), form=[ ], showform=False):
123 """angle converts an angle quantity to a formatted string. The formatting
124 information is a precision (0 is default, 6 includes +-ddd.mm.ss) and a
125 string array of codes (no-case, minimax match):
126 Codes include:
127 begin{description}
128 item[clean] delete leading/trailing superfluous separators
129 item[no_d] do not show degrees part
130 item[no_dm] do not show degrees and minutes part
131 item[dig2] show only 2 digits of degrees in angle format
132 item[time] show as time (hh:mm:ss.ttt) rather than as angle
133 end{description}
134 If a multi-dimensional value is given for the value $v$, the returned value
135 is a string vector of a length equal to last dimension. Each string has a
136 number of fields equal to the number of elements in all earlier
137 dimensions. If the {em showform} is $T$, each vector element is surrounded
138 by a pair of square brackets if there is more than one entry, and fields are
139 separated by a ','.
140 """
141 return self._swigobj.angle(v, prec, form, showform)
143 def time(self, v=[ ], prec=int(0), form=[ ], showform=False):
144 """time converts a time quantity to a formatted string. The formatting
145 information is a precision (0 is default, 6 includes hh.mm.ss) and a
146 string array of codes (no-case, minimax match):
147 Codes include:
148 begin{description}
149 item[clean] delete leading/trailing superfluous separators
150 item[no_d] do not show hours part
151 item[no_dm] do not show hours and minutes part
152 item[ymd] include a date as yyyy/mm/dd (date is by default not shown)
153 item[dmy] include a date as ddMMMyyyy (date is by default not shown)
154 item[mjd] include a date as Modified Julian Day (date is by default not shown)
155 item[fits] include a date and show time in FITS format: le from OS
156 item[angle] show in angle (dd.mm.ss.ttt) rather than time format
157 item[day] prefix day-of-week to output
158 item[local] show local time rather than UTC (add timezone offset)
159 item[no_time] suppress printing of time part
160 end{description}
161 If a multi-dimensional value is given for the value $v$, the returned value
162 is a string vector of a length equal to last dimension. Each string has a
163 number of fields equal to the number of elements in all earlier
164 dimensions. If the {em showform} is $T$, each vector element is surrounded
165 by a pair of square brackets if there is more than one entry, and fields are
166 separated by a ','.
167 """
168 return self._swigobj.time(v, prec, form, showform)
170 def add(self, v=[ ], a=[ ]):
171 """add adds two quantities
172 """
173 return self._swigobj.add(v, a)
175 def sub(self, v=[ ], a=[ ]):
176 """sub subtracts two quantities
177 """
178 return self._swigobj.sub(v, a)
180 def mul(self, v=[ ], a=[ ]):
181 """mul multiplies two quantities
182 """
183 return self._swigobj.mul(v, a)
185 def div(self, v=[ ], a=[ ]):
186 """div divides two quantities
187 """
188 return self._swigobj.div(v, a)
190 def neg(self, v=[ ]):
191 """neg negates a quantity
192 """
193 return self._swigobj.neg(v)
195 def norm(self, v=[ ], a=float(-0.5)):
196 """norm normalise angles in interval of $2pi$ radians. The default interval is
197 from -0.5 to +0.5 of a full interval (i.e. from -180 to +180 degrees). The
198 lower end of the interval can be set as a fraction of $2pi$
199 """
200 return self._swigobj.norm(v, a)
202 def le(self, v=[ ], a=[ ]):
203 """le compares two quantities for less than or equal.
204 """
205 return self._swigobj.le(v, a)
207 def lt(self, v=[ ], a=[ ]):
208 """lt compares two quantities for less than.
209 """
210 return self._swigobj.lt(v, a)
212 def eq(self, v=[ ], a=[ ]):
213 """eq compares two quantities for equality.
214 """
215 return self._swigobj.eq(v, a)
217 def ne(self, v=[ ], a=[ ]):
218 """ne compares two quantities for non equality.
219 """
220 return self._swigobj.ne(v, a)
222 def gt(self, v=[ ], a=[ ]):
223 """gt compares two quantities for greater than.
224 """
225 return self._swigobj.gt(v, a)
227 def ge(self, v=[ ], a=[ ]):
228 """ge compares two quantities for greater than or equal.
229 """
230 return self._swigobj.ge(v, a)
232 def sin(self, v=[ ]):
233 """sin gives sine of angle quantity
234 """
235 return self._swigobj.sin(v)
237 def cos(self, v=[ ]):
238 """cos gives cosine of angle quantity
239 """
240 return self._swigobj.cos(v)
242 def tan(self, v=[ ]):
243 """tan gives tangent of angle quantity
244 """
245 return self._swigobj.tan(v)
247 def asin(self, v=[ ]):
248 """asin gives arcsine of non-dimensioned quantity
249 """
250 return self._swigobj.asin(v)
252 def acos(self, v=[ ]):
253 """acos gives arccosine of non-dimensioned quantity
254 """
255 return self._swigobj.acos(v)
257 def atan(self, v=[ ]):
258 """atan gives arctangent of non-dimensioned quantity
259 """
260 return self._swigobj.atan(v)
262 def atan2(self, v=[ ], a=[ ]):
263 """atan gives arctangent of two non-dimensioned quantity
264 """
265 return self._swigobj.atan2(v, a)
267 def abs(self, v=[ ]):
268 """abs gives absolute value of quantity
269 """
270 return self._swigobj.abs(v)
272 def ceil(self, v=[ ]):
273 """ceil gives ceiling value of quantity
274 """
275 return self._swigobj.ceil(v)
277 def floor(self, v=[ ]):
278 """floor gives flooring value of quantity
279 """
280 return self._swigobj.floor(v)
282 def log(self, v=[ ]):
283 """log gives natural logarithm of dimensionless quantity
284 """
285 return self._swigobj.log(v)
287 def log10(self, v=[ ]):
288 """log10 gives logarithm of dimensionless quantity
289 """
290 return self._swigobj.log10(v)
292 def exp(self, v=[ ]):
293 """exp gives exponential value of dimensionless quantity
294 """
295 return self._swigobj.exp(v)
297 def sqrt(self, v=[ ]):
298 """sqrt gives square root of quantity with only even powered dimensions
299 """
300 return self._swigobj.sqrt(v)
302 def compare(self, v=[ ], a=[ ]):
303 """compare compares the dimensionality of units of two qauntities
304 """
305 return self._swigobj.compare(v, a)
307 def check(self, v):
308 """check checks if the argument has a properly defined unit string
309 """
310 return self._swigobj.check(v)
312 def checkfreq(self, cm=[ ]):
313 """checkfreq checks if the argument has a properly defined frequency interpretable
314 unit string
315 """
316 return self._swigobj.checkfreq(cm)
318 def pow(self, v=[ ], a=int(1)):
319 """pow raises a quantity to an integer power
320 """
321 return self._swigobj.pow(v, a)
323 def constants(self, v='pi'):
324 """constants gets a named constant quantity. Names (no-case, minimax) are:
326 pi 3.14.. 3.14159
327 ee 2.71.. 2.71828
328 c light vel. 2.99792e+08 m/s
329 G grav. const 6.67259e-11 N.m2/kg2
330 h Planck const 6.62608e-34 J.s
331 HI HI line 1420.41 MHz
332 R gas const 8.31451 J/K/mol
333 NA Avogadro number 6.02214e+23 mol-1
334 e electron charge 1.60218e-19 C
335 mp proton mass 1.67262e-27 kg
336 mp_me mp/me 1836.15
337 mu0 permeability vac. 1.25664e-06 H/m
338 eps0 permittivity vac. 1.60218e-19 C
339 k Boltzmann const 1.38066e-23 J/K
340 F Faraday const 96485.3 C/mol
341 me electron mass 9.10939e-31 kg
342 re electron radius 2.8179e-15 m
343 a0 Bohr's radius 5.2918e-11 m
344 R0 solar radius 6.9599e+08 m
345 k2 IAU grav. const^2 0.000295912 AU3/d2/S0
346 """
347 return self._swigobj.constants(v)
349 def isangle(self, v=[ ]):
350 """isangle checks if the argument is a valid angle/time quantity.
351 """
352 return self._swigobj.isangle(v)
354 def totime(self, v=[ ]):
355 """totime converts an angle quantity (or a time) to a time quantity
356 """
357 return self._swigobj.totime(v)
359 def toangle(self, v=[ ]):
360 """toangle converts a time quantity (or an angle) to an angle quantity
361 """
362 return self._swigobj.toangle(v)
364 def splitdate(self, v=[ ]):
365 """splitdate splits a date/time quantity into a record with constituent fields
366 like year, yearday, month etc. All fields will be integer (to enable use as
367 index and easy personal formatting), with the exception of the {em s} field
368 which is a double float. See the example for the fields returned.
369 """
370 return self._swigobj.splitdate(v)
372 def tos(self, v=[ ], prec=int(9)):
373 """tos converts a quantity to a string with the precision defined with
374 the {em setformat('prec')} (which defaults to 9). If the optional
375 {em prec} argument is set to an integer value greater than 1, that
376 precision is used in the conversion
377 """
378 return self._swigobj.tos(v, prec)
380 def type(self):
381 """type will return the tool name.
382 """
383 return self._swigobj.type()
385 def done(self, kill=False):
386 """Currently, this method is an NOP.
387 """
388 return self._swigobj.done(kill)
390 def unit(self, v=[ ], unitname='', keepshape=False):
391 """unit makes a quantity from a string, or from a value and a string.
392 Note that unit is a synonym for quantity (see description and example there).
393 """
394 return self._swigobj.unit(v, unitname, keepshape)
396 def isquantity(self, v=[ ]):
397 """Checks if the operand is a correct quantity
398 """
399 return self._swigobj.isquantity(v)
401 def setformat(self, t='', v='F'):
402 """
403 """
404 return self._swigobj.setformat(t, v)
406 def getformat(self, t=''):
407 """getformat returns the current format value set for the different
408 format possibilities. See the
409 setformat function for the
410 different format type descriptions. The known types are:
411 prec, aprec, tprec, long, lat, len, dtime, elev, auto, vel, freq,
412 dop, unit.
413 """
414 return self._swigobj.getformat(t)
416 def formxxx(self, v=[ ], format='dms', prec=int(2)):
417 """form.xxx (xxx can be lat, long, len, vel, freq, dtime, unit) will format the
418 input into a string using the global format information set by setformat().
419 """
420 return self._swigobj.formxxx(v, format, prec)