LSSTApplications  19.0.0-14-gb0260a2+1b4fc4249b,20.0.0+19029f0d82,20.0.0+66077e84be,20.0.0+b8df9e862d,20.0.0+e2e26847c2,20.0.0+e47e9b3a81,20.0.0-1-g253301a+19029f0d82,20.0.0-1-g2b7511a+46a6078777,20.0.0-1-g3dda6ea+905cef1a44,20.0.0-1-g4d801e7+5fcfd52d2e,20.0.0-1-g5b95a8c+19889959e1,20.0.0-1-gc96f8cb+d5e4df5959,20.0.0-1-gedffbd8+6ca2c30637,20.0.0-10-g0891cd99+caa8c2603a,20.0.0-13-gad96b2d30+614f89f815,20.0.0-17-gcdbda88+2b141d441d,20.0.0-2-g4dae9ad+d5e4df5959,20.0.0-2-g52fdb94+046030bafd,20.0.0-2-g61b8584+85c46248f3,20.0.0-2-g8177d33+f2ab36af31,20.0.0-2-gb780d76+f45b7d88f4,20.0.0-2-gf072044+19029f0d82,20.0.0-22-gdf434b7+d5e4df5959,20.0.0-23-g10eeb28+452d7a9290,20.0.0-23-g8900aa8+a8b4322b0e,20.0.0-3-g1653f94+85c46248f3,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g750bffe+7a989609f2,20.0.0-3-gbd60e8c+ff10c6d78d,20.0.0-33-g078e64d5+a2256d2c79,20.0.0-4-g97dc21a+a8b4322b0e,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-6-g9a5b7a1+3d4d12ed4e,20.0.0-61-g4de25fb+ddf3488217,20.0.0-7-gcda7bf1+dffc53c16b,w.2020.44
LSSTDataManagementBasePackage
Functions | Variables
lsst.afw.table._match Namespace Reference

Functions

def __repr__ (self)
 
def __str__ (self)
 
def __getitem__ (self, i)
 
def __setitem__ (self, i, val)
 
def __len__ (self)
 
def clone (self)
 
def packMatches (matches)
 

Variables

 clone
 
 matchXy
 
 matchRaDec
 
 first
 
 second
 
 distance
 

Function Documentation

◆ __getitem__()

def lsst.afw.table._match.__getitem__ (   self,
  i 
)
Treat a Match as a tuple of length 3: (first, second, distance)

Definition at line 55 of file _match.py.

55 def __getitem__(self, i): # noqa: N807
56  """Treat a Match as a tuple of length 3: (first, second, distance)"""
57  if i > 2 or i < -3:
58  raise IndexError(i)
59  if i < 0:
60  i += 3
61  if i == 0:
62  return self.first
63  elif i == 1:
64  return self.second
65  else:
66  return self.distance
67 
68 

◆ __len__()

def lsst.afw.table._match.__len__ (   self)

Definition at line 83 of file _match.py.

83 def __len__(self): # noqa: N807
84  return 3
85 
86 

◆ __repr__()

def lsst.afw.table._match.__repr__ (   self)

Definition at line 33 of file _match.py.

33 def __repr__(self): # noqa: N807
34  return "Match(%s,\n %s,\n %g)" % \
35  (repr(self.first), repr(self.second), self.distance)
36 
37 

◆ __setitem__()

def lsst.afw.table._match.__setitem__ (   self,
  i,
  val 
)
Treat a Match as a tuple of length 3: (first, second, distance)

Definition at line 69 of file _match.py.

69 def __setitem__(self, i, val): # noqa: N807
70  """Treat a Match as a tuple of length 3: (first, second, distance)"""
71  if i > 2 or i < -3:
72  raise IndexError(i)
73  if i < 0:
74  i += 3
75  if i == 0:
76  self.first = val
77  elif i == 1:
78  self.second = val
79  else:
80  self.distance = val
81 
82 

◆ __str__()

def lsst.afw.table._match.__str__ (   self)

Definition at line 38 of file _match.py.

38 def __str__(self): # noqa: N807
39  def sourceRaDec(s):
40  if hasattr(s, "getRa") and hasattr(s, "getDec"):
41  return " RA,Dec=(%g,%g) deg" % (s.getRa().asDegrees(), s.getDec().asDegrees())
42  return ""
43 
44  def sourceXy(s):
45  if hasattr(s, "getX") and hasattr(s, "getY"):
46  return " x,y=(%g,%g)" % (s.getX(), s.getY())
47  return ""
48 
49  def sourceStr(s):
50  return s.__class__.__name__ + ("(id %d" % s.getId()) + sourceRaDec(s) + sourceXy(s) + ")"
51 
52  return "Match(%s, %s, dist %g)" % (sourceStr(self.first), sourceStr(self.second), self.distance,)
53 
54 

