Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/__casac__/measures.py: 58%
201 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:53 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:53 +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, '_measures')).lstrip('.')
13 try:
14 return importlib.import_module(mname)
15 except ImportError:
16 return importlib.import_module('_measures')
17 _measures = 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('_measures', [dirname(__file__)])
26 except ImportError:
27 import _measures
28 return _measures
29 try:
30 _mod = imp.load_module('_measures', fp, pathname, description)
31 finally:
32 if fp is not None:
33 fp.close()
34 return _mod
35 _measures = swig_import_helper()
36 del swig_import_helper
37else:
38 import _measures
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 measures(_object):
99 """Proxy of C++ casac::measures class."""
101 __swig_setmethods__ = {}
102 __setattr__ = lambda self, name, value: _swig_setattr(self, measures, name, value)
103 __swig_getmethods__ = {}
104 __getattr__ = lambda self, name: _swig_getattr(self, measures, name)
105 __repr__ = _swig_repr
107 def __init__(self):
108 """__init__(self) -> measures"""
109 this = _measures.new_measures()
110 try:
111 self.this.append(this)
112 except __builtin__.Exception:
113 self.this = this
115 def dirshow(self, *args, **kwargs):
116 """
117 dirshow(self, _v) -> string
121 Summary:
122 Show direction measure as a string.
124 Description:
127 dirshow will convert a direction measure to a string
129 Input Parameters:
130 v a direction measure value to be converted to string
132 Example:
134 print 't----t dirshow Ex 1 t----'
135 print me.dirshow(me.direction('venus'))
136 #[0, 90] deg VENUS
138 --------------------------------------------------------------------------------
140 """
141 return _measures.measures_dirshow(self, *args, **kwargs)
144 def show(self, *args, **kwargs):
145 """
146 show(self, _v, _refcode) -> string
150 Summary:
151 Show a measure as a string
153 Description:
156 show will convert a measure to a string.
158 All measures are catered for (at this moment {em direction, position, epoch,
159 radialvelocity, frequency, doppler, baseline, uvw, earthmagnetic} ).
161 Input Parameters:
162 v measure value to be converted to string
163 refcode add the reference code to output
165 Example:
167 print 't----t show Ex 1 t----'
168 print me.show(me.frequency('lsrk', qa.constants('HI')))
169 #1.42041e+09 Hz LSRK
170 print me.show(me.frequency('lsrk', qa.constants('HI')), refcode=false)
171 #1.42041e+09 Hz
173 --------------------------------------------------------------------------------
175 """
176 return _measures.measures_show(self, *args, **kwargs)
179 def epoch(self, *args, **kwargs):
180 """
181 epoch(self, _rf, _v0, _off) -> record *
185 Summary:
186 define an epoch measure
188 Description:
191 epoch defines an epoch measure from the CLI. It has to specify a
192 reference code, an epoch quantity value (see introduction for the
193 action on a scalar quantity with either a vector or scalar value),
195 and optionally it can specify an offset, which in itself has to be an
196 epoch. Allowable reference codes are:
197 {em UTC TAI LAST LMST GMST1 GAST UT1 UT2 TDT TCG TDB TCB}.
198 Note that additional ones may become available. Check in casa with:
200 begin{verbatim}
201 print 't----t epoch Ex 1 t----'
202 print me.listcodes(me.epoch())
203 #{'normal': ['LAST', 'LMST', 'GMST1', 'GAST', 'UT1', 'UT2', 'UTC', 'TAI',
204 # 'TDT', 'TCG', 'TDB', 'TCB', 'IAT', 'GMST', 'TT', 'ET', 'UT'], 'extra': []}
205 #
206 end{verbatim}
208 See quantity for possible time formats.
210 Input Parameters:
211 rf reference code
212 v0 epoch value
213 off optional offset epoch measure
215 Example:
217 print 't----t epoch Ex 2 t----'
218 print me.epoch('utc','today')
219 #{'m0': {'value': 54048.861237743055, 'unit': 'd'},
220 # 'refer': 'UTC',
221 # 'type': 'epoch'}
223 --------------------------------------------------------------------------------
225 """
226 return _measures.measures_epoch(self, *args, **kwargs)
229 def direction(self, *args, **kwargs):
230 """
231 direction(self, _rf, _v0, _v1, _off) -> record *
235 Summary:
236 define a direction measure
238 Description:
241 direction defines a direction measure from the CLI. It has to specify a
242 reference code, direction quantity values (see introduction for the action on a
243 scalar quantity with either a vector or scalar value),
245 and optionally it can specify an
246 offset, which in itself has to be a direction. Allowable reference codes are:
247 {em J2000 JMEAN JTRUE APP B1950 BMEAN BTRUE GALACTIC HADEC AZEL
248 SUPERGAL ECLIPTIC MECLIPTIC TECLIPTIC MERCURY
249 VENUS MARS JUPITER SATURN URANUS NEPTUNE PLUTO MOON SUN COMET}.
250 Note that additional ones may become available. Check in casa with:
252 begin{verbatim}
253 print 't----t direction Ex 1 t----'
254 print me.listcodes(me.direction())
255 #{'normal': ['J2000', 'JMEAN', 'JTRUE', 'APP', 'B1950', 'BMEAN',
256 #'BTRUE', 'GALACTIC', 'HADEC', 'AZEL', 'AZELSW', 'AZELNE', 'AZELGEO',
257 #'AZELSWGEO', 'AZELNEGEO', 'JNAT', 'ECLIPTIC', 'MECLIPTIC',
258 #'TECLIPTIC', 'SUPERGAL', 'ITRF', 'TOPO', 'ICRS'], 'extra': ['MERCURY',
259 #'VENUS', 'MARS', 'JUPITER', 'SATURN', 'URANUS', 'NEPTUNE', 'PLUTO',
260 #'SUN', 'MOON', 'COMET']}
261 end{verbatim}
263 The direction quantity values should be longitude(angle) and
264 latitude(angle) (none needed for planets: the frame epoch defines coordinates).
265 See quantity for possible angle formats.
267 Input Parameters:
268 rf reference code
269 v0 longitude
270 v1 latitude
271 off optional offset direction measure
273 Example:
275 print 't----t direction Ex 2 t----'
276 print me.direction('j2000','30deg','40deg')
277 #{'m0': {'value': 0.52359877559829882, 'unit': 'rad'},
278 # 'm1': {'value': 0.69813170079773168, 'unit': 'rad'},
279 # 'refer': 'J2000',
280 # 'type': 'direction'}
281 #
282 print me.direction('mars')
283 #{'m0': {'value': 0.0, 'unit': 'rad'},
284 # 'm1': {'value': 1.5707963267948966, 'unit': 'rad'},
285 # 'refer': 'MARS',
286 # 'type': 'direction'}
288 --------------------------------------------------------------------------------
290 """
291 return _measures.measures_direction(self, *args, **kwargs)
294 def getvalue(self, *args, **kwargs):
295 """
296 getvalue(self, _v) -> record *
300 Summary:
301 get the value of a measure
303 Description:
306 getvalue gets the actual implementation value of the measure.
308 Input Parameters:
309 v measure (array of measures)
311 Example:
313 print 't----t getvalue Ex 1 t----'
314 b=me.direction('j2000','0deg','80deg')
315 print me.getvalue(b)
316 #{'m0': {'value': 0.0, 'unit': 'rad'},
317 # 'm1': {'value': 1.3962634015954634, 'unit': 'rad'}}
319 --------------------------------------------------------------------------------
321 """
322 return _measures.measures_getvalue(self, *args, **kwargs)
325 def gettype(self, *args, **kwargs):
326 """
327 gettype(self, _v) -> string
331 Summary:
332 get the type of a measure
334 Description:
337 gettype gets the actual type of the measure.
339 Input Parameters:
340 v measure (array of measures)
342 Example:
344 print 't----t gettype Ex 1 t----'
345 b=me.direction('j2000','0deg','80deg')
346 print me.getvalue(b)
347 #{'m0': {'value': 0.0, 'unit': 'rad'},
348 # 'm1': {'value': 1.3962634015954634, 'unit': 'rad'}}
349 print me.gettype(b)
350 #'Direction'
352 --------------------------------------------------------------------------------
354 """
355 return _measures.measures_gettype(self, *args, **kwargs)
358 def getref(self, *args, **kwargs):
359 """
360 getref(self, _v) -> string
364 Summary:
365 get the reference code of a measure
367 Description:
370 gettype gets the actual reference code of the measure.
372 Input Parameters:
373 v measure (array of measures)
375 Example:
377 print 't----t getref Ex 1 t----'
378 b=me.direction('j2000','0deg','80deg')
379 print me.getvalue(b)
380 #{'m0': {'value': 0.0, 'unit': 'rad'},
381 # 'm1': {'value': 1.3962634015954634, 'unit': 'rad'}}
382 print me.gettype(b)
383 #'Direction'
384 print me.getref(b)
385 #'J2000'
387 --------------------------------------------------------------------------------
389 """
390 return _measures.measures_getref(self, *args, **kwargs)
393 def getoffset(self, *args, **kwargs):
394 """
395 getoffset(self, _v) -> record *
399 Summary:
400 get the offset of a measure
402 Description:
405 getoff gets the actual offset of the measure (as a measure) or F if no offset
406 given.
408 Input Parameters:
409 v measure (array of measures)
411 Example:
413 print 't----t getoffset Ex 1 t----'
414 b=me.direction('j2000','0deg','80deg')
415 print me.getvalue(b)
416 #{'m0': {'value': 0.0, 'unit': 'rad'},
417 # 'm1': {'value': 1.3962634015954634, 'unit': 'rad'}}
418 print me.gettype(b)
419 #'Direction'
420 print me.getref(b)
421 #'J2000'
422 print me.getoffset(b)
423 #{}
425 --------------------------------------------------------------------------------
427 """
428 return _measures.measures_getoffset(self, *args, **kwargs)
431 def cometname(self):
432 """
433 cometname(self) -> string
437 Summary:
438 get the current comet name
440 Description:
443 cometname gets the name of the current comet (if any).
445 Example:
447 print 't----t cometname Ex 1 t----'
448 print me.cometname()
449 #Thu Nov 9 21:27:25 2006 WARN :
450 #Method cometname fails! No Comet table present
451 #''
453 --------------------------------------------------------------------------------
455 """
456 return _measures.measures_cometname(self)
459 def comettype(self):
460 """
461 comettype(self) -> string
465 Summary:
466 get the current comet table type
468 Description:
471 comettype gets the comet table type (apparent or topocentric)
473 Example:
475 print 't----t comettype Ex 1 t----'
476 print me.comettype()
477 # 'none'
479 --------------------------------------------------------------------------------
481 """
482 return _measures.measures_comettype(self)
485 def cometdist(self):
486 """
487 cometdist(self) -> record *
491 Summary:
492 get the distance of the current comet in the current frame
494 Description:
497 cometdist returns the distance in AU of the current comet in the current frame,
498 as a quantity. It will return -1 AU on failure!
501 Example:
503 print 't----t cometdist Ex 1 t----'
504 # Directory with several Solar System ephemerides for setjy.
505 cometdir = os.getenv('CASAPATH').split()[0] + '/data/ephemerides/JPL-Horizons/'
506 me.framecomet(cometdir + 'Ganymede_55438-56292dUTC.tab')
507 # Out[5]: True
508 me.doframe(me.epoch('utc', '2011/01/03/17:00:00'))
509 me.doframe(me.observatory('ALMA'))
510 gandist = me.cometdist()
511 print gandist
512 # {'value': 5.1241088343892631, 'unit': 'AU'}
514 --------------------------------------------------------------------------------
516 """
517 return _measures.measures_cometdist(self)
520 def cometangdiam(self):
521 """
522 cometangdiam(self) -> record *
526 Summary:
527 get the angular diameter of the current comet in the current frame
529 Description:
532 cometdist returns the angular diameter (as seen from Earth) in AU of the current
533 comet in the current frame, as a quantity. It will return -1 radians on failure!
536 Example:
538 print 't----t cometangdiam Ex 1 t----'
539 # Directory with several Solar System ephemerides for setjy.
540 cometdir = os.getenv('CASAPATH').split()[0] + '/data/ephemerides/JPL-Horizons/'
541 me.framecomet(cometdir + 'Ganymede_55438-56292dUTC.tab')
542 # Out[5]: True
543 me.doframe(me.epoch('utc', '2011/01/03/17:00:00'))
544 me.doframe(me.observatory('ALMA'))
545 gad = me.cometangdiam()
546 print gad
547 # {'unit': 'rad', 'value': 6.8679673431729014e-06}
549 --------------------------------------------------------------------------------
551 """
552 return _measures.measures_cometangdiam(self)
555 def comettopo(self):
556 """
557 comettopo(self) -> record *
561 Summary:
562 get the current comet table coordinates
564 Description:
567 comettopo gets the comet table's topographic coordinates used.
569 Example:
571 print 't----t comettopo Ex 1 t----'
572 print me.comettopo()
573 #Thu Nov 9 21:45:40 2006 WARN :
574 #Method comettopo fails! No Topocentric Comet table present
575 #{'value': [0.0], 'unit': ''}
577 --------------------------------------------------------------------------------
579 """
580 return _measures.measures_comettopo(self)
583 def framecomet(self, *args, **kwargs):
584 """
585 framecomet(self, _v) -> bool
589 Summary:
590 set the current comet table
592 Description:
595 framecomet will put the specified comet table in the frame.
597 Input Parameters:
598 v name of a table
600 Example:
602 print 't----t framecomet Ex 1 t----'
603 print me.framecomet('VGEO')
604 #True
605 print me.showframe()
606 #'Frame: VENUS comet between MJD 50802.7 and 50803.1'
607 print me.cometname()
608 #'VENUS'
609 print me.comettype()
610 #'APP'
611 print me.doframe(me.epoch('et',qa.quantity('1997/12/20/17:30:0')))
612 #True
613 print me.measure(me.direction('comet'),'app')
614 #{'m0': {'value': -0.94936485919663083, 'unit': 'rad'},
615 # 'm1': {'value': -0.34710256485894436, 'unit': 'rad'},
616 # 'refer': 'APP',
617 # 'type': 'direction'}
619 --------------------------------------------------------------------------------
621 """
622 return _measures.measures_framecomet(self, *args, **kwargs)
625 def position(self, *args, **kwargs):
626 """
627 position(self, _rf, _v0, _v1, _v2, _off) -> record *
631 Summary:
632 define a position measure
634 Description:
637 position defines a position measure from the CLI. It has to specify a
638 reference code, position quantity values (see introduction for the action on a
639 scalar quantity with either a vector or scalar value),
641 and optionally it can specify an
642 offset, which in itself has to be a position. Allowable reference codes are:
643 {em WGS84 ITRF} (World Geodetic System and International Terrestrial
644 Reference Frame).
645 Note that additional ones may become available. Check in casa with:
647 begin{verbatim}
648 print 't----t position Ex 1 t----'
649 print me.listcodes(me.position())
650 #{'normal': ['ITRF', 'WGS84'], 'extra': []}
651 end{verbatim}
653 The position quantity values should be either longitude
654 (angle), latitude(angle) and height(length); or x,y,z (length).
655 See quantity for possible angle formats.
657 Input Parameters:
658 rf reference code
659 v0 longitude or x
660 v1 latitude or y
661 v2 height or z
662 off optional offset position measure
664 Example:
666 print 't----t position Ex 2 t----'
667 print me.position('wgs84','30deg','40deg','10m')
668 #{'m0': {'value': 0.52359877559829882, 'unit': 'rad'},
669 # 'm1': {'value': 0.6981317007977319, 'unit': 'rad'},
670 # 'm2': {'value': 9.9999999999999982, 'unit': 'm'},
671 # 'refer': 'WGS84',
672 # 'type': 'position'}
673 print me.observatory('ATCA')
674 #{'m0': {'value': 2.6101423190348916, 'unit': 'rad'},
675 # 'm1': {'value': -0.5261379196128062, 'unit': 'rad'},
676 # 'm2': {'value': 6372960.2577234386, 'unit': 'm'},
677 # 'refer': 'ITRF',
678 # 'type': 'position'}
680 ###One can use a quantity-vectors especially when dealing with multiple antenna positions for e.g for 3 positions
682 ants=me.position('itrf',qa.quantity([3828763.11,3828746.55, 3828727.43],'m'), qa.quantity([442449.106,442592.14, 442580.12],'m'),
683 qa.quantity([5064923.01, 5064923.01, 5064923.51],'m'))
685 print ants
687 #{'m0': {'unit': 'rad',
688 # 'value': array([ 0.11504897, 0.11508633, 0.1150838 ])},
689 # 'm1': {'unit': 'rad',
690 # 'value': array([ 0.92031276, 0.92031276, 0.92031535])},
691 # 'm2': {'unit': 'm',
692 # 'value': array([ 6364639.28758924, 6364639.27051283, 6364627.33064587])},
693 # 'refer': 'ITRF',
694 # 'type': 'position'}
696 --------------------------------------------------------------------------------
698 """
699 return _measures.measures_position(self, *args, **kwargs)
702 def observatory(self, *args, **kwargs):
703 """
704 observatory(self, _name) -> record *
708 Summary:
709 get position of an observatory
711 Description:
714 observatory will give you the position of an observatory as given in the
715 system. At the time of writing the following observatories are recognised
716 (but check e.g. the position GUI for currently known ones, or the
717 me.obslist() tool function)::
719 {'ALMA' 'ARECIBO' 'ATCA' 'BIMA' 'CLRO' 'DRAO' 'DWL' 'GB' 'GBT' 'GMRT'
720 'IRAM PDB' 'IRAM_PDB' 'JCMT' 'MOPRA' 'MOST' 'NRAO12M' 'NRAO_GBT' 'PKS'
721 'SAO SMA' 'SMA' 'VLA' 'VLBA' 'WSRT' 'ATF' 'ATA' 'CARMA' 'ACA' 'OSF'
722 'OVRO_MMA' 'EVLA' 'ASKAP' 'APEX' 'SMT' 'NRO' 'ASTE' 'LOFAR' 'MeerKAT'
723 'KAT-7' 'EVN' 'LWA1' 'PAPER_SA' 'PAPER_GB' 'e-MERLIN' 'MERLIN2'
724 'Effelsberg' 'MWA32T' }.
726 Input Parameters:
727 name observatory name - case insensitive
729 Example:
731 print 't----t observatory Ex 1 t----'
732 print me.observatory('ATCA')
733 #{'m0': {'value': 2.6101423190348916, 'unit': 'rad'},
734 # 'm1': {'value': -0.5261379196128062, 'unit': 'rad'},
735 # 'm2': {'value': 6372960.2577234386, 'unit': 'm'},
736 # 'refer': 'ITRF',
737 # 'type': 'position'}
739 --------------------------------------------------------------------------------
741 """
742 return _measures.measures_observatory(self, *args, **kwargs)
745 def obslist(self):
746 """
747 obslist(self) -> std::vector< std::string >
751 Summary:
752 get a list of known observatories
754 Description:
757 obslist will give you an array of strings of the
758 observatories known in the Observatories table.
760 Example:
762 print 't----t obslist Ex 1 t----'
763 print me.obslist()
765 #['ALMA' 'ARECIBO' 'ATCA' 'BIMA' 'CLRO' 'DRAO' 'DWL' 'GB' 'GBT' 'GMRT'
766 #'IRAM PDB' 'IRAM_PDB' 'JCMT' 'MOPRA' 'MOST' 'NRAO12M' 'NRAO_GBT' 'PKS'
767 #'SAO SMA' 'SMA' 'VLA' 'VLBA' 'WSRT' 'ATF' 'ATA' 'CARMA' 'ACA' 'OSF'
768 #'OVRO_MMA' 'EVLA' 'ASKAP' 'APEX' 'SMT' 'NRO' 'ASTE' 'LOFAR' 'MeerKAT'
769 #'KAT-7' 'EVN' 'LWA1' 'PAPER_SA' 'PAPER_GB' 'e-MERLIN' 'MERLIN2'
770 #'Effelsberg' 'MWA32T']
772 --------------------------------------------------------------------------------
774 """
775 return _measures.measures_obslist(self)
778 def linelist(self):
779 """
780 linelist(self) -> string
784 Summary:
785 get a list of known spectral lines
787 Description:
790 linelist will give you a string with a space separated list of spectral lines
791 known in the Lines table.
793 A number of lines are available now, but tables with many lines are
794 already online, and will be interfaced once a nomenclature can be defined for
795 the tens of thousands of lines.
797 Example:
799 print 't----t linelist Ex 1 t----'
800 print me.linelist()
801 #'C109A CI CII166A DI H107A H110A H138B H166A H240A H272A
802 # H2CO HE110A HE138B HI OH1612 OH1665 OH1667 OH1720'
804 --------------------------------------------------------------------------------
806 """
807 return _measures.measures_linelist(self)
810 def spectralline(self, *args, **kwargs):
811 """
812 spectralline(self, _name) -> record *
816 Summary:
817 get frequency of a spectral line
819 Description:
822 spectralline will give you the frequency of a spectral line. The known list
823 can be obtained by me.linelist().
825 Input Parameters:
826 name name
828 Example:
830 print 't----t spectralline Ex 1 t----'
831 print me.spectralline('HI')
832 #{'m0': {'value': 1420405751.786, 'unit': 'Hz'},
833 # 'refer': 'REST',
834 # 'type': 'frequency'}
836 --------------------------------------------------------------------------------
838 """
839 return _measures.measures_spectralline(self, *args, **kwargs)
842 def sourcelist(self):
843 """
844 sourcelist(self) -> string
848 Summary:
849 get a list of known sources
851 Description:
854 sourcelist will give you a string with the space separated list of sources
855 known in the Sources table.
857 Example:
859 print 't----t sourcelist Ex 1 t----'
860 print me.sourcelist()[0:62]
861 #'0002-478 0003+380 0003-066 0007+106 0007+171 0008-264 0008-421'
862 #......
864 --------------------------------------------------------------------------------
866 """
867 return _measures.measures_sourcelist(self)
870 def source(self, *args, **kwargs):
871 """
872 source(self, _name) -> record *
876 Summary:
877 get direction of a source
879 Description:
882 source will give you the direction of a source. The known list
883 can be obtained by me.sourcelist().
885 Input Parameters:
886 name name
888 Example:
890 print 't----t source Ex 1 t----'
891 print me.source()
892 print me.source('1934-638')
893 # Out[19]:
894 #{'m0': {'value': -1.1370073467795063, 'unit': 'rad'},
895 # 'm1': {'value': -1.1119959323803881, 'unit': 'rad'},
896 # 'refer': 'ICRS',
897 # 'type': 'direction'}
899 --------------------------------------------------------------------------------
901 """
902 return _measures.measures_source(self, *args, **kwargs)
905 def frequency(self, *args, **kwargs):
906 """
907 frequency(self, _rf, _v0, _off) -> record *
911 Summary:
912 define a frequency measure
914 Description:
917 frequency defines a frequency measure from the CLI. It has to specify a
918 reference code, frequency quantity value (see introduction for the action on a
919 scalar quantity with either a vector or scalar value),
921 and optionally it can specify an
922 offset, which in itself has to be a frequency. Allowable reference codes are:
923 {em REST LSRK LSRD BARY GEO TOPO GALACTO LGROUP CMB}.
924 Note that additional ones may become available. Check in casa with:
925 begin{verbatim}
926 print 't----t frequency Ex 1 t----'
927 print me.listcodes(me.frequency())
928 #{'normal': ['REST', 'LSRK', 'LSRD', 'BARY', 'GEO', 'TOPO',
929 # 'GALACTO', 'LGROUP', 'CMB'], 'extra': []}
930 end{verbatim}
932 The frequency quantity values should be in one of the recognised units
933 (examples all give same frequency):
934 begin{itemize}
935 item value with time units: a period (0.5s)
936 item value as frequency: 2Hz
937 item value in angular frequency: 720deg/s
938 item value as length: 149896km
939 item value as wave number: 4.19169e-8m-1
940 item value as energy (h.nu): 8.27134e-9ueV
941 item value as momentum: 4.42044e-42kg.m
942 end{itemize}
944 Input Parameters:
945 rf reference code
946 v0 frequency/wavelength/ldots
947 off optional offset frequency measure
949 Example:
951 print 't----t frequency Ex 2 t----'
952 print me.frequency('lsrk','5GHz')
953 #{'m0': {'value': 5000000000.0, 'unit': 'Hz'},
954 # 'refer': 'LSRK',
955 # 'type': 'frequency'}
956 print me.frequency('lsrk','21cm')
957 #{'m0': {'value': 1427583133.3333333, 'unit': 'Hz'},
958 # 'refer': 'LSRK',
959 # 'type': 'frequency'}
961 --------------------------------------------------------------------------------
963 """
964 return _measures.measures_frequency(self, *args, **kwargs)
967 def doppler(self, *args, **kwargs):
968 """
969 doppler(self, _rf, _v0, _off) -> record *
973 Summary:
974 define a doppler measure
976 Description:
979 doppler defines a doppler measure from the CLI. It has to specify a
980 reference code, doppler quantity value (see introduction for the action on a
981 scalar quantity with either a vector or scalar value),
983 and optionally it can specify an offset,
984 which in itself has to be a doppler. Allowable reference codes are:
985 {em RADIO Z RATIO BETA GAMMA OPTICAL TRUE RELATIVISTIC}.
986 Note that additional ones may become available. Check in casa with:
988 begin{verbatim}
989 print 't----t doppler Ex 1 t----'
990 print me.listcodes(me.doppler())
991 #{'normal': ['RADIO', 'Z', 'RATIO', 'BETA', 'GAMMA', 'OPTICAL',
992 # 'TRUE', 'RELATIVISTIC'], 'extra': []}
993 end{verbatim}
995 The doppler quantity values should be either non-dimensioned to specify a
996 ratio of the light velocity, or in velocity.
998 Input Parameters:
999 rf reference code
1000 v0 doppler ratio/velocity
1001 off optional offset doppler measure
1003 Example:
1005 Examples both give same doppler:
1007 print 't----t doppler Ex 2 t----'
1008 print me.doppler('radio','0.4')
1009 #{'m0': {'value': 119916983.2, 'unit': 'm/s'},
1010 # 'refer': 'RADIO',
1011 # 'type': 'doppler'}
1012 print me.doppler('radio',qa.mul(qa.quantity('0.4'),qa.constants('c')))
1013 #{'m0': {'value': 119916983.2, 'unit': 'm/s'},
1014 # 'refer': 'RADIO',
1015 # 'type': 'doppler'}
1017 --------------------------------------------------------------------------------
1019 """
1020 return _measures.measures_doppler(self, *args, **kwargs)
1023 def radialvelocity(self, *args, **kwargs):
1024 """
1025 radialvelocity(self, _rf, _v0, _off) -> record *
1029 Summary:
1030 define a radialvelocity measure
1032 Description:
1035 radialvelocity defines a radialvelocity measure from the CLI. It has to
1036 specify a reference code, radialvelocity quantity value (see introduction for
1037 the action on a
1038 scalar quantity with either a vector or scalar value),
1040 and optionally it
1041 can specify an offset, which in itself has to be a radialvelocity.
1042 Allowable reference codes are:
1043 {em LSRK LSRD BARY GEO TOPO GALACTO LGROUP CMB}.
1044 Note that additional ones may become available. Check in casa with:
1046 begin{verbatim}
1047 print 't----t radialvelocity Ex 1 t----'
1048 print me.listcodes(me.radialvelocity())
1049 # Out[17]:
1050 #{'extra': [],
1051 # 'normal': ['LSRK', 'LSRD', 'BARY', 'GEO', 'TOPO', 'GALACTO',
1052 # 'LGROUP', 'CMB']}
1053 end{verbatim}
1054 The radialvelocity quantity values should be given as velocity.
1056 Input Parameters:
1057 rf reference code
1058 v0 radial velocity
1059 off optional offset radialvelocity measure
1061 Example:
1063 print 't----t radialvelocity Ex 2 t----'
1064 print me.radialvelocity('lsrk','20km/s')
1065 # Out[18]:
1066 #{'m0': {'value': 20000.0, 'unit': 'm/s'},
1067 # 'refer': 'LSRK',
1068 # 'type': 'radialvelocity'}
1070 --------------------------------------------------------------------------------
1072 """
1073 return _measures.measures_radialvelocity(self, *args, **kwargs)
1076 def shift(self, *args, **kwargs):
1077 """
1078 shift(self, _v, _offset, _pa) -> record *
1082 Summary:
1083 Shift a direction measure by an offset angle at a position angle.
1085 Description:
1088 This method calculates the direction measure located at the specified offset angular amount along the specified
1089 position angle from the specified direction measure.
1092 Input Parameters:
1093 v The direction measure to shift, represented as a record.
1094 offset The angular offset, represented as a quantity record or string.
1095 pa Position angle of the offset, measured from the positive latitude axis through the positive longitude axis.
1097 Example:
1099 v = me.direction('J2000', '13:22:44', '-50.20.20')
1100 # shift along 4 arcminues at a pa of 30 degrees.
1101 offset = me.shift(v, offset='4arcmin', pa='30deg')
1103 --------------------------------------------------------------------------------
1105 """
1106 return _measures.measures_shift(self, *args, **kwargs)
1109 def uvw(self, *args, **kwargs):
1110 """
1111 uvw(self, _rf, _v0, _v1, _v2, _off) -> record *
1115 Summary:
1116 define a uvw measure
1118 Description:
1121 uvw defines a uvw measure from the CLI. It has to specify a
1122 reference code, uvw quantity values (see introduction for the action on a
1123 scalar quantity with either a vector or scalar value), and optionally it can specify an
1124 offset, which in itself has to be a uvw. Allowable reference codes are
1125 ITRF and the direction ones.
1127 Note that additional ones may become available. Check in casa with::
1129 print 't----t uvw Ex 1 t----'
1130 print me.listcodes(me.uvw())
1132 {
1133 'normal': array(['J2000', 'JMEAN', 'JTRUE', 'APP', 'B1950', 'B1950_VLA', 'BMEAN',
1134 'BTRUE', 'GALACTIC', 'HADEC', 'AZEL', 'AZELSW', 'AZELNE', 'AZELGEO',
1135 'AZELSWGEO', 'AZELNEGEO', 'JNAT', 'ECLIPTIC', 'MECLIPTIC',
1136 'TECLIPTIC', 'SUPERGAL', 'ITRF', 'TOPO', 'ICRS'], dtype='|S10'),
1137 'extra': array([], dtype='|S1')
1138 }
1140 The uvw quantity values should be either longitude
1141 (angle), latitude(angle) and height(length); or x,y,z (length).
1142 See quantity for possible angle formats.
1144 Input Parameters:
1145 rf reference code
1146 v0 longitude or x
1147 v1 latitude or y
1148 v2 height or z
1149 off optional offset uvw measure
1151 Example:
1153 print 't----t uvw Ex 2 t----'
1154 print me.uvw('itrf','30deg','40deg','10m')
1155 #{'m0': {'value': 0.52359877559829882, 'unit': 'rad'},
1156 # 'm1': {'value': 0.6981317007977319, 'unit': 'rad'},
1157 # 'm2': {'value': 9.9999999999999982, 'unit': 'm'},
1158 # 'refer': 'ITRF',
1159 # 'type': 'uvw'}
1160 print me.doframe(me.epoch('utc','today'))
1161 #True
1162 print me.doframe(me.observatory('ALMA'))
1163 #True
1164 print me.doframe(me.direction('mars'))
1165 #True
1166 print me.measure(me.uvw('itrf','30deg','40deg','10m'), 'j2000')
1167 #{'m0': {'value': 0.52321924738347259, 'unit': 'rad'},
1168 # 'm1': {'value': 0.69813169995801672, 'unit': 'rad'},
1169 # 'm2': {'value': 10.0, 'unit': 'm'},
1170 # 'refer': 'J2000',
1171 # 'type': 'uvw'}
1173 --------------------------------------------------------------------------------
1175 """
1176 return _measures.measures_uvw(self, *args, **kwargs)
1179 def touvw(self, *args, **kwargs):
1180 """
1181 touvw(self, _v, _dot, _xyz) -> record *
1185 Summary:
1186 calculate a uvw measure from a baseline
1188 Description:
1191 touvw calculates a uvw measure from a baseline. Note that the
1192 baseline does not have to be a proper {em baseline}, but can be a
1193 series of positions (to call positions baselines see
1194 asbaseline ) for speed reasons:
1195 operations are linear and can be done on positions, which are
1196 converted to baseline values at the end (with
1197 expand ).
1199 Whatever the reference code of the baseline, the returned {em uvw} will be
1200 given in J2000. If the {em dot} argument is given, that variable
1201 will be filled with a quantity array consisting of the time
1202 derivative of the uvw (note that only the sidereal rate is taken
1203 into account; not precession, earth tides and similar variations,
1204 which are much smaller). If the {em xyz} variable is given, it will
1205 be filled with the quantity values of the uvw measure.
1207 The values of the input baselines can be given as a quantity
1208 vector per x, y or z value.
1210 uvw coordinates are calculated for a certain direction in the sky;
1211 hence the frame has to contain the direction for the calculation to
1212 work. Since the baseline and the sky rotate with respect of each
1213 other, the time should be specified as well.
1215 Input Parameters:
1216 v baseline measure
1218 Output Parameters:
1219 dot uvw-dot (quantity array)
1220 xyz uvw (quantity array)
1222 Example:
1224 print 't----t touvw Ex 1 t----'
1225 print me.doframe(me.observatory('atca'))
1226 #True
1227 print me.doframe(me.source('1934-638'))
1228 #True
1229 print me.doframe(me.epoch('utc',qa.unit('today')))
1230 #True
1231 b=me.baseline('itrf','10m','20m','30m')
1232 print me.touvw(b)
1233 #{'dot': {'unit': 'm/s',
1234 # 'value': [-0.0011912452908351659,
1235 # -0.00098731747136827593,
1236 # -0.00048769097314181744]},
1237 # 'return': {'m0': {'value': -0.094777304811312649, 'unit': 'rad'},
1238 # 'm1': {'value': -1.1509286139398101, 'unit': 'rad'},
1239 # 'm2': {'value': 37.416573867739416, 'unit': 'm'},
1240 # 'refer': 'J2000',
1241 # 'type': 'uvw'},
1242 # 'xyz': {'unit': 'm',
1243 # 'value': [15.184026188402472,
1244 # -1.4434256399579168,
1245 # -34.166677788919138]}}
1246 print me.getvalue(me.touvw(b))
1247 #{'m0': {'value': -0.094777304811312649, 'unit': 'rad'},
1248 # 'm1': {'value': -1.1509286139398101, 'unit': 'rad'},
1249 # 'm2': {'value': 37.416573867739416, 'unit': 'm'}}
1250 print me.getvalue(me.touvw(b))['m0']
1251 #{'value': -0.094777304811312649, 'unit': 'rad'}
1253 ###Or when you are dealing with multiple antennas
1254 ####set the frame..i,e where, direction and when.
1255 me.doframe(me.observatory('VLA'))
1256 me.doframe(me.direction('J2000', '19h20m00', '20d10m00'))
1257 me.doframe(me.epoch('utc', '2007/07/08/20:30:00'))
1258 ####antenna positions
1259 ants=me.position('itrf',qa.quantity([3828763.11,3828746.55, 3828727.43],'m'), qa.quantity([442449.106,442592.14, 442580.12],'m'), qa.quantity([5064923.01, 5064923.01, 5064923.51],'m'))
1260 ###convert to baseline measures
1261 bl=me.asbaseline(ants)
1262 ###convert to uvw
1263 me.touvw(bl)
1265 #{'dot': {'unit': 'm/s',
1266 # 'value': array([ 181.25190155, -73.29924893, 199.57974846, 181.25985238,
1267 # -73.29691498, 199.57339353, 181.2583565 , -73.29668498,
1268 # 199.57276731])},
1269 # 'return': {'m0': {'unit': 'rad',
1270 # 'value': array([ 2.21611194, 2.21610131, 2.21609887])},
1271 # 'm1': {'unit': 'rad',
1272 # 'value': array([ 0.6984441 , 0.69846521, 0.69846285])},
1273 # 'm2': {'unit': 'm',
1274 # 'value': array([ 6364639.28758924, 6364639.27051283, 6364627.33064587])},
1275 # 'refer': 'J2000',
1276 # 'type': 'uvw'},
1277 # 'xyz': {'unit': 'm',
1278 # 'value': array([-2931661.69632123, 3894141.52172208, 4092634.20894752,
1279 # -2931568.34776551, 3894103.64373003, 4092737.08879791,
1280 # -2931559.14911939, 3894111.22249941, 4092717.89890567])}}
1283 ####print the (n-1)n/2 baselines(u,v,w)
1284 me.expand(me.touvw(bl)['return'])['xyz']
1285 #{'unit': 'm',
1286 # 'value': array([ 93.34855573, -37.87799205, 102.8798504 , 102.54720184,
1287 # -30.29922267, 83.68995815, 9.19864612, 7.57876938,
1288 # -19.18989224])}
1290 --------------------------------------------------------------------------------
1292 """
1293 return _measures.measures_touvw(self, *args, **kwargs)
1296 def expand(self, *args, **kwargs):
1297 """
1298 expand(self, _v, _xyz) -> record *
1302 Summary:
1303 expand n positions to n*(n-1)/2 baselines
1305 Description:
1308 expand calculates the differences between a series of given measure
1309 values: it calculates baseline values from position values. The
1310 returned value is a measure, but the value of the optional output
1311 variable {em xyz} will be set to an array of values.
1313 Input Parameters:
1314 v measure (baseline, position or uvw measure)
1316 Output Parameters:
1317 xyz uvw (quantity array)
1319 Example:
1321 print 't----t expand Ex 1 t----'
1322 b=me.baseline('itrf', qa.quantity([10, 20, 30], 'm'), qa.quantity([10, 20, 30], 'm'), qa.quantity([0, 0, 0], 'm'))
1323 print me.expand(b)
1324 me.expand(b)
1326 #{'return': {'m0': {'unit': 'rad',
1327 # 'value': array([ 0.78539816, 0.78539816, 0.78539816])},
1328 # 'm1': {'unit': 'rad', 'value': array([ 0., 0., 0.])},
1329 # 'm2': {'unit': 'm',
1330 # 'value': array([ 14.14213562, 28.28427125, 14.14213562])},
1331 # 'refer': 'ITRF',
1332 # 'type': 'baseline'},
1333 # 'xyz': {'unit': 'm',
1334 # 'value': array([ 10., 10., 0., 20., 20., 0., 10., 10., 0.])}}
1336 print me.expand(b)['xyz']['value']
1338 #[ 10. 10. 0. 20. 20. 0. 10. 10. 0.]
1340 --------------------------------------------------------------------------------
1342 """
1343 return _measures.measures_expand(self, *args, **kwargs)
1346 def earthmagnetic(self, *args, **kwargs):
1347 """
1348 earthmagnetic(self, _rf, _v0, _v1, _v2, _off) -> record *
1352 Summary:
1353 define an earthmagnetic measure
1355 Description:
1358 earthmagnetic defines an earthmagnetic measure from the CLI. It needs
1359 a reference code, earthmagnetic quantity values
1360 (see introduction for the action on a
1361 scalar quantity with either a vector or scalar value) if the reference code is not
1362 for a model, and optionally it
1363 can specify an offset, which in itself has to be a earthmagnetic. In general
1364 you specify a model (IGRF is the default and the only one known) and convert
1365 it to an explicit field. (See
1367 http://fdd.gsfc.nasa.gov/IGRF.html
1369 for information on the International Geomagnetic Reference Field). The
1370 earthmagnetic quantity values should be either longitude (angle),
1371 latitude(angle) and length(field strength); or x,y,z (field).
1372 See quantity for possible angle formats.
1374 Input Parameters:
1375 rf reference code
1376 v0 Field strength
1377 v1 longitude
1378 v2 latitude
1379 off optional offset earthmagnetic measure
1381 Example:
1383 print 't----t earthmagnetic Ex 1 t----'
1384 print me.earthmagnetic('igrf')
1385 #{'type': 'earthmagnetic', 'refer': 'IGRF', 'm1': {'value': 0.0, 'unit': 'nT'},
1386 # 'm0': {'value': 6.1230317691118855e-23, 'unit': 'nT'},
1387 # 'm2': {'value': 9.9999999999999995e-07, 'unit': 'nT'}}
1388 print me.doframe(me.observatory('atca'))
1389 print me.doframe(me.source('1934-638'))
1390 print me.doframe(me.epoch('utc',qa.unit('today')))
1391 print me.measure(me.earthmagnetic('igrf'), 'j2000')
1392 #{'type': 'earthmagnetic', 'refer': 'J2000',
1393 # 'm1': {'value': -8664.8767628222304, 'unit': 'nT'},
1394 # 'm0': {'value': 50544.054410564473, 'unit': 'nT'},
1395 # 'm2': {'value': 1799.5131920958615, 'unit': 'nT'}}
1397 --------------------------------------------------------------------------------
1399 """
1400 return _measures.measures_earthmagnetic(self, *args, **kwargs)
1403 def baseline(self, *args, **kwargs):
1404 """
1405 baseline(self, _rf, _v0, _v1, _v2, _off) -> record *
1409 Summary:
1410 define a baseline measure
1412 Description:
1415 baseline defines a baseline measure from the CLI. It has to specify a
1416 reference code, baseline quantity values (see introduction for the action on a
1417 scalar quantity with either a vector or scalar value, and when a vector of
1418 quantities is given), and optionally it can specify an
1419 offset, which in itself has to be a baseline. Allowable reference codes are
1420 ITRF and the direction ones.
1422 Note that additional ones may become available. Check in casa with::
1424 print 't----t baseline Ex 1 t----'
1425 print me.listcodes(me.baseline())
1426 # {'normal': array(['J2000', 'JMEAN', 'JTRUE', 'APP', 'B1950', 'B1950_VLA', 'BMEAN',
1427 # 'BTRUE', 'GALACTIC', 'HADEC', 'AZEL', 'AZELSW', 'AZELNE', 'AZELGEO',
1428 # 'AZELSWGEO', 'AZELNEGEO', 'JNAT', 'ECLIPTIC', 'MECLIPTIC',
1429 # 'TECLIPTIC', 'SUPERGAL', 'ITRF', 'TOPO', 'ICRS'],
1430 # dtype='|S10'), 'extra': array([],
1431 # dtype='|S1')}
1433 The baseline quantity values should be either longitude
1434 (angle), latitude(angle) and height(length); or x,y,z (length).
1435 See quantity for possible angle formats.
1437 Input Parameters:
1438 rf reference code
1439 v0 longitude or x
1440 v1 latitude or y
1441 v2 height or z
1442 off optional offset baseline measure
1444 Example:
1446 print 't----t Ex 2 t----'
1447 print me.baseline('itrf','30deg','40deg','10m')
1448 #{'m0': {'value': 0.52359877559829882, 'unit': 'rad'},
1449 # 'm1': {'value': 0.6981317007977319, 'unit': 'rad'},
1450 # 'm2': {'value': 9.9999999999999982, 'unit': 'm'},
1451 # 'refer': 'ITRF',
1452 # 'type': 'baseline'}
1453 print me.doframe(me.observatory('atca'))
1454 print me.doframe(me.source('1934-638'))
1455 print me.doframe(me.epoch('utc',qa.unit('today')))
1456 print me.measure(me.baseline('itrf','30deg','40deg','10m'), 'J2000')
1457 #{'m0': {'value': 0.58375325605991979, 'unit': 'rad'},
1458 # 'm1': {'value': 0.69758519780286155, 'unit': 'rad'},
1459 # 'm2': {'value': 9.9999999999999964, 'unit': 'm'},
1460 # 'refer': 'J2000',
1461 # 'type': 'baseline'}
1463 --------------------------------------------------------------------------------
1465 """
1466 return _measures.measures_baseline(self, *args, **kwargs)
1469 def asbaseline(self, *args, **kwargs):
1470 """
1471 asbaseline(self, _pos) -> record *
1475 Summary:
1476 define a baseline from a position measure
1478 Description:
1481 asbaseline converts a position measure into a baseline measure. No
1482 actual baseline is calculated, since operations can be done on
1483 positions, with subtractions to obtain baselines at a later stage.
1485 Input Parameters:
1486 pos position measure
1488 Example:
1490 print 't----t asbaseline Ex 1 t----'
1492 ####An example of getting baselines with 3 antenna positions
1493 #### Define the frame ; where, which-direction and when
1494 me.doframe(me.observatory('VLA'))
1495 me.doframe(me.direction('J2000', '19h20m00', '20d10m00'))
1496 me.doframe(me.epoch('utc', '2007/07/08/20:30:00'))
1498 ##antenna position
1499 ants=me.position('itrf',qa.quantity([3828763.11,3828746.55, 3828727.43],'m'), qa.quantity([442449.106,442592.14, 442580.12],'m'), qa.quantity([5064923.01, 5064923.01, 5064923.51],'m'))
1500 print ants
1501 #{'type': 'position', 'refer': 'ITRF', 'm1': {'value': array([ 0.92031276, 0.92031276, 0.92031535]), 'unit': 'rad'},
1502 #'m0': {'value': array([ 0.11504897, 0.11508633, 0.1150838 ]), 'unit': 'rad'},
1503 #'m2': {'value': array([ 6364639.28758924, 6364639.27051283, 6364627.33064587]), 'unit': 'm'}}
1505 bl=me.asbaseline(ants)
1506 print bl
1507 #{'type': 'baseline', 'refer': 'J2000', 'm1': {'value': array([ 0.92068328, 0.92068326, 0.92068585]), 'unit': 'rad'},
1508 #'m0': {'value': array([-2.08658811, -2.08655073, -2.08655326]), 'unit': 'rad'},
1509 #'m2': {'value': array([ 6364639.28758924, 6364639.27051283, 6364627.33064587]), 'unit': 'm'}}
1511 me.expand(bl)
1513 #{'return': {'m0': {'unit': 'rad',
1514 # 'value': array([-0.51637894, -0.36575235, 1.50036599])},
1515 # 'm1': {'unit': 'rad',
1516 # 'value': array([-0.00060966, 0.00302388, 0.02206414])},
1517 # 'm2': {'unit': 'm',
1518 # 'value': array([ 143.98943974, 135.78652583, 22.58992696])},
1519 # 'refer': 'J2000',
1520 # 'type': 'baseline'},
1521 # 'xyz': {'unit': 'm',
1522 # 'value': array([ 1.25215025e+02, -7.10925354e+01, -8.77850493e-02,
1523 # 1.26804339e+02, -4.85640980e+01, 4.10601842e-01,
1524 # 1.58931410e+00, 2.25284374e+01, 4.98386892e-01])}}
1526 --------------------------------------------------------------------------------
1528 """
1529 return _measures.measures_asbaseline(self, *args, **kwargs)
1532 def listcodes(self, *args, **kwargs):
1533 """
1534 listcodes(self, _ms) -> record *
1538 Summary:
1539 get known reference code names (list indices do not necessarily correspond to enumeration indices)
1541 Description:
1544 listcodes will produce the known reference codes for a specified measure
1545 type. It will return a record with two entries. The first is a string vector
1546 of all normal codes; the second a string vector (maybe empty) with all extra
1547 codes (like planets).
1548 NOTE: Synonyms and different code groups may be present in the code name lists.
1549 The indices in these lists therefore do not necessarily correspond to
1550 the internal CASA enumeration indices.
1552 Input Parameters:
1553 ms the measure type for which to list
1555 Example:
1557 print 't----t listcodes Ex 1 t----'
1558 # Generate some direction
1559 # Note that an empty or non-specified reference code will produce the
1560 # measure with the default code for that measure type
1561 a=me.direction()
1562 print me.getref(a)
1563 #'J2000'
1564 print me.ismeasure(a)
1565 #True
1566 # Get the known reference codes for direction
1567 print me.listcodes(a)
1568 # {'normal': array(['J2000', 'JMEAN', 'JTRUE', 'APP', 'B1950', 'B1950_VLA', 'BMEAN',
1569 # 'BTRUE', 'GALACTIC', 'HADEC', 'AZEL', 'AZELSW', 'AZELNE', 'AZELGEO',
1570 # 'AZELSWGEO', 'AZELNEGEO', 'JNAT', 'ECLIPTIC', 'MECLIPTIC',
1571 # 'TECLIPTIC', 'SUPERGAL', 'ITRF', 'TOPO', 'ICRS'],
1572 # dtype='|S10'), 'extra': array(['MERCURY', 'VENUS', 'MARS', 'JUPITER', 'SATURN', 'URANUS',
1573 # 'NEPTUNE', 'PLUTO', 'SUN', 'MOON', 'COMET'],
1574 # dtype='|S8')}
1576 --------------------------------------------------------------------------------
1578 """
1579 return _measures.measures_listcodes(self, *args, **kwargs)
1582 def measure(self, *args, **kwargs):
1583 """
1584 measure(self, _v, _rf, _off) -> record *
1588 Summary:
1589 convert a measure to another reference
1591 Description:
1594 measure converts measures (epoch, direction etc.) from one reference to
1595 another. It will, for instance, convert a direction from J2000 to AZEL
1596 representation.
1597 Its arguments are a measure, an output reference code (see the individual
1598 measures for the allowable codes (direction,
1599 position,
1600 epoch,
1601 frequency,
1602 doppler,
1603 radialvelocity,
1604 baseline,
1605 uvw,
1606 earthmagnetic)), and an optional offset of
1607 the same type as the main measure. The offset will be subtracted from the
1608 result before it is returned.
1609 In some cases (see the individual measures for when), more information than
1610 just a reference code is necessary. E.g. the above example of a conversion to
1611 AZEL, needs to know for when, and where on Earth we want it. This information
1612 is stored in a reference frame. Measures are set in the reference frame with
1613 the doframe function. The frame is tool
1614 wide.
1616 {bf IMPORTANT NOTE:}
1617 To get an accurate conversion of solar system objects direction to a celestial frame, one should convert to AZEL or HADEC before to get parallax accounted for. Thus if you want to get the moon's position in J2000..one would do it in 2 stages
1618 i.e (after setting the appropriate frames)
1620 moonazel=me.measure(me.direction('moon'), 'AZELGEO')
1621 moonJ2000=me.measure(moonazel, 'J2000')
1623 Input Parameters:
1624 v measure to be converted
1625 rf output reference code
1626 off optional output offset measure
1628 Example:
1630 print 't----t measure Ex 1 t----'
1631 a = me.epoch('utc','today') # a time
1632 print a
1633 #{'m0': {'value': 54054.872957673608, 'unit': 'd'},
1634 # 'refer': 'UTC',
1635 # 'type': 'epoch'}
1636 print me.doframe(me.source('1934-638'))
1637 print me.measure(a, 'tai')# convert to IAT
1638 #{'m0': {'value': 54054.873339618054, 'unit': 'd'},
1639 # 'refer': 'TAI',
1640 # 'type': 'epoch'}
1641 print me.doframe(a)# set time in frame
1642 #True
1643 print me.doframe(me.observatory('ALMA'))# set position in frame
1644 #True
1645 b=me.direction('j2000', qa.toangle('0h'), '-30deg') # a direction
1646 print b
1647 #{'m0': {'value': 0.0, 'unit': 'rad'},
1648 # 'm1': {'value': -0.52359877559829882, 'unit': 'rad'},
1649 # 'refer': 'J2000',
1650 # 'type': 'direction'}
1651 print me.measure(b, 'azel')# convert to AZEL
1652 #{'m0': {'value': 1.9244096810822324, 'unit': 'rad'},
1653 # 'm1': {'value': 0.76465385681363052, 'unit': 'rad'},
1654 # 'refer': 'AZEL',
1655 # 'type': 'direction'}
1656 print qa.angle(me.getvalue(me.measure(b,'azel'))['m0']) # show as angles
1657 #['+110.15.38']
1658 print qa.angle(me.getvalue(me.measure(b,'azel'))['m1'])
1659 #['+043.48.41']
1662 Another example:
1664 print 't----t measure Ex 2 t----'
1665 # Fill the frame with necessary information
1666 print me.doframe(me.epoch('utc','today'))
1667 #True
1668 print me.doframe(me.observatory('ALMA'))
1669 #True
1670 print me.doframe(me.direction('mars'))
1671 #True
1672 a=qa.unit('1GHz')
1673 print a
1674 #{'value': 1.0, 'unit': 'GHz'}
1675 m=me.frequency('lsrk',qa.quantity(qa.getvalue(a),qa.getunit(a)))
1676 print m
1677 #{'m0': {'value': 1000000000.0, 'unit': 'Hz'},
1678 # 'refer': 'LSRK',
1679 # 'type': 'frequency'}
1680 print me.measure(m,'lsrd')
1681 #{'m0': {'value': 1000001766.3928765, 'unit': 'Hz'},
1682 # 'refer': 'LSRD',
1683 # 'type': 'frequency'}
1685 --------------------------------------------------------------------------------
1687 """
1688 return _measures.measures_measure(self, *args, **kwargs)
1691 def doframe(self, *args, **kwargs):
1692 """
1693 doframe(self, _v) -> bool
1697 Summary:
1698 save a measure as frame reference
1700 Description:
1703 doframe will set the measure specified as part of a frame.
1705 If conversion from one type to another is necessary, with the
1706 measure function,
1707 the following frames
1708 should be set if one of the reference types involved in the conversion is as
1709 in the following lists.
1710 {em Epoch}
1712 UTC
1713 TAI
1714 LASTposition
1715 LMST position
1716 GMST1
1717 GAST
1718 UT1
1719 UT2
1720 TDT
1721 TCG
1722 TDB
1723 TCD
1725 {em Direction}
1727 J2000
1728 JMEANepoch
1729 JTRUE epoch
1730 APP epoch
1731 B1950
1732 BMEAN epoch
1733 BTRUE epoch
1734 GALACTIC
1735 HADEC epochposition
1736 AZELepoch position
1737 SUPERGALACTIC
1738 ECLIPTIC
1739 MECLIPTIC epoch
1740 TECLIPTICepoch
1741 PLANETepoch [position]
1743 {em Position}
1745 WGS84
1746 ITRF
1748 {em Radial Velocity}
1750 LSRK direction
1751 LSRD direction
1752 BARY direction
1753 GEO directionepoch
1754 TOPO directionepochposition
1755 GALACTOdirection
1757 {em Doppler}
1759 RADIO
1760 OPTICAL
1761 Z
1762 RATIO
1763 RELATIVISTIC
1764 BETA
1765 GAMMA
1767 {em Frequency}
1769 REST directionradialvelocity
1770 LSRK direction
1771 LSRD direction
1772 BARY direction
1773 GEO directionepoch
1774 TOPO directionepochposition
1775 GALACTO
1777 Input Parameters:
1778 v measure to be set in frame
1780 Example:
1782 print 't----t doframe Ex 1 t----'
1783 a = me.epoch('utc', 'today') # a time
1784 print a
1785 #{'m0': {'value': 54054.91671484954, 'unit': 'd'},
1786 # 'refer': 'UTC',
1787 # 'type': 'epoch'}
1788 print me.doframe(a)# set time in frame
1789 #True
1791 --------------------------------------------------------------------------------
1793 """
1794 return _measures.measures_doframe(self, *args, **kwargs)
1797 def framenow(self):
1798 """
1799 framenow(self) -> bool
1803 Summary:
1804 set the active frame time at now
1806 Description:
1809 framenow will fill the active frame time with the current date and time.
1810 The different frame values necessary are described in the
1811 doframe function
1813 Example:
1815 print 't----t framenow Ex 1 t----'
1816 print me.framenow()# specify now as frame reference
1817 #True
1818 print me.showframe() # and show the current frame
1819 #'Frame: Epoch: 54054::22:01:42.2880'
1821 --------------------------------------------------------------------------------
1823 """
1824 return _measures.measures_framenow(self)
1827 def showframe(self):
1828 """
1829 showframe(self) -> string
1833 Summary:
1834 show the currently active frame reference
1836 Description:
1839 showframe will display the currently active reference frame values on the
1840 terminal. The
1841 different frame values necessary are described in the
1842 doframe function.
1843 The frame is
1844 displayed on the terminal using the formatting as done for the
1845 show function.
1847 Example:
1849 print 't----t showframe Ex 1 t----'
1850 print me.doframe(me.epoch('utc','today'))# specify now as frame reference
1851 #T
1852 print me.showframe()# and show the current frame
1853 #'Frame: Epoch: 54054::22:01:42.2880'
1855 --------------------------------------------------------------------------------
1857 """
1858 return _measures.measures_showframe(self)
1861 def toradialvelocity(self, *args, **kwargs):
1862 """
1863 toradialvelocity(self, _rf, _v0) -> record *
1867 Summary:
1868 convert a doppler type value to a real radial velocity
1870 Description:
1873 toradialvelocity will convert a Doppler type value (e.g. in radio mode) to a
1874 real radialvelocity. The type of velocity (e.g. LSRK) should be specified
1876 Input Parameters:
1877 rf radial velocity reference type
1878 v0 doppler value measure
1880 Example:
1882 print 't----t toradialvelocity Ex 1 t----'
1883 a = me.doppler('radio','0.4')
1884 print a
1885 # Out[4]:
1886 #{'m0': {'value': 119916983.2, 'unit': 'm/s'},
1887 # 'refer': 'RADIO',
1888 # 'type': 'doppler'}
1889 print me.toradialvelocity('topo',a)
1890 #{'m0': {'value': 141078803.7647059, 'unit': 'm/s'},
1891 # 'refer': 'TOPO',
1892 # 'type': 'radialvelocity'}
1894 --------------------------------------------------------------------------------
1896 """
1897 return _measures.measures_toradialvelocity(self, *args, **kwargs)
1900 def tofrequency(self, *args, **kwargs):
1901 """
1902 tofrequency(self, _rf, _v0, _rfq) -> record *
1906 Summary:
1907 convert a doppler type value to a frequency
1909 Description:
1912 tofrequency will convert a Doppler type value (e.g. in radio mode) to a
1913 frequency. The type of frequency (e.g. LSRK) and a rest frequency (either as a
1914 frequency quantity (e.g. qa.constants('HI')) or a frequency measure (e.g.
1915 me.frequency('rest','5100MHz')) should be specified
1917 Input Parameters:
1918 rf frequency reference type
1919 v0 doppler measure value
1920 rfq rest frequency (frequency measure or freuency quantity)
1922 Example:
1924 print 't----t tofrequency Ex 1 t----'
1925 a=me.doppler('radio','0.4')
1926 print a
1927 #{'m0': {'value': 119916983.2, 'unit': 'm/s'},
1928 # 'refer': 'RADIO',
1929 # 'type': 'doppler'}
1930 print me.tofrequency('lsrk',a,qa.constants('HI'))
1931 #{'m0': {'value': 852243451.07159996, 'unit': 'Hz'},
1932 # 'refer': 'LSRK',
1933 # 'type': 'frequency'}
1935 --------------------------------------------------------------------------------
1937 """
1938 return _measures.measures_tofrequency(self, *args, **kwargs)
1941 def todoppler(self, *args, **kwargs):
1942 """
1943 todoppler(self, _rf, _v0, _rfq) -> record *
1947 Summary:
1948 convert a frequency or radialvelocity measure to a doppler measure
1950 Description:
1953 todoppler will convert a radialvelocity measure or a frequency measure to a
1954 doppler measure. In the case of a frequency, a rest frequency has to be
1955 specified. The type of doppler wanted (e.g. RADIO) has to be specified.
1957 Input Parameters:
1958 rf doppler reference type
1959 v0 radial velocity or frequency measure
1960 rfq rest frequency (frequency measure or frequency quantity)
1962 Example:
1964 print 't----t todoppler Ex 1 t----'
1965 f = me.frequency('lsrk','1410MHz') # specify a frequency
1966 print f
1967 #{'m0': {'value': 1410000000.0, 'unit': 'Hz'},
1968 # 'refer': 'LSRK',
1969 # 'type': 'frequency'}
1970 print me.todoppler('radio', f, qa.constants('HI')) # give doppler, using HI rest
1971 #{'m0': {'value': 2196249.8401180855, 'unit': 'm/s'},
1972 # 'refer': 'RADIO',
1973 # 'type': 'doppler'}
1975 --------------------------------------------------------------------------------
1977 """
1978 return _measures.measures_todoppler(self, *args, **kwargs)
1981 def torestfrequency(self, *args, **kwargs):
1982 """
1983 torestfrequency(self, _v0, _d0) -> record *
1987 Summary:
1988 convert a frequency and doppler measure to a rest frequency
1990 Description:
1993 torestfrequency will convert a frequency measure and a doppler measure
1994 (e.g. obtained from another spectral line with a known rest frequency) to a
1995 rest frequency.
1997 Input Parameters:
1998 v0 frequency reference type
1999 d0 doppler measure value
2001 Example:
2003 print 't----t torestfrequency Ex 1 t----'
2004 dp = me.doppler('radio', '2196.24984km/s') # a measured doppler speed
2005 print dp
2006 #{'m0': {'value': 2196249.8399999999, 'unit': 'm/s'},
2007 # 'refer': 'RADIO',
2008 # 'type': 'doppler'}
2009 f = me.frequency('lsrk','1410MHz') # a measured frequency
2010 print f
2011 #{'m0': {'value': 1410000000.0, 'unit': 'Hz'},
2012 # 'refer': 'LSRK',
2013 # 'type': 'frequency'}
2014 print me.torestfrequency(f, dp) # the corresponding rest frequency
2015 #{'m0': {'value': 1420405751.7854364, 'unit': 'Hz'},
2016 # 'refer': 'REST',
2017 # 'type': 'frequency'}
2019 --------------------------------------------------------------------------------
2021 """
2022 return _measures.measures_torestfrequency(self, *args, **kwargs)
2025 def rise(self, *args, **kwargs):
2026 """
2027 rise(self, _crd, _ev) -> record *
2031 Summary:
2032 get rise and set sidereal time
2034 Description:
2037 rise will give the rise/set hour-angles of a source. It needs the position
2038 in the frame, and a time. If the latter is not set, the current time will be
2039 used.
2041 Input Parameters:
2042 crd direction of source (direction measure)
2043 ev elevation angle limit
2045 Example:
2047 # NOT IMPLEMENTED
2048 print 't----t rise Ex 1 t----'
2049 print me.rise(me.direction('sun'))
2050 #[rise=[value=267.12445, unit=deg], set=[value=439.029964, unit=deg]]
2051 print qa.form.long(me.rise(me.direction('sun')).rise)
2052 #17:48:29.868
2053 #
2055 --------------------------------------------------------------------------------
2057 """
2058 return _measures.measures_rise(self, *args, **kwargs)
2061 def riseset(self, *args, **kwargs):
2062 """
2063 riseset(self, _crd, _ev) -> record *
2067 Summary:
2068 get rise and set times
2070 Description:
2073 rise will give the rise/set times of a source. It needs the position
2074 in the frame, and a time. If the latter is not set, the current time will be
2075 used. The returned value is a record with a 'solved' field, which is F if the
2076 source is always below or above the horizon. In that case the rise and set
2077 fields will all have a string value. The record also returns a rise and set
2078 record, with 'last' and 'utc' fields showing the rise and set times as epochs.
2080 Input Parameters:
2081 crd direction of source (direction measure)
2082 ev elevation limit
2084 Example:
2086 # NOT IMPLEMENTED
2087 print 't----t riseset Ex 1 t----'
2088 print me.riseset(me.direction('sun'))
2089 #[solved=T,
2090 # rise=[last=[type=epoch, refer=LAST, m0=[value=0.0731388605, unit=d]],
2091 # utc=[type=epoch, refer=UTC, m0=[value=52085.8964, unit=d]]],
2092 # set=[last=[type=epoch, refer=LAST, m0=[value=0.455732593, unit=d]],
2093 # utc=[type=epoch, refer=UTC, m0=[value=52086.2779, unit=d]]]]
2094 print me.riseset(me.direction('sun'), qa.unit('80deg'))
2095 #[solved=F,
2096 # rise=[last=below, utc=below],
2097 # set=[last=below, utc=below]]
2098 print qa.form.long(me.riseset(me.direction('sun')).rise.utc.m0)
2099 #21:30:47.439
2100 #
2102 --------------------------------------------------------------------------------
2104 """
2105 return _measures.measures_riseset(self, *args, **kwargs)
2108 def posangle(self, *args, **kwargs):
2109 """
2110 posangle(self, _m1, _m2) -> record *
2114 Summary:
2115 get position angle of two directions
2117 Description:
2120 posangle will give the position angle from a direction to another. I.e. the
2121 angle in a direction between the direction to the North pole and the other
2122 direction.
2123 The posiation angle is calculated in the frame of the first argument. m2 is thus converted to the frame of m1 before calculating the position angle.
2125 Input Parameters:
2126 m1 direction of source (direction measure)
2127 m2 direction of other source (direction measure)
2129 Example:
2131 print 't----t posangle Ex 1 t----'
2132 a=me.direction('j2000','0deg','70deg')
2133 b=me.direction('j2000','0deg','80deg')
2134 print me.posangle(a,b)
2135 #{'value': -0.0, 'unit': 'deg'}
2136 print me.separation(a,b)
2137 #{'value': 9.9999999999999893, 'unit': 'deg'}
2138 tim=me.epoch('utc','today')
2139 print me.doframe(tim)
2140 #True
2141 pos=me.observatory('ATCA')
2142 print me.doframe(pos)
2143 #True
2144 print me.posangle(a,b)
2145 #{'value': -0.0, 'unit': 'deg'}
2147 ###Example of how to calculate the parallactic angle of a given direction on thesky.
2149 ###set the frames and epoch
2151 --------------------------------------------------------------------------------
2153 """
2154 return _measures.measures_posangle(self, *args, **kwargs)
2157 def separation(self, *args, **kwargs):
2158 """
2159 separation(self, _m1, _m2) -> record *
2163 Summary:
2164 get separation angle between two directions
2166 Description:
2169 separation will give the separation of a direction from another as an angle.
2171 Input Parameters:
2172 m1 direction of source (direction measure)
2173 m2 direction of other source (direction measure)
2175 Example:
2177 print 't----t separation Ex 1 t----'
2178 a=me.direction('j2000','0deg','70deg')
2179 b=me.direction('j2000','0deg','80deg')
2180 print me.separation(a,b)
2181 #{'value': 9.9999999999999893, 'unit': 'deg'}
2182 tim = me.epoch('utc','today') # set the time
2183 print me.doframe(tim)
2184 #True
2185 pos = me.observatory('ATCA') # set where
2186 print me.doframe(pos)
2187 #True
2188 c=me.measure(b,'azel') # try with different type
2189 print me.separation(a,c)
2190 #{'value': 10.000000000062277, 'unit': 'deg'}
2192 ### the example below is how to calculate
2193 ### the parallactic angle
2194 me.doframe(me.epoch('utc','2015/06/30/19:30:40')))
2195 me.doframe(me.observatory('ALMA'))
2196 mydir = me.direction('J2000','17h28m00','-28d00m00' )
2197 #convert direction to AZEL
2198 mydirazel=me.measure(mydir, 'AZEL')
2199 hadecpol=me.direction('HADEC', '00h00m00', '90d00m00')
2200 ### no need to convert north pole direction to AZEL
2201 ### as it will coverted to the frame of mydirazel
2202 parAngle=me.posangle(mydirazel, hadecpol)
2204 --------------------------------------------------------------------------------
2206 """
2207 return _measures.measures_separation(self, *args, **kwargs)
2210 def addxvalue(self, *args, **kwargs):
2211 """
2212 addxvalue(self, _a) -> record *
2216 Summary:
2217 get some additional measure information
2219 Description:
2222 addxvalue will give some additional information about some measures as a vector
2223 of quantities. It is used internally to get the rectangular coordinates of
2224 measures that are normally given in angles. The casual user will probably in
2225 general not interested in this function.
2227 Input Parameters:
2228 a measures for which extra information is to be gotten
2230 Example:
2232 print 't----t addxvalue Ex 1 t----'
2233 a=me.observatory('atca')
2234 print a
2235 #{'m0': {'value': 2.6101423190348916, 'unit': 'rad'},
2236 # 'm1': {'value': -0.5261379196128062, 'unit': 'rad'},
2237 # 'm2': {'value': 6372960.2577234386, 'unit': 'm'},
2238 # 'refer': 'ITRF',
2239 # 'type': 'position'}
2240 print me.addxvalue(a)
2241 #{'value': [-4750915.8370000012, 2792906.1819999996, -3200483.747], 'unit': 'm'}
2242 print me.addxvalue(me.epoch('utc','today'))
2243 #{}
2245 --------------------------------------------------------------------------------
2247 """
2248 return _measures.measures_addxvalue(self, *args, **kwargs)
2251 def type(self):
2252 """
2253 type(self) -> string
2257 Summary:
2258 type of tool
2260 Description:
2263 type will return the tool name.
2265 Example:
2267 print 't----t type Ex 1 t----'
2268 print me.type()
2269 #'measures'
2271 --------------------------------------------------------------------------------
2273 """
2274 return _measures.measures_type(self)
2277 def done(self):
2278 """
2279 done(self) -> bool
2283 Summary:
2284 free resources used by tool.
2286 Description:
2289 In general you will not want to call this method. It removes and then
2290 recreates the default measures tool.
2292 Example:
2294 print 't----t done Ex 1 t----'
2295 print me.done()
2296 #True
2298 --------------------------------------------------------------------------------
2300 """
2301 return _measures.measures_done(self)
2304 def ismeasure(self, *args, **kwargs):
2305 """
2306 ismeasure(self, _v) -> bool
2310 Summary:
2311 Check if measure
2313 Description:
2316 Checks if the operand is a correct measure
2318 Input Parameters:
2319 v value to be tested
2321 Example:
2323 print 't----t ismeasure Ex 1 t----'
2324 x=me.epoch('utc','today')
2325 print x
2326 #{'m0': {'value': 54056.043754386577, 'unit': 'd'},
2327 # 'refer': 'UTC',
2328 # 'type': 'epoch'}
2329 print me.ismeasure(x)
2330 #True
2331 y=me.getvalue(x)
2332 print y
2333 #{'m0': {'value': 54056.043754386577, 'unit': 'd'}}
2334 print me.ismeasure(y)
2335 #False
2336 print 'Last example, exiting!'
2337 exit()
2339 --------------------------------------------------------------------------------
2341 """
2342 return _measures.measures_ismeasure(self, *args, **kwargs)
2344 __swig_destroy__ = _measures.delete_measures
2345 __del__ = lambda self: None
2346 __swig_setmethods__["_dot_touvw"] = _measures.measures__dot_touvw_set
2347 __swig_getmethods__["_dot_touvw"] = _measures.measures__dot_touvw_get
2348 if _newclass:
2349 _dot_touvw = _swig_property(_measures.measures__dot_touvw_get, _measures.measures__dot_touvw_set)
2350 __swig_setmethods__["_xyz_touvw"] = _measures.measures__xyz_touvw_set
2351 __swig_getmethods__["_xyz_touvw"] = _measures.measures__xyz_touvw_get
2352 if _newclass:
2353 _xyz_touvw = _swig_property(_measures.measures__xyz_touvw_get, _measures.measures__xyz_touvw_set)
2354 __swig_setmethods__["_xyz_expand"] = _measures.measures__xyz_expand_set
2355 __swig_getmethods__["_xyz_expand"] = _measures.measures__xyz_expand_get
2356 if _newclass:
2357 _xyz_expand = _swig_property(_measures.measures__xyz_expand_get, _measures.measures__xyz_expand_set)
2358measures_swigregister = _measures.measures_swigregister
2359measures_swigregister(measures)
2360cvar = _measures.cvar
2362# This file is compatible with both classic and new-style classes.