Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/quanta.py: 53%
206 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# 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, '_quanta')).lstrip('.')
13 try:
14 return importlib.import_module(mname)
15 except ImportError:
16 return importlib.import_module('_quanta')
17 _quanta = 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('_quanta', [dirname(__file__)])
26 except ImportError:
27 import _quanta
28 return _quanta
29 try:
30 _mod = imp.load_module('_quanta', fp, pathname, description)
31 finally:
32 if fp is not None:
33 fp.close()
34 return _mod
35 _quanta = swig_import_helper()
36 del swig_import_helper
37else:
38 import _quanta
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 quanta(_object):
99 """Proxy of C++ casac::quanta class."""
101 __swig_setmethods__ = {}
102 __setattr__ = lambda self, name, value: _swig_setattr(self, quanta, name, value)
103 __swig_getmethods__ = {}
104 __getattr__ = lambda self, name: _swig_getattr(self, quanta, name)
105 __repr__ = _swig_repr
107 def __init__(self):
108 """__init__(self) -> quanta"""
109 this = _quanta.new_quanta()
110 try:
111 self.this.append(this)
112 except __builtin__.Exception:
113 self.this = this
115 def convertfreq(self, *args, **kwargs):
116 """
117 convertfreq(self, _v, _outunit) -> record *
121 Summary:
122 convert a frequency quantity to another unit
124 Description:
127 convertfreq converts a frequency quantity to another unit.
129 Input Parameters:
130 v quantity to convert
131 outunit unit to convert to
133 Example:
136 #
137 print 't----t convertfreq Ex 1 t----'
138 print qa.convertfreq('5GHz','cm')
139 #{'value': 5.9958491599999997, 'unit': 'cm'}
140 print qa.convertfreq('5cm','GHz')
141 #{'value': 5.9958491599999997, 'unit': 'GHz'}
142 #
145 --------------------------------------------------------------------------------
147 """
148 return _quanta.quanta_convertfreq(self, *args, **kwargs)
151 def convertdop(self, *args, **kwargs):
152 """
153 convertdop(self, _v, _outunit) -> record *
157 Summary:
158 convert a doppler velocity quantity to another unit
160 Description:
163 convertfreq converts a velocity quantity to another unit. Units are either
164 velocity or dimensionless.
166 Input Parameters:
167 v quantity to convert
168 outunit unit to convert to
170 Example:
173 #
174 print 't----t convertdop Ex 1 t----'
175 print qa.convertdop('1','km/s')
176 #{'value': 299792.45799999998, 'unit': 'km/s'}
177 print qa.convertdop('10km/s','1')
178 #{'value': 3.3356409519815205e-05, 'unit': '1'}
179 #
182 --------------------------------------------------------------------------------
184 """
185 return _quanta.quanta_convertdop(self, *args, **kwargs)
188 def quantity(self, *args, **kwargs):
189 """
190 quantity(self, _v, _unitname, _keepshape) -> record *
194 Summary:
195 make a quantity from a string or from a numeric value and a unit string
197 Description:
200 quantity makes a quantity from a string, or from a value and a
201 string. Note that a function unit exists which is a synonym for
202 quantity. If only a string is given, it can be a scalar string.
203 The result will be a scalar quantity.
206 If a numeric value and a unit string
207 are given, the numeric value can be any numeric type, and can also be
208 a vector of numeric values. print qa.map() to get a list of recognized units.
209 'd' is usually days, but can be degrees (see example).
211 The keepshape input parameter is only relevant if v is a multi-dimensional array.
212 In this case, if true, the output value array will have the same shape as v. If false,
213 a one-dimensional array is returned with length equal to the number of elements in
214 v. The default value is false in order to preserve backward compatibility with
215 previous versions.
217 Input Parameters:
218 v quantity or numeric or string to convert to quantity
219 unitname unit string if v numeric
220 keepshape Only used if input parameter v is a multi-dimensional array. Output array will have the same shape as v.
222 Example:
225 #
226 print 't----t quantity Ex 1 t----'
227 tu = qa.quantity('1Jy')# make quantity
228 print tu
229 #{'value': 1.0, 'unit': 'Jy'}
230 print qa.quantity(tu)# also accepts a quantity
231 #{'value': 1.0, 'unit': 'Jy'}
232 tu = qa.unit('1Jy')# make quantity with synonym
233 print tu
234 #{'value': 1.0, 'unit': 'Jy'}
235 print qa.quantity(-1.3, 'Jy')# make quantity with separate value
236 #{'value': -1.3, 'unit': 'Jy'}
237 q1 = qa.quantity([8.57132661e+09, 1.71426532e+10], 'km/s') # Composite unit
238 print q1
239 #{'value': array([ 8.57132661e+09, 1.71426532e+10]), 'unit': 'km/s'}
240 q = qa.quantity('5d'); print q
241 #{'value': 5.0, 'unit': 'd'} # d = days
242 q = qa.quantity('5 d'); print q
243 #{'value': 5.0, 'unit': 'd'} # even if there's a space, as of 5/28/09
244 q = qa.quantity('5d30m'); print q
245 #{'value': 5.5, 'unit': 'deg'} # Unless followed by an m!
246 qa.quantity('5d30s') # WRONG
247 # {'unit': 'd30s', 'value': 5.0} # I told you...
248 qa.quantity('5d0m30s') # OK
249 # {'unit': 'deg', 'value': 5.0083333333333337}
252 --------------------------------------------------------------------------------
254 """
255 return _quanta.quanta_quantity(self, *args, **kwargs)
258 def getvalue(self, *args, **kwargs):
259 """
260 getvalue(self, _v) -> std::vector< double >
264 Summary:
265 get the internal value of a quantity
267 Description:
270 getvalue returns the internal value of a quantity. It also can handle a 1-D
271 array of quantities, but multi-dimensional arrays are not supported.
273 Input Parameters:
274 v quantity
276 Example:
279 #
280 print 't----t getvalue Ex 1 t----'
281 tu = qa.quantity(-1.3, 'Jy') # make quantity
282 print tu
283 #{'value': -1.3, 'unit': 'Jy'}
284 print qa.getvalue(tu)
285 #-1.3
286 print qa.getunit(tu)
287 #Jy
288 a = qa.quantity([3,5],'cm')
289 print a
290 #{'value': array([ 3., 5.]), 'unit': 'cm'}
291 print qa.getvalue(a)
292 #[3.0, 5.0]
293 #
296 --------------------------------------------------------------------------------
298 """
299 return _quanta.quanta_getvalue(self, *args, **kwargs)
302 def getunit(self, *args, **kwargs):
303 """
304 getunit(self, _v) -> string
308 Summary:
309 get the internal unit of a quantity
311 Description:
314 getunit returns the internal unit string of a quantity. Note that 1-D arrays
315 are supported, but multi-dimensional arrays are not.
317 Input Parameters:
318 v quantity
320 Example:
323 #
324 print 't----t getunit Ex 1 t----'
325 tu = qa.quantity(-1.3, 'Jy') # make quantity
326 print tu
327 #{'value': -1.3, 'unit': 'Jy'}
328 print qa.getvalue(tu)
329 #-1.3
330 print qa.getunit(tu)
331 #Jy
332 #
335 --------------------------------------------------------------------------------
337 """
338 return _quanta.quanta_getunit(self, *args, **kwargs)
341 def canonical(self, *args, **kwargs):
342 """
343 canonical(self, _v) -> record *
347 Summary:
348 get canonical value of quantity
350 Description:
353 canonical (with alias canon) gets the canonical value of a quantity
355 Input Parameters:
356 v value to convert
358 Example:
361 #
362 print 't----t canonical Ex 1 t----'
363 print qa.canonical('1Jy')# canonical value of a string
364 #{'value': 1e-26, 'unit': 'kg.s-2'}
365 print qa.canon(qa.quantity('1Jy'))# canonical value of a unit
366 #{'value': 1e-26, 'unit': 'kg.s-2'}
367 #
370 --------------------------------------------------------------------------------
372 """
373 return _quanta.quanta_canonical(self, *args, **kwargs)
376 def canon(self, *args, **kwargs):
377 """
378 canon(self, _v) -> record *
382 Summary:
383 get canonical value of quantity
385 Description:
388 canon gets the canonical value of a quantity
390 Input Parameters:
391 v value to convert
393 Example:
396 #
397 print 't----t canon Ex 1 t----'
398 print qa.canon('1Jy') # canonical value of a string
399 #{'value': 1e-26, 'unit': 'kg.s-2'}
400 print qa.canonical(qa.quantity('1Jy'))# canonical value of a unit
401 #{'value': 1e-26, 'unit': 'kg.s-2'}
402 #
405 --------------------------------------------------------------------------------
407 """
408 return _quanta.quanta_canon(self, *args, **kwargs)
411 def convert(self, *args, **kwargs):
412 """
413 convert(self, _v, _outunit) -> record *
417 Summary:
418 convert a quantity to another unit
420 Description:
423 convert converts a quantity to another unit. If no output unit given,
424 conversion is to canonical units
426 Input Parameters:
427 v quantity to convert
428 outunit unit to convert to
430 Example:
433 #
434 print 't----t convert Ex 1 t----'
435 tu = qa.quantity('5Mm/s')# specify a quantity
436 print tu
437 #{'value': 5.0, 'unit': 'Mm/s'}
438 print qa.convert(tu, 'pc/a')# convert it to parsec per year
439 #{'value': 0.0051135608266237404, 'unit': 'pc/a'}
440 print qa.convert(tu)# convert to canonical units
441 #{'value': 5000000.0, 'unit': 'm.s-1'}
442 #
445 --------------------------------------------------------------------------------
447 """
448 return _quanta.quanta_convert(self, *args, **kwargs)
451 def define(self, *args, **kwargs):
452 """
453 define(self, _name, _v) -> bool
457 Summary:
458 define a new unit name
460 Description:
463 define defines the name and value of a user defined unit
465 Input Parameters:
466 name name of unit to define
467 v quantity value of new unit
469 Example:
472 #
473 print 't----t define Ex 1 t----'
474 print qa.define('JY','1Jy')# your misspelling
475 #True
476 print qa.define('VLAunit', '0.898 JY')# a special unit using it
477 #True
478 print qa.quantity('5 VLAunit') # check its use
479 #{'value': 5.0, 'unit': 'VLAunit'}
480 print qa.convert('5 VLAunit','Jy')
481 #{'value': 4.4900000000000002, 'unit': 'Jy'}
482 #
485 --------------------------------------------------------------------------------
487 """
488 return _quanta.quanta_define(self, *args, **kwargs)
491 def map(self, *args, **kwargs):
492 """
493 map(self, _v) -> string
497 Summary:
498 list known unit names and constants
500 Description:
503 map lists the known mapping of units and constants. It has a single argument,
504 which can be a coded string (no-case, minimax match):
505 begin{description}
506 item[all] all of the following units (not constants): also the default
507 item[Prefix] known decimal prefixes
508 item[SI] known SI units
509 item[Customary] a set of customary units known to programs
510 item[User] units defined by the user
511 item[Constants] known constants (note: only 'const', 'Const', 'constants'
512 and 'Constants' recognised).
513 end{description}
515 Input Parameters:
516 v type of information to list - coded string
518 Example:
521 #
522 print 't----t map Ex 1 t----'
523 print qa.map('pre')# list decimal prefixes
524 # == Prefix ==== 20 ====
525 # E (exa) 1e+18
526 # G (giga) 1000000000
527 # M (mega) 1000000
528 # P (peta) 1e+15
529 # T (tera) 1e+12
530 # Y (yotta) 1e+24
531 # Z (zetta) 1e+21
532 # a (atto) 1e-18
533 # c (centi) 0.01
534 # d (deci) 0.1
535 # da (deka) 10
536 # f (femto) 1e-15
537 # h (hecto) 100
538 # k (kilo) 1000
539 # m (milli) 0.001
540 # n (nano) 1e-09
541 # p (pico) 1e-12
542 # u (micro) 1e-06
543 # y (yocto) 1e-24
544 # z (zepto) 1e-21
545 print qa.map('Constants')# list known constants
546 # == Constants ====
547 # pi 3.14.. 3.14159
548 # ee 2.71.. 2.71828
549 # c light vel. 2.99792e+08 m/s
550 # G grav. const 6.67259e-11 N.m2/kg2
551 # h Planck const 6.62608e-34 J.s
552 # HI HI line 1420.41 MHz
553 # R gas const 8.31451 J/K/mol
554 # NA Avogadro # 6.02214e+23 mol-1
555 # e electron charge 1.60218e-19 C
556 # mp proton mass 1.67262e-27 kg
557 # mp_me mp/me 1836.15
558 # mu0 permeability vac. 1.25664e-06 H/m
559 # eps0 permittivity vac. 1.60218e-19 C
560 # k Boltzmann const 1.38066e-23 J/K
561 # F Faraday const 96485.3 C/mol
562 # me electron mass 9.10939e-31 kg
563 # re electron radius 2.8179e-15 m
564 # a0 Bohr's radius 5.2918e-11 m
565 # R0 solar radius 6.9599e+08 m
566 # k2 IAU grav. const^2 0.000295912 AU3/d2/S0
567 #
570 --------------------------------------------------------------------------------
572 """
573 return _quanta.quanta_map(self, *args, **kwargs)
576 def maprec(self, *args, **kwargs):
577 """
578 maprec(self, _v) -> record *
582 Summary:
583 create record containing list of known unit names and constants
585 Description:
588 maprec returns a record with the known mapping of units and constants. It has a single argument,
589 which can be a coded string (no-case, minimax match):
590 begin{description}
591 item[all] all of the following units (not constants): also the default
592 item[Prefix] known decimal prefixes
593 item[SI] known SI units
594 item[Customary] a set of customary units known to programs
595 item[User] units defined by the user
596 end{description}
598 Input Parameters:
599 v type of information to list - coded string
601 Example:
604 #
605 print 't----t maprec Ex 1 t----'
606 p = qa.maprec('pre')# list decimal prefixes
607 print p['Prefix_G']
608 # G (giga) 1000000000
609 s = qa.maprec('SI') # list SI units
610 print s['SI_Jy']
611 #Jy (jansky) 1e-26 kg.s-2
612 #
615 --------------------------------------------------------------------------------
617 """
618 return _quanta.quanta_maprec(self, *args, **kwargs)
621 def fits(self):
622 """
623 fits(self) -> bool
627 Summary:
628 define some FITS units
630 Description:
633 fits defines some unit names used in reading and writing FITS files.
635 Example:
638 #
639 print 't----t fits Ex 1 t----'
640 print qa.fits()
641 #True
642 print qa.map('user')
643 # == User ====
644 # BEAM (dimensionless beam) 1 _
645 # DAYS (day) 86400 s
646 # DEG (degree) 0.0174532925199 rad
647 # DEGREES (degree) 0.0174532925199 rad
648 # HZ (hertz) 1 s-1
649 # JY (jansky) 1e-26 kg.s-2
650 # KELVIN (kelvin) 1 K
651 # KELVINS (kelvin) 1 K
652 # KM (km) 1000 m
653 # M (meter) 1 m
654 # METERS (meter) 1 m
655 # PASCAL (pascal) 1 m-1.kg.s-2
656 # PIXEL (dimensionless pixel) 1 _
657 # S (second) 1 s
658 # SEC (second) 1 s
659 # SECONDS (second) 1 s
660 # VOLTS (volt) 1 m2.kg.s-3.A-1
661 # YEAR (year) 31557600 s
662 # YEARS (year) 31557600 s
663 #
666 --------------------------------------------------------------------------------
668 """
669 return _quanta.quanta_fits(self)
672 def angle(self, *args, **kwargs):
673 """
674 angle(self, _v, _prec, _form, _showform) -> std::vector< std::string >
678 Summary:
679 show an angle as a formatted string
681 Description:
684 angle converts an angle quantity to a formatted string. The formatting
685 information is a precision (0 is default, 6 includes +-ddd.mm.ss) and a
686 string array of codes (no-case, minimax match):
687 Codes include:
688 begin{description}
689 item[clean] delete leading/trailing superfluous separators
690 item[no_d] do not show degrees part
691 item[no_dm] do not show degrees and minutes part
692 item[dig2] show only 2 digits of degrees in angle format
693 item[time] show as time (hh:mm:ss.ttt) rather than as angle
694 end{description}
695 If a multi-dimensional value is given for the value $v$, the returned value
696 is a string vector of a length equal to last dimension. Each string has a
697 number of fields equal to the number of elements in all earlier
698 dimensions. If the {em showform} is $T$, each vector element is surrounded
699 by a pair of square brackets if there is more than one entry, and fields are
700 separated by a ','.
702 Input Parameters:
703 v angle quantity value to output
704 prec number of digits shown
705 form formatting information in coded string array
706 showform show square brackets and separating ,
708 Example:
711 #
712 print 't----t angle Ex 1 t----'
713 tu = qa.quantity('5.7.12.345678')# define an angle
714 print tu
715 #{'value': 5.1200960216666669, 'unit': 'deg'}
716 print qa.angle(tu) # default output
717 #+005.07.12
718 print qa.angle(tu, prec=7)# 7 digits
719 #+005.07.12.3
720 print qa.angle(tu, prec=4)# 4 digits
721 #+005.07.
722 print qa.angle(tu, form=['tim','no_d'])# as time, no hours shown
723 #:20:29
724 #
727 --------------------------------------------------------------------------------
729 """
730 return _quanta.quanta_angle(self, *args, **kwargs)
733 def time(self, *args, **kwargs):
734 """
735 time(self, _v, _prec, _form, _showform) -> std::vector< std::string >
739 Summary:
740 show a time (or date) as a formatted string
742 Description:
745 time converts a time quantity to a formatted string. The formatting
746 information is a precision (0 is default, 6 includes hh.mm.ss) and a
747 string array of codes (no-case, minimax match):
748 Codes include:
749 begin{description}
750 item[clean] delete leading/trailing superfluous separators
751 item[no_d] do not show hours part
752 item[no_dm] do not show hours and minutes part
753 item[ymd] include a date as yyyy/mm/dd (date is by default not shown)
754 item[dmy] include a date as ddMMMyyyy (date is by default not shown)
755 item[mjd] include a date as Modified Julian Day (date is by default not shown)
756 item[fits] include a date and show time in FITS format: le from OS
757 item[angle] show in angle (dd.mm.ss.ttt) rather than time format
758 item[day] prefix day-of-week to output
759 item[local] show local time rather than UTC (add timezone offset)
760 item[no_time] suppress printing of time part
761 end{description}
762 If a multi-dimensional value is given for the value $v$, the returned value
763 is a string vector of a length equal to last dimension. Each string has a
764 number of fields equal to the number of elements in all earlier
765 dimensions. If the {em showform} is $T$, each vector element is surrounded
766 by a pair of square brackets if there is more than one entry, and fields are
767 separated by a ','.
769 Input Parameters:
770 v time quantity value to output
771 prec number of digits shown
772 form formatting information in coded string array
773 showform show square brackets and separating ,
775 Example:
778 #
779 print 't----t time Ex 1 t----'
780 tu = qa.quantity('today')# a time
781 print tu
782 #{'value': 54175.708981504627, 'unit': 'd'}
783 print qa.time(tu)# default format
784 #17:00:56
785 print qa.time(tu,form='dmy') # show date
786 #16-Mar-2007/17:00:56
787 print qa.time(tu,form=['ymd','day'])# and day
788 #Fri-2007/03/16/17:00:56
789 print qa.time(tu,form='fits') # FITS format
790 #2007-03-16T17:00:56
791 print qa.time(tu,form=['fits','local']) # local FITS format
792 #2007-03-16T10:00:56-07:00
793 print qa.time(tu,form=['ymd','local']) # local time
794 #2007/03/16/10:00:56
795 #
798 --------------------------------------------------------------------------------
800 """
801 return _quanta.quanta_time(self, *args, **kwargs)
804 def add(self, *args, **kwargs):
805 """
806 add(self, _v, _a) -> record *
810 Summary:
811 add quantities
813 Description:
816 add adds two quantities
818 Input Parameters:
819 v value
820 a value
822 Example:
825 #
826 print 't----t add Ex 1 t----'
827 print qa.add('5m', '2yd')
828 #{'value': 6.8288000000000002, 'unit': 'm'}
829 #
832 --------------------------------------------------------------------------------
834 """
835 return _quanta.quanta_add(self, *args, **kwargs)
838 def sub(self, *args, **kwargs):
839 """
840 sub(self, _v, _a) -> record *
844 Summary:
845 subtract quantities
847 Description:
850 sub subtracts two quantities
852 Input Parameters:
853 v value
854 a value
856 Example:
859 #
860 print 't----t sub Ex 1 t----'
861 print qa.sub('5m', '2yd')
862 #{'value': 3.1712000000000002, 'unit': 'm'}
863 #
866 --------------------------------------------------------------------------------
868 """
869 return _quanta.quanta_sub(self, *args, **kwargs)
872 def mul(self, *args, **kwargs):
873 """
874 mul(self, _v, _a) -> record *
878 Summary:
879 multiply quantities
881 Description:
884 mul multiplies two quantities
886 Input Parameters:
887 v value
888 a value
890 Example:
893 #
894 print 't----t mul Ex 1 t----'
895 print qa.mul('5m', '3s')
896 #{'value': 15.0, 'unit': 'm.s'}
897 #
900 --------------------------------------------------------------------------------
902 """
903 return _quanta.quanta_mul(self, *args, **kwargs)
906 def div(self, *args, **kwargs):
907 """
908 div(self, _v, _a) -> record *
912 Summary:
913 divides quantities
915 Description:
918 div divides two quantities
920 Input Parameters:
921 v value
922 a value
924 Example:
927 #
928 print 't----t div Ex 1 t----'
929 print qa.div('5m', '3s')
930 #{'value': 1.6666666666666667, 'unit': 'm/(s)'}
931 #
934 --------------------------------------------------------------------------------
936 """
937 return _quanta.quanta_div(self, *args, **kwargs)
940 def neg(self, *args, **kwargs):
941 """
942 neg(self, _v) -> record *
946 Summary:
947 negate quantities
949 Description:
952 neg negates a quantity
954 Input Parameters:
955 v value
957 Example:
960 #
961 print 't----t neg Ex 1 t----'
962 print qa.neg('5m')
963 #{'value': -5.0, 'unit': 'm'}
964 #
967 --------------------------------------------------------------------------------
969 """
970 return _quanta.quanta_neg(self, *args, **kwargs)
973 def norm(self, *args, **kwargs):
974 """
975 norm(self, _v, _a) -> record *
979 Summary:
980 normalise angle
982 Description:
985 norm normalise angles in interval of $2pi$ radians. The default interval is
986 from -0.5 to +0.5 of a full interval (i.e. from -180 to +180 degrees). The
987 lower end of the interval can be set as a fraction of $2pi$
989 Input Parameters:
990 v angle quantity
991 a lower interval boundary
993 Example:
996 #
997 print 't----t norm Ex 1 t----'
998 print qa.norm('713deg')#default normalisation
999 #{'value': -6.9999999999999716, 'unit': 'deg'}
1000 print qa.norm('713deg', -2.5) # normalise to interval -900 - -540 deg
1001 #{'value': -727.0, 'unit': 'deg'}
1002 #
1005 --------------------------------------------------------------------------------
1007 """
1008 return _quanta.quanta_norm(self, *args, **kwargs)
1011 def le(self, *args, **kwargs):
1012 """
1013 le(self, _v, _a) -> bool
1017 Summary:
1018 compare quantities
1020 Description:
1023 le compares two quantities for less than or equal.
1025 Input Parameters:
1026 v value
1027 a value
1029 Example:
1032 #
1033 print 't----t le Ex 1 t----'
1034 print qa.le('5m', '2yd')
1035 #False
1036 #
1039 --------------------------------------------------------------------------------
1041 """
1042 return _quanta.quanta_le(self, *args, **kwargs)
1045 def lt(self, *args, **kwargs):
1046 """
1047 lt(self, _v, _a) -> bool
1051 Summary:
1052 compare quantities
1054 Description:
1057 lt compares two quantities for less than.
1059 Input Parameters:
1060 v value
1061 a value
1063 Example:
1066 #
1067 print 't----t lt Ex 1 t----'
1068 print qa.lt('5m', '2yd')
1069 #False
1070 #
1073 --------------------------------------------------------------------------------
1075 """
1076 return _quanta.quanta_lt(self, *args, **kwargs)
1079 def eq(self, *args, **kwargs):
1080 """
1081 eq(self, _v, _a) -> bool
1085 Summary:
1086 compare quantities
1088 Description:
1091 eq compares two quantities for equality.
1093 Input Parameters:
1094 v value
1095 a value
1097 Example:
1100 #
1101 print 't----t eq Ex 1 t----'
1102 print qa.eq('5m', '2yd')
1103 #False
1104 #
1107 --------------------------------------------------------------------------------
1109 """
1110 return _quanta.quanta_eq(self, *args, **kwargs)
1113 def ne(self, *args, **kwargs):
1114 """
1115 ne(self, _v, _a) -> bool
1119 Summary:
1120 compare quantities
1122 Description:
1125 ne compares two quantities for non equality.
1127 Input Parameters:
1128 v value
1129 a value
1131 Example:
1134 #
1135 print 't----t ne Ex 1 t----'
1136 print qa.ne('5m', '2yd')
1137 #True
1138 #
1141 --------------------------------------------------------------------------------
1143 """
1144 return _quanta.quanta_ne(self, *args, **kwargs)
1147 def gt(self, *args, **kwargs):
1148 """
1149 gt(self, _v, _a) -> bool
1153 Summary:
1154 compare quantities
1156 Description:
1159 gt compares two quantities for greater than.
1161 Input Parameters:
1162 v value
1163 a value
1165 Example:
1168 #
1169 print 't----t gt Ex 1 t----'
1170 print qa.gt('5m', '2yd')
1171 #True
1172 #
1175 --------------------------------------------------------------------------------
1177 """
1178 return _quanta.quanta_gt(self, *args, **kwargs)
1181 def ge(self, *args, **kwargs):
1182 """
1183 ge(self, _v, _a) -> bool
1187 Summary:
1188 compare quantities
1190 Description:
1193 ge compares two quantities for greater than or equal.
1195 Input Parameters:
1196 v value
1197 a value
1199 Example:
1202 #
1203 print 't----t ge Ex 1 t----'
1204 print qa.ge('5m', '2yd')
1205 #True
1206 #
1209 --------------------------------------------------------------------------------
1211 """
1212 return _quanta.quanta_ge(self, *args, **kwargs)
1215 def sin(self, *args, **kwargs):
1216 """
1217 sin(self, _v) -> record *
1221 Summary:
1222 sine of quantity
1224 Description:
1227 sin gives sine of angle quantity
1229 Input Parameters:
1230 v angle quantity
1232 Example:
1235 #
1236 print 't----t sin Ex 1 t----'
1237 print qa.sin('7deg')
1238 #{'value': 0.12186934340514748, 'unit': ''}
1239 #
1242 --------------------------------------------------------------------------------
1244 """
1245 return _quanta.quanta_sin(self, *args, **kwargs)
1248 def cos(self, *args, **kwargs):
1249 """
1250 cos(self, _v) -> record *
1254 Summary:
1255 cosine of quantity
1257 Description:
1260 cos gives cosine of angle quantity
1262 Input Parameters:
1263 v angle quantity
1265 Example:
1268 #
1269 print 't----t cos Ex 1 t----'
1270 print qa.cos('7deg')
1271 #{'value': 0.99254615164132198, 'unit': ''}
1272 #
1275 --------------------------------------------------------------------------------
1277 """
1278 return _quanta.quanta_cos(self, *args, **kwargs)
1281 def tan(self, *args, **kwargs):
1282 """
1283 tan(self, _v) -> record *
1287 Summary:
1288 tangent of quantity
1290 Description:
1293 tan gives tangent of angle quantity
1295 Input Parameters:
1296 v angle quantity
1298 Example:
1301 #
1302 print 't----t tan Ex 1 t----'
1303 print qa.tan('7deg')
1304 #{'value': 0.1227845609029046, 'unit': ''}
1305 #
1308 --------------------------------------------------------------------------------
1310 """
1311 return _quanta.quanta_tan(self, *args, **kwargs)
1314 def asin(self, *args, **kwargs):
1315 """
1316 asin(self, _v) -> record *
1320 Summary:
1321 arcsine of quantity
1323 Description:
1326 asin gives arcsine of non-dimensioned quantity
1328 Input Parameters:
1329 v non-dimensioned quantity
1331 Example:
1334 #
1335 print 't----t asin Ex 1 t----'
1336 print qa.convert(qa.asin(qa.sin('7deg')), 'deg')
1337 #{'value': 7.0, 'unit': 'deg'}
1338 #
1341 --------------------------------------------------------------------------------
1343 """
1344 return _quanta.quanta_asin(self, *args, **kwargs)
1347 def acos(self, *args, **kwargs):
1348 """
1349 acos(self, _v) -> record *
1353 Summary:
1354 arccosine of quantity
1356 Description:
1359 acos gives arccosine of non-dimensioned quantity
1361 Input Parameters:
1362 v non-dimensioned quantity
1364 Example:
1367 #
1368 print 't----t acos Ex 1 t----'
1369 print qa.convert(qa.acos(qa.cos('7deg')), 'deg')
1370 #{'value': 7.0000000000000249, 'unit': 'deg'}
1371 #
1374 --------------------------------------------------------------------------------
1376 """
1377 return _quanta.quanta_acos(self, *args, **kwargs)
1380 def atan(self, *args, **kwargs):
1381 """
1382 atan(self, _v) -> record *
1386 Summary:
1387 arctangent of quantity
1389 Description:
1392 atan gives arctangent of non-dimensioned quantity
1394 Input Parameters:
1395 v non-dimensioned quantity
1397 Example:
1400 #
1401 print 't----t atan Ex 1 t----'
1402 print qa.convert(qa.atan(qa.tan('7deg')), 'deg')
1403 #{'value': 7.0, 'unit': 'deg'}
1404 #
1407 --------------------------------------------------------------------------------
1409 """
1410 return _quanta.quanta_atan(self, *args, **kwargs)
1413 def atan2(self, *args, **kwargs):
1414 """
1415 atan2(self, _v, _a) -> record *
1419 Summary:
1420 arctangent of two quantity
1422 Description:
1425 atan gives arctangent of two non-dimensioned quantity
1427 Input Parameters:
1428 v non-dimensioned quantity
1429 a non-dimensioned quantity
1431 Example:
1434 #
1435 print 't----t atan2 Ex 1 t----'
1436 print qa.convert(qa.atan2(qa.sin('7deg'), qa.cos('7deg')), 'deg')
1437 #{'value': 7.0, 'unit': 'deg'}
1438 #
1441 --------------------------------------------------------------------------------
1443 """
1444 return _quanta.quanta_atan2(self, *args, **kwargs)
1447 def abs(self, *args, **kwargs):
1448 """
1449 abs(self, _v) -> record *
1453 Summary:
1454 absolute value of quantity
1456 Description:
1459 abs gives absolute value of quantity
1461 Input Parameters:
1462 v value
1464 Example:
1467 #
1468 print 't----t abs Ex 1 t----'
1469 print qa.abs('-5km/s')
1470 #{'value': 5.0, 'unit': 'km/s'}
1471 #
1474 --------------------------------------------------------------------------------
1476 """
1477 return _quanta.quanta_abs(self, *args, **kwargs)
1480 def ceil(self, *args, **kwargs):
1481 """
1482 ceil(self, _v) -> record *
1486 Summary:
1487 ceil value of quantity
1489 Description:
1492 ceil gives ceiling value of quantity
1494 Input Parameters:
1495 v value
1497 Example:
1500 #
1501 print 't----t ceil Ex 1 t----'
1502 print qa.ceil('5.1AU')
1503 #{'value': 6.0, 'unit': 'AU'}
1504 #
1507 --------------------------------------------------------------------------------
1509 """
1510 return _quanta.quanta_ceil(self, *args, **kwargs)
1513 def floor(self, *args, **kwargs):
1514 """
1515 floor(self, _v) -> record *
1519 Summary:
1520 floor value of quantity
1522 Description:
1525 floor gives flooring value of quantity
1527 Input Parameters:
1528 v value
1530 Example:
1533 #
1534 print 't----t floor Ex 1 t----'
1535 print qa.floor('-5.1AU')
1536 #{'value': -6.0, 'unit': 'AU'}
1537 #
1540 --------------------------------------------------------------------------------
1542 """
1543 return _quanta.quanta_floor(self, *args, **kwargs)
1546 def log(self, *args, **kwargs):
1547 """
1548 log(self, _v) -> record *
1552 Summary:
1553 logarithm of quantity
1555 Description:
1558 log gives natural logarithm of dimensionless quantity
1560 Input Parameters:
1561 v dimensionless quantity
1563 Example:
1566 #
1567 print 't----t log Ex 1 t----'
1568 print qa.log('2')
1569 #{'value': 0.69314718055994529, 'unit': ''}
1570 #
1573 --------------------------------------------------------------------------------
1575 """
1576 return _quanta.quanta_log(self, *args, **kwargs)
1579 def log10(self, *args, **kwargs):
1580 """
1581 log10(self, _v) -> record *
1585 Summary:
1586 logarithm of quantity
1588 Description:
1591 log10 gives logarithm of dimensionless quantity
1593 Input Parameters:
1594 v dimensionless quantity
1596 Example:
1599 #
1600 print 't----t log10 Ex 1 t----'
1601 print qa.log10('2')
1602 #{'value': 0.3010299956639812, 'unit': ''}
1603 #
1606 --------------------------------------------------------------------------------
1608 """
1609 return _quanta.quanta_log10(self, *args, **kwargs)
1612 def exp(self, *args, **kwargs):
1613 """
1614 exp(self, _v) -> record *
1618 Summary:
1619 exponential of quantity
1621 Description:
1624 exp gives exponential value of dimensionless quantity
1626 Input Parameters:
1627 v dimensionless quantity
1629 Example:
1632 #
1633 print 't----t exp Ex 1 t----'
1634 print qa.exp('2')
1635 #{'value': 7.3890560989306504, 'unit': ''}
1636 try:
1637 print qa.exp('2m')
1638 except Exception, e:
1639 print 'Caught an expected exception', e
1640 #Caught an expected exception Quantum::exp illegal unit type 'm'
1641 #
1644 --------------------------------------------------------------------------------
1646 """
1647 return _quanta.quanta_exp(self, *args, **kwargs)
1650 def sqrt(self, *args, **kwargs):
1651 """
1652 sqrt(self, _v) -> record *
1656 Summary:
1657 square root of quantity
1659 Description:
1662 sqrt gives square root of quantity with only even powered dimensions
1664 Input Parameters:
1665 v dimensionless quantity
1667 Example:
1670 #
1671 print 't----t sqrt Ex 1 t----'
1672 print qa.sqrt('2m2')
1673 #{'value': 1.4142135623730951, 'unit': 'm'}
1674 try:
1675 print qa.sqrt('2s')
1676 except Exception, e:
1677 print 'Caught an expected exception', e
1678 #Caught an expected exception UnitVal::UnitVal Illegal unit dimensions for root
1679 #
1682 --------------------------------------------------------------------------------
1684 """
1685 return _quanta.quanta_sqrt(self, *args, **kwargs)
1688 def compare(self, *args, **kwargs):
1689 """
1690 compare(self, _v, _a) -> bool
1694 Summary:
1695 compare dimensionality of units
1697 Description:
1700 compare compares the dimensionality of units of two qauntities
1702 Input Parameters:
1703 v value
1704 a value
1706 Example:
1709 #
1710 print 't----t compare Ex 1 t----'
1711 print qa.compare('5yd/a', '6m/s') # equal dimensions
1712 #True
1713 print qa.compare('5yd', '5s')# unequal dimensions
1714 #False
1715 #
1718 --------------------------------------------------------------------------------
1720 """
1721 return _quanta.quanta_compare(self, *args, **kwargs)
1724 def check(self, *args, **kwargs):
1725 """
1726 check(self, _v) -> bool
1730 Summary:
1731 check for proper unit string
1733 Description:
1736 check checks if the argument has a properly defined unit string
1738 Input Parameters:
1739 v value
1741 Example:
1744 #
1745 print 't----t check Ex 1 t----'
1746 print qa.check('5AE/Jy.pc5/s')
1747 #True
1748 print qa.check('7MYs')
1749 #False
1750 #
1753 --------------------------------------------------------------------------------
1755 """
1756 return _quanta.quanta_check(self, *args, **kwargs)
1759 def checkfreq(self, *args, **kwargs):
1760 """
1761 checkfreq(self, _cm) -> bool
1765 Summary:
1766 check for proper frequency unit
1768 Description:
1771 checkfreq checks if the argument has a properly defined frequency interpretable
1772 unit string
1774 Input Parameters:
1775 cm value
1777 Example:
1780 #
1781 print 't----t checkfreq Ex 1 t----'
1782 print qa.checkfreq('5GHz')
1783 #True
1784 print qa.checkfreq('5cm')
1785 #True
1786 print qa.checkfreq('5cm/s2')
1787 #False
1788 #
1791 --------------------------------------------------------------------------------
1793 """
1794 return _quanta.quanta_checkfreq(self, *args, **kwargs)
1797 def pow(self, *args, **kwargs):
1798 """
1799 pow(self, _v, _a) -> record *
1803 Summary:
1804 raise quantity to power
1806 Description:
1809 pow raises a quantity to an integer power
1811 Input Parameters:
1812 v value
1813 a power
1815 Example:
1818 #
1819 print 't----t pow Ex 1 t----'
1820 print qa.pow('7.2km/s', -3)
1821 #{'value': 0.0026791838134430724, 'unit': '(km/s)-3'}
1822 #
1825 --------------------------------------------------------------------------------
1827 """
1828 return _quanta.quanta_pow(self, *args, **kwargs)
1831 def constants(self, *args, **kwargs):
1832 """
1833 constants(self, _v) -> record *
1837 Summary:
1838 get a constant
1840 Description:
1843 constants gets a named constant quantity. Names (no-case, minimax) are:
1845 pi 3.14.. 3.14159
1846 ee 2.71.. 2.71828
1847 c light vel. 2.99792e+08 m/s
1848 G grav. const 6.67259e-11 N.m2/kg2
1849 h Planck const 6.62608e-34 J.s
1850 HI HI line 1420.41 MHz
1851 R gas const 8.31451 J/K/mol
1852 NA Avogadro number 6.02214e+23 mol-1
1853 e electron charge 1.60218e-19 C
1854 mp proton mass 1.67262e-27 kg
1855 mp_me mp/me 1836.15
1856 mu0 permeability vac. 1.25664e-06 H/m
1857 eps0 permittivity vac. 1.60218e-19 C
1858 k Boltzmann const 1.38066e-23 J/K
1859 F Faraday const 96485.3 C/mol
1860 me electron mass 9.10939e-31 kg
1861 re electron radius 2.8179e-15 m
1862 a0 Bohr's radius 5.2918e-11 m
1863 R0 solar radius 6.9599e+08 m
1864 k2 IAU grav. const^2 0.000295912 AU3/d2/S0
1866 Input Parameters:
1867 v name
1869 Example:
1872 #
1873 print 't----t constants Ex 1 t----'
1874 print qa.constants()
1875 #{'unit': '', 'value': 3.1415926535897931}
1876 #
1879 --------------------------------------------------------------------------------
1881 """
1882 return _quanta.quanta_constants(self, *args, **kwargs)
1885 def isangle(self, *args, **kwargs):
1886 """
1887 isangle(self, _v) -> bool
1891 Summary:
1892 check if valid angle or time quantity
1894 Description:
1897 isangle checks if the argument is a valid angle/time quantity.
1899 Input Parameters:
1900 v angle/time quantity
1902 Example:
1905 #
1906 print 't----t isangle Ex 1 t----'
1907 print qa.isangle(qa.constants('pi'))
1908 #False
1909 #
1912 --------------------------------------------------------------------------------
1914 """
1915 return _quanta.quanta_isangle(self, *args, **kwargs)
1918 def totime(self, *args, **kwargs):
1919 """
1920 totime(self, _v) -> record *
1924 Summary:
1925 convert an angle (or a time) to a time
1927 Description:
1930 totime converts an angle quantity (or a time) to a time quantity
1932 Input Parameters:
1933 v angle/time quantity
1935 Example:
1938 #
1939 print 't----t totime Ex 1 t----'
1940 print qa.totime('2d5m')
1941 #{'value': 0.0057870370370370376, 'unit': 'd'}
1942 #
1945 --------------------------------------------------------------------------------
1947 """
1948 return _quanta.quanta_totime(self, *args, **kwargs)
1951 def toangle(self, *args, **kwargs):
1952 """
1953 toangle(self, _v) -> record *
1957 Summary:
1958 convert a time (or an angle) to an angle
1960 Description:
1963 toangle converts a time quantity (or an angle) to an angle quantity
1965 Input Parameters:
1966 v angle/time quantity
1968 Example:
1971 #
1972 print 't----t toangle Ex 1 t----'
1973 print qa.toangle('5h30m12.6')
1974 #{'value': 82.552499999999995, 'unit': 'deg'}
1975 #
1978 --------------------------------------------------------------------------------
1980 """
1981 return _quanta.quanta_toangle(self, *args, **kwargs)
1984 def splitdate(self, *args, **kwargs):
1985 """
1986 splitdate(self, _v) -> record *
1990 Summary:
1991 split a date/time into a record
1993 Description:
1996 splitdate splits a date/time quantity into a record with constituent fields
1997 like year, yearday, month etc. All fields will be integer (to enable use as
1998 index and easy personal formatting), with the exception of the {em s} field
1999 which is a double float. See the example for the fields returned.
2001 Input Parameters:
2002 v angle/time quantity
2004 Example:
2007 #
2008 print 't----t splitdate Ex 1 t----'
2009 print qa.splitdate('today')
2011 #{'mjd': 54175.752367291658, 'week': 11, 'usec': 533999, 'hour': 18,
2012 # 'min': 3, 'yearday': 75, 'msec': 533, 'month': 3, 's':
2013 # 24.533999226987362, 'sec': 24, 'weekday': 5, 'year': 2007, 'monthday':
2014 # 16} print qa.splitdate('183.33333333deg')
2015 #{'mjd': 0.50925925925000004, 'week': 46, 'usec': 999999, 'hour': 12,
2016 # 'min': 13, 'yearday': 321, 'msec': 999, 'month': 11, 's':
2017 # 19.999999200003487, 'sec': 19, 'weekday': 3, 'year': 1858,
2018 # 'monthday': 17}
2019 #
2022 --------------------------------------------------------------------------------
2024 """
2025 return _quanta.quanta_splitdate(self, *args, **kwargs)
2028 def tos(self, *args, **kwargs):
2029 """
2030 tos(self, _v, _prec) -> string
2034 Summary:
2035 convert quantity to string
2037 Description:
2040 tos converts a quantity to a string with the precision defined with
2041 the {em setformat('prec')} (which defaults to 9). If the optional
2042 {em prec} argument is set to an integer value greater than 1, that
2043 precision is used in the conversion
2045 Input Parameters:
2046 v value
2047 prec convert precision of value
2049 Example:
2052 #
2053 print 't----t tos Ex 1 t----'
2054 a = qa.quantity('2.56 yd/s')
2055 print a
2056 #{'value': 2.5600000000000001, 'unit': 'yd/s'}
2057 print qa.tos(a)
2058 #2.560000000yd/s
2059 a=qa.quantity(1./7, 'km/s')
2060 print qa.tos(a)
2061 #0.142857143km/s
2062 print qa.tos(a,2)
2063 #0.14km/s
2064 print qa.tos(a,20)
2065 #0.14285714285714284921km/s
2066 print qa.tos(a)
2067 #0.142857143km/s
2068 #
2071 --------------------------------------------------------------------------------
2073 """
2074 return _quanta.quanta_tos(self, *args, **kwargs)
2077 def type(self):
2078 """
2079 type(self) -> string
2083 Summary:
2084 type of tool
2086 Description:
2089 type will return the tool name.
2091 Example:
2094 #
2095 print 't----t type Ex 1 t----'
2096 print qa.type()
2097 #quanta
2098 #
2101 --------------------------------------------------------------------------------
2103 """
2104 return _quanta.quanta_type(self)
2107 def done(self, *args, **kwargs):
2108 """
2109 done(self, _kill) -> bool
2113 Summary:
2114 Free resources used by tool. Current implementation ignores input parameter, does nothing and returns true
2116 Description:
2119 Currently, this method is an NOP.
2121 Input Parameters:
2122 kill force kill of the default tool (ignored)
2124 Example:
2127 #
2128 print 't----t done Ex 1 t----'
2129 print qa.done()
2130 #True
2131 print qa.done()
2132 #True
2133 print qa.done(kill=T)
2134 #True
2135 #
2138 --------------------------------------------------------------------------------
2140 """
2141 return _quanta.quanta_done(self, *args, **kwargs)
2144 def unit(self, *args, **kwargs):
2145 """
2146 unit(self, _v, _unitname, _keepshape) -> record *
2150 Summary:
2151 quantity from value v and unit string
2153 Description:
2156 unit makes a quantity from a string, or from a value and a string.
2157 Note that unit is a synonym for quantity (see description and example there).
2159 Input Parameters:
2160 v
2161 unitname
2162 keepshape
2164 --------------------------------------------------------------------------------
2166 """
2167 return _quanta.quanta_unit(self, *args, **kwargs)
2170 def isquantity(self, *args, **kwargs):
2171 """
2172 isquantity(self, _v) -> bool
2176 Summary:
2177 Check if quantity
2179 Description:
2182 Checks if the operand is a correct quantity
2184 Input Parameters:
2185 v value to be tested
2187 Example:
2190 #
2191 print 't----t isQuantity Ex 1 t----'
2192 a = qa.quantity('5Jy') # make a quantity
2193 print a
2194 #{'value': 5.0, 'unit': 'Jy'}
2195 print qa.isquantity(a) # is it one?
2196 #True
2197 print qa.isquantity('5Jy') # and this string?
2198 #True
2199 #
2202 --------------------------------------------------------------------------------
2204 """
2205 return _quanta.quanta_isquantity(self, *args, **kwargs)
2208 def setformat(self, *args, **kwargs):
2209 """
2210 setformat(self, _t, _v) -> bool
2214 Summary:
2215 set format for output of numbers. (NOT IMPLEMENTED YET!)
2217 Input Parameters:
2218 t type -coded string indicating which format parameter to set
2219 v format parameter value - numeric or coded string, depending on format type to be set
2221 --------------------------------------------------------------------------------
2223 """
2224 return _quanta.quanta_setformat(self, *args, **kwargs)
2227 def getformat(self, *args, **kwargs):
2228 """
2229 getformat(self, _t) -> string
2233 Summary:
2234 get current output format (NOT IMPLEMENTED YET!)
2236 Description:
2239 getformat returns the current format value set for the different
2240 format possibilities. See the
2241 setformat function for the
2242 different format type descriptions. The known types are:
2243 prec, aprec, tprec, long, lat, len, dtime, elev, auto, vel, freq,
2244 dop, unit.
2246 Input Parameters:
2247 t type - coded string
2249 Example:
2252 #
2253 print 't----t getformat Ex 1 t----'
2254 print qa.getformat('prec')
2255 #6
2256 #setformat is NOT IMPLEMENTED YET!
2257 #qa.setformat('prec', 12)# set precision to 12 significant digits
2258 #T
2259 #print qa.getformat('prec')
2260 #12
2261 print qa.getformat('long')
2262 #hms
2263 #
2266 --------------------------------------------------------------------------------
2268 """
2269 return _quanta.quanta_getformat(self, *args, **kwargs)
2272 def formxxx(self, *args, **kwargs):
2273 """
2274 formxxx(self, _v, _format, _prec) -> string
2278 Summary:
2279 Format a quantity using given format, allowed are hms, dms, deg, rad, +deg.
2281 Description:
2284 form.xxx (xxx can be lat, long, len, vel, freq, dtime, unit) will format the
2285 input into a string using the global format information set by setformat().
2287 Input Parameters:
2288 v value to be converted
2289 format xxx can be hms, dms, deg, rad or +deg
2290 prec digits in fractional part of output string for dms,hms
2292 Example:
2295 #
2296 print 't----t formxxx Ex 1 t----'
2297 #qa.setformat('freq','cm')
2298 #T
2299 #qa.formxxx('freq',qa.quantity('5GHz'))
2300 #form_xxx NOT IMPLEMENTED YET!
2301 #5.99584916 cm
2302 print 'Last example, exiting! ...'
2303 exit()
2304 #
2307 --------------------------------------------------------------------------------
2309 """
2310 return _quanta.quanta_formxxx(self, *args, **kwargs)
2312 __swig_destroy__ = _quanta.delete_quanta
2313 __del__ = lambda self: None
2314quanta_swigregister = _quanta.quanta_swigregister
2315quanta_swigregister(quanta)
2317# This file is compatible with both classic and new-style classes.