◆ clone()

def lsst.afw.table._match.clone (   self)

Definition at line 87 of file _match.py.

87 def clone(self):
88  return self.__class__(self.first, self.second, self.distance)
89 
90 
91 # Pickling support disabled for this type (see testSourceMatch comment for reasoning)
92 # def __getstate__(self):
93 # return self.first, self.second, self.distance
94 #
95 #
96 # def __setstate__(self, state):
97 # self.__init__(*state)
98 
99 

◆ packMatches()

def lsst.afw.table._match.packMatches (   matches)
Make a catalog of matches from a sequence of matches.

The catalog contains three fields:
- first: the ID of the first source record in each match
- second: the ID of the second source record in each match
- distance: the distance of each match

Parameters
----------
matches :
    Sequence of matches, typically of type SimpleMatch,
    ReferenceMatch or SourceMatch.  Each element must support:
    `.first.getId()`->int, `.second.getId()->int` and
    `.distance->float`.

Returns
-------
result :
    The catalog of matches.

Notes
-----
This pure python implementation exists as a historical artifact
related to SWIG limitations. It might be practical to wrap the
overloaded C++ functions with pybind11, but there didn't seem much
point.

Definition at line 111 of file _match.py.

111 def packMatches(matches):
112  """Make a catalog of matches from a sequence of matches.
113 
114  The catalog contains three fields:
115  - first: the ID of the first source record in each match
116  - second: the ID of the second source record in each match
117  - distance: the distance of each match
118 
119  Parameters
120  ----------
121  matches :
122  Sequence of matches, typically of type SimpleMatch,
123  ReferenceMatch or SourceMatch. Each element must support:
124  `.first.getId()`->int, `.second.getId()->int` and
125  `.distance->float`.
126 
127  Returns
128  -------
129  result :
130  The catalog of matches.
131 
132  Notes
133  -----
134  This pure python implementation exists as a historical artifact
135  related to SWIG limitations. It might be practical to wrap the
136  overloaded C++ functions with pybind11, but there didn't seem much
137  point.
138  """
139  schema = Schema()
140  outKey1 = schema.addField("first", type=np.int64,
141  doc="ID for first source record in match.")
142  outKey2 = schema.addField("second", type=np.int64,
143  doc="ID for second source record in match.")
144  keyD = schema.addField("distance", type=np.float64,
145  doc="Distance between matches sources.")
146  result = BaseCatalog(schema)
147  result.table.preallocate(len(matches))
148  for match in matches:
149  record = result.addNew()
150  record.set(outKey1, match.first.getId())
151  record.set(outKey2, match.second.getId())
152  record.set(keyD, match.distance)
153  return result
154 
155 

Variable Documentation

◆ clone

lsst.afw.table._match.clone

Definition at line 106 of file _match.py.

◆ distance

lsst.afw.table._match.distance

Definition at line 80 of file _match.py.

◆ first

lsst.afw.table._match.first

Definition at line 76 of file _match.py.

◆ matchRaDec

lsst.afw.table._match.matchRaDec
Initial value:
2  matchRaDec,
3  reason="Overloads that don't use `MatchControl` are deprecated. To be removed after 20.0.0.")

Definition at line 159 of file _match.py.

◆ matchXy

lsst.afw.table._match.matchXy
Initial value:
2  matchXy,
3  reason="Overloads that don't use `MatchControl` are deprecated. To be removed after 20.0.0.")

Definition at line 156 of file _match.py.

◆ second

lsst.afw.table._match.second

Definition at line 78 of file _match.py.

lsst::afw::table._match.packMatches
def packMatches(matches)
Definition: _match.py:111
lsst::afw::table._match.clone
def clone(self)
Definition: _match.py:87
lsst::afw::table._match.__setitem__
def __setitem__(self, i, val)
Definition: _match.py:69
lsst::afw::table._match.__str__
def __str__(self)
Definition: _match.py:38
lsst::afw::table::BaseCatalog
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:71
lsst::utils.deprecated.deprecate_pybind11
def deprecate_pybind11(obj, reason, version=None, category=FutureWarning)
Definition: deprecated.py:32
lsst::afw::table._match.__len__
def __len__(self)
Definition: _match.py:83
lsst::afw::table._match.__getitem__
def __getitem__(self, i)
Definition: _match.py:55
lsst::afw::table._match.__repr__
def __repr__(self)
Definition: _match.py:33