lsst.afw  16.0-10-gd1b3a1c94
spatialCell.py
Go to the documentation of this file.
1 from lsst.pex.exceptions import NotFoundError
2 from ._spatialCell import SpatialCellCandidateIterator, SpatialCell
3 
4 __all__ = [] # import this module only for its side effects
5 
6 
8  while True:
9  try:
10  yield self.__deref__()
11  except NotFoundError:
12  return
13  self.__incr__()
14 
15 
16 SpatialCellCandidateIterator.__iter__ = spatialCellCandidateIter
17 
18 
19 def spatialCellIter(self):
20  return self.begin().__iter__()
21 
22 
23 SpatialCell.__iter__ = spatialCellIter
24 
25 
26 def spatialCellGetitem(self, idx):
27  idx = int(idx)
28  num_cells = len(self)
29  if idx < -num_cells or idx >= num_cells:
30  raise IndexError("idx={} < -{} or >= {})".format(idx,
31  num_cells, num_cells))
32  if idx < 0:
33  idx += num_cells
34  for i, cell in enumerate(self):
35  if i >= idx:
36  return cell
37 
38 
39 SpatialCell.__getitem__ = spatialCellGetitem
def spatialCellCandidateIter(self)
Definition: spatialCell.py:7
def spatialCellGetitem(self, idx)
Definition: spatialCell.py:26