LSSTApplications  11.0-24-g0a022a1,14.0+77,15.0,15.0+1
LSSTDataManagementBasePackage
coord.py
Go to the documentation of this file.
1 from __future__ import absolute_import, division, print_function
2 
3 from ._coord import *
4 
5 
6 def __repr__(self):
7  coordSystem = self.getCoordSystem()
8  argList = ["%r*afwGeom.degrees" % (pos.asDegrees(),) for pos in self]
9  if coordSystem == TOPOCENTRIC:
10  argList += [
11  repr(self.getEpoch()),
12  "(%r)" % (self.getObservatory(),),
13  ]
14  elif coordSystem not in (ICRS, GALACTIC):
15  argList.append(repr(self.getEpoch()))
16  return "%s(%s)" % (self.getClassName(), ", ".join(argList))
17 
18 
19 Coord.__repr__ = __repr__
20 Fk5Coord.__repr__ = __repr__
21 IcrsCoord.__repr__ = __repr__
22 GalacticCoord.__repr__ = __repr__
23 EclipticCoord.__repr__ = __repr__
24 TopocentricCoord.__repr__ = __repr__
25 
26 del __repr__
27 
28 # Add __iter__ to allow 'ra,dec = coord' statement in python
29 
30 
31 def __iter__(self):
32  for i in (0, 1):
33  yield self[i]
34 
35 
36 Coord.__iter__ = __iter__
37 Fk5Coord.__iter__ = __iter__
38 IcrsCoord.__iter__ = __iter__
39 GalacticCoord.__iter__ = __iter__
40 EclipticCoord.__iter__ = __iter__
41 TopocentricCoord.__iter__ = __iter__
42 
43 del __iter__
44 
45 
46 def __len__(self):
47  return 2
48 
49 
50 Coord.__len__ = __len__
51 Fk5Coord.__len__ = __len__
52 IcrsCoord.__len__ = __len__
53 GalacticCoord.__len__ = __len__
54 EclipticCoord.__len__ = __len__
55 TopocentricCoord.__len__ = __len__
56 
57 del __len__
58 
59 
60 def _reduceCoord(self):
61  return (Coord, (self.getLongitude(), self.getLatitude(), self.getEpoch()))
62 
63 
64 Coord.__reduce__ = _reduceCoord
65 
66 
67 def _reduceFk5Coord(self):
68  return (Fk5Coord, (self.getLongitude(), self.getLatitude(), self.getEpoch()))
69 
70 
71 Fk5Coord.__reduce__ = _reduceFk5Coord
72 
73 
75  return (EclipticCoord, (self.getLongitude(), self.getLatitude(), self.getEpoch()))
76 
77 
78 EclipticCoord.__reduce__ = _reduceEclipticCoord
79 
80 
82  return (GalacticCoord, (self.getLongitude(), self.getLatitude()))
83 
84 
85 GalacticCoord.__reduce__ = _reduceGalacticCoord
86 
87 
88 def _reduceIcrsCoord(self):
89  return (IcrsCoord, (self.getLongitude(), self.getLatitude()))
90 
91 
92 IcrsCoord.__reduce__ = _reduceIcrsCoord
def _reduceFk5Coord(self)
Definition: coord.py:67
def __iter__(self)
Definition: coord.py:31
def _reduceGalacticCoord(self)
Definition: coord.py:81
def _reduceCoord(self)
Definition: coord.py:60
def __repr__(self)
Definition: coord.py:6
def __len__(self)
Definition: coord.py:46
def _reduceEclipticCoord(self)
Definition: coord.py:74
def _reduceIcrsCoord(self)
Definition: coord.py:88