LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
Public Member Functions | Public Attributes | List of all members
lsst.afw.geom.testUtils.BoxGrid Class Reference

Public Member Functions

def __init__ (self, box, numColRow)
 
def numColRow (self)
 
def __getitem__ (self, indXY)
 
def __len__ (self)
 
def __iter__ (self)
 

Public Attributes

 boxClass
 
 stopDelta
 
 pointClass
 

Detailed Description

Divide a box into nx by ny sub-boxes that tile the region

The sub-boxes will be of the same type as `box` and will exactly tile `box`;
they will also all be the same size, to the extent possible (some variation
is inevitable for integer boxes that cannot be evenly divided.

Parameters
----------
box : `lsst.geom.Box2I` or `lsst.geom.Box2D`
    the box to subdivide; the boxes in the grid will be of the same type
numColRow : pair of `int`
    number of columns and rows

Definition at line 42 of file testUtils.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.afw.geom.testUtils.BoxGrid.__init__ (   self,
  box,
  numColRow 
)

Definition at line 57 of file testUtils.py.

57  def __init__(self, box, numColRow):
58  if len(numColRow) != 2:
59  raise RuntimeError(f"numColRow={numColRow!r}; must be a sequence of two integers")
60  self._numColRow = tuple(int(val) for val in numColRow)
61 
62  if isinstance(box, lsst.geom.Box2I):
63  stopDelta = 1
64  elif isinstance(box, lsst.geom.Box2D):
65  stopDelta = 0
66  else:
67  raise RuntimeError(f"Unknown class {type(box)} of box {box}")
68  self.boxClass = type(box)
69  self.stopDelta = stopDelta
70 
71  minPoint = box.getMin()
72  self.pointClass = type(minPoint)
73  dtype = np.array(minPoint).dtype
74 
75  self._divList = [np.linspace(start=box.getMin()[i],
76  stop=box.getMax()[i] + self.stopDelta,
77  num=self._numColRow[i] + 1,
78  endpoint=True,
79  dtype=dtype) for i in range(2)]
80 
table::Key< int > type
Definition: Detector.cc:163
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
An integer coordinate rectangle.
Definition: Box.h:55

Member Function Documentation

◆ __getitem__()

def lsst.afw.geom.testUtils.BoxGrid.__getitem__ (   self,
  indXY 
)
Return the box at the specified x,y index

Parameters
----------
indXY : pair of `ints`
    the x,y index to return

Returns
-------
subBox : `lsst.geom.Box2I` or `lsst.geom.Box2D`

Definition at line 85 of file testUtils.py.

85  def __getitem__(self, indXY):
86  """Return the box at the specified x,y index
87 
88  Parameters
89  ----------
90  indXY : pair of `ints`
91  the x,y index to return
92 
93  Returns
94  -------
95  subBox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
96  """
97  beg = self.pointClass(*[self._divList[i][indXY[i]] for i in range(2)])
98  end = self.pointClass(
99  *[self._divList[i][indXY[i] + 1] - self.stopDelta for i in range(2)])
100  return self.boxClass(beg, end)
101 

◆ __iter__()

def lsst.afw.geom.testUtils.BoxGrid.__iter__ (   self)
Return an iterator over all boxes, where column varies most quickly

Definition at line 105 of file testUtils.py.

105  def __iter__(self):
106  """Return an iterator over all boxes, where column varies most quickly
107  """
108  for row in range(self.numColRow[1]):
109  for col in range(self.numColRow[0]):
110  yield self[col, row]
111 
112 

◆ __len__()

def lsst.afw.geom.testUtils.BoxGrid.__len__ (   self)

Definition at line 102 of file testUtils.py.

102  def __len__(self):
103  return self.shape[0]*self.shape[1]
104 

◆ numColRow()

def lsst.afw.geom.testUtils.BoxGrid.numColRow (   self)

Definition at line 82 of file testUtils.py.

82  def numColRow(self):
83  return self._numColRow
84 

Member Data Documentation

◆ boxClass

lsst.afw.geom.testUtils.BoxGrid.boxClass

Definition at line 68 of file testUtils.py.

◆ pointClass

lsst.afw.geom.testUtils.BoxGrid.pointClass

Definition at line 72 of file testUtils.py.

◆ stopDelta

lsst.afw.geom.testUtils.BoxGrid.stopDelta

Definition at line 69 of file testUtils.py.


The documentation for this class was generated from the following file: