LSSTApplications  12.1-5-gbdcc3ab,15.0+10,15.0+19,15.0-1-g19261fa+10,15.0-1-g60afb23+19,15.0-1-g615e0bb+11,15.0-1-g6668b0b+6,15.0-1-g788a293+19,15.0-1-ga91101e+19,15.0-1-gae1598d+9,15.0-1-gd076f1f+17,15.0-1-gdf18595+3,15.0-1-gf4f1c34+9,15.0-10-g113cadf7+2,15.0-11-g5674e3b,15.0-2-g100d730+12,15.0-2-g20c4630+8,15.0-2-g35685a8+15,15.0-2-g5dfaa72+8,15.0-2-gf38729e+14,15.0-24-g02ed2a30c+2,15.0-3-g11fe1a0+3,15.0-3-g130a88a+2,15.0-3-g707930d+1,15.0-3-g9103c06+9,15.0-3-ga03b4ca+26,15.0-3-gaec6799+6,15.0-4-g32c2b40+2,15.0-4-g535e784+3,15.0-4-g654b129+17,15.0-5-g23e394c+7,15.0-5-g54bfcd9+2,15.0-5-gb31927c,15.0-6-g4418537+2,15.0-7-g0c26201,15.0-7-g6bb3a066+2,15.0-9-g5661f8f+4,w.2018.18
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | List of all members
lsst.geom.geometry.SphericalBoxPartitionMap Class Reference
Inheritance diagram for lsst.geom.geometry.SphericalBoxPartitionMap:
lsst.geom.geometry.PartitionMap

Public Member Functions

def __init__ (self, numStripes, numSubStripesPerStripe)
 
def getSubStripe (self, phi)
 
def getStripe (self, phi)
 
def getSubChunk (self, subStripe, theta)
 
def getChunk (self, stripe, theta)
 
def getChunkBoundingBox (self, chunkId)
 
def getSubChunkBoundingBox (self, chunkId, subChunkId)
 
def getChunkId (self, stripe, chunk)
 
def getSubChunkId (self, subStripe, subChunk)
 
def intersect (self, args)
 
def __iter__ (self)
 
def __eq__ (self, other)
 
def __repr__ (self)
 

Public Attributes

 numStripes
 
 numSSPerStripe
 
 numSubStripes
 
 stripeHeight
 
 subStripeHeight
 
 numChunks
 
 numSCPerChunk
 
 subChunkWidth
 
 maxSCPerChunk
 

Detailed Description

A simple partitioning scheme that breaks the unit sphere into fixed
height latitude angle stripes. These are in turn broken up into fixed
width longitude angle chunks (each stripe has a variable number of chunks
to account for distortion at the poles). Chunks are in turn broken up
into fixed height sub-stripes, and each sub-stripe is then divided into
fixed width sub-chunks. Again, the number of sub-chunks per sub-stripe is
variable to account for polar distortion.

Definition at line 2040 of file geometry.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.geom.geometry.SphericalBoxPartitionMap.__init__ (   self,
  numStripes,
  numSubStripesPerStripe 
)

Definition at line 2050 of file geometry.py.

2050  def __init__(self, numStripes, numSubStripesPerStripe):
2051  if (not isinstance(numStripes, numbers.Integral) or
2052  not isinstance(numSubStripesPerStripe, numbers.Integral)):
2053  raise TypeError('Number of stripes and sub-stripes per stripe ' +
2054  'must be integers')
2055  if numStripes < 1 or numSubStripesPerStripe < 1:
2056  raise RuntimeError('Number of stripes and sub-stripes per ' +
2057  'stripe must be positive')
2058  self.numStripes = numStripes
2059  self.numSSPerStripe = numSubStripesPerStripe
2060  self.numSubStripes = numStripes * numSubStripesPerStripe
2061  h = 180.0 / numStripes
2062  hs = 180.0 / self.numSubStripes
2063  self.stripeHeight = h
2064  self.subStripeHeight = hs
2065  self.numChunks = [segments(i * h - 90.0, (i + 1) * h - 90.0, h)
2066  for i in range(numStripes)]
2067  self.numSCPerChunk = []
2068  self.subChunkWidth = []
2069  for i in range(self.numSubStripes):
2070  nc = self.numChunks[i//numSubStripesPerStripe]
2071  n = segments(i * hs - 90.0, (i + 1) * hs - 90.0, hs)//nc
2072  self.numSCPerChunk.append(n)
2073  w = 360.0 / (n * nc)
2074  self.subChunkWidth.append(w)
2075  self.maxSCPerChunk = max(self.numSCPerChunk)
2076 
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33
int max
Definition: BoundedField.cc:99
def __init__(self, minimum, dataRange, Q)
Definition: rgb.py:414
def segments(phiMin, phiMax, width)
Definition: geometry.py:339

Member Function Documentation

◆ __eq__()

def lsst.geom.geometry.SphericalBoxPartitionMap.__eq__ (   self,
  other 
)

Definition at line 2429 of file geometry.py.

2429  def __eq__(self, other):
2430  if isinstance(other, SphericalBoxPartitionMap):
2431  return (self.numStripes == other.numStripes and
2432  self.numSSPerStripe == other.numSSPerStripe)
2433  return False
2434 

◆ __iter__()

def lsst.geom.geometry.SphericalBoxPartitionMap.__iter__ (   self)
Returns an iterator over (chunkId, SubIterator) tuples - one for
each chunk in the partition map. Each SubIterator is an iterator over
subChunkIds for the corresponding chunk.

Definition at line 2420 of file geometry.py.

2420  def __iter__(self):
2421  """Returns an iterator over (chunkId, SubIterator) tuples - one for
2422  each chunk in the partition map. Each SubIterator is an iterator over
2423  subChunkIds for the corresponding chunk.
2424  """
2425  for s in range(self.numStripes):
2426  for c in range(self.numChunks[s]):
2427  yield (self.getChunkId(s, c), self._allSubChunks(s, False))
2428 

◆ __repr__()

def lsst.geom.geometry.SphericalBoxPartitionMap.__repr__ (   self)

Definition at line 2435 of file geometry.py.

2435  def __repr__(self):
2436  return ''.join([self.__class__.__name__, '(', repr(self.numStripes),
2437  ', ', repr(self.numSSPerStripe), ')'])
2438 

◆ getChunk()

def lsst.geom.geometry.SphericalBoxPartitionMap.getChunk (   self,
  stripe,
  theta 
)
Returns the chunk number of the chunk containing all points
in the given stripe with the given longitude angle.

Definition at line 2106 of file geometry.py.

2106  def getChunk(self, stripe, theta):
2107  """Returns the chunk number of the chunk containing all points
2108  in the given stripe with the given longitude angle.
2109  """
2110  assert stripe >= 0 and theta >= 0.0 and theta <= 360.0
2111  ss = stripe * self.numSSPerStripe
2112  sc = self.getSubChunk(ss, theta)
2113  return sc//self.numSCPerChunk[ss]
2114 

◆ getChunkBoundingBox()

def lsst.geom.geometry.SphericalBoxPartitionMap.getChunkBoundingBox (   self,
  chunkId 
)
Returns a SphericalBox bounding the given chunk. Note that
this is a bounding box only - not an exact representation! In
particular, for a point p and a chunk C with bounding box B,
B.contains(p) == True does not imply that p is assigned to C.
However, for all points p assigned to C, B.contains(p) is True.

Definition at line 2144 of file geometry.py.

2144  def getChunkBoundingBox(self, chunkId):
2145  """Returns a SphericalBox bounding the given chunk. Note that
2146  this is a bounding box only - not an exact representation! In
2147  particular, for a point p and a chunk C with bounding box B,
2148  B.contains(p) == True does not imply that p is assigned to C.
2149  However, for all points p assigned to C, B.contains(p) is True.
2150  """
2151  s = chunkId / (self.numStripes * 2)
2152  c = chunkId - s * self.numStripes * 2
2153  return self._getChunkBoundingBox(s, c)
2154 

◆ getChunkId()

def lsst.geom.geometry.SphericalBoxPartitionMap.getChunkId (   self,
  stripe,
  chunk 
)
Returns the chunk ID of the chunk with the given
stripe/chunk numbers.

Definition at line 2195 of file geometry.py.

2195  def getChunkId(self, stripe, chunk):
2196  """Returns the chunk ID of the chunk with the given
2197  stripe/chunk numbers.
2198  """
2199  return stripe * self.numStripes * 2 + chunk
2200 

◆ getStripe()

def lsst.geom.geometry.SphericalBoxPartitionMap.getStripe (   self,
  phi 
)
Returns the stripe number of the stripe containing all points
with the given latitude angle.

Definition at line 2087 of file geometry.py.

2087  def getStripe(self, phi):
2088  """Returns the stripe number of the stripe containing all points
2089  with the given latitude angle.
2090  """
2091  ss = self.getSubStripe(phi)
2092  return ss//self.numSSPerStripe
2093 

◆ getSubChunk()

def lsst.geom.geometry.SphericalBoxPartitionMap.getSubChunk (   self,
  subStripe,
  theta 
)
Returns the sub-chunk number of the sub-chunk containing all points
in the given sub-stripe with the given longitude angle.

Definition at line 2094 of file geometry.py.

2094  def getSubChunk(self, subStripe, theta):
2095  """Returns the sub-chunk number of the sub-chunk containing all points
2096  in the given sub-stripe with the given longitude angle.
2097  """
2098  assert subStripe >= 0 and theta >= 0.0 and theta <= 360.0
2099  sc = int(math.floor(theta / self.subChunkWidth[subStripe]))
2100  nsc = (self.numSCPerChunk[subStripe] *
2101  self.numChunks[subStripe//self.numSSPerStripe])
2102  if sc >= nsc:
2103  sc = nsc - 1
2104  return sc
2105 

◆ getSubChunkBoundingBox()

def lsst.geom.geometry.SphericalBoxPartitionMap.getSubChunkBoundingBox (   self,
  chunkId,
  subChunkId 
)
Returns a SphericalBox bounding the given sub-chunk. Note that
this is a bounding box only - not an exact representation! In
particular, for a point p and a sub-chunk SC with bounding box B,
B.contains(p) == True does not imply that p is assigned to SC.
However, for all points p assigned to SC, B.contains(p) is True.

Definition at line 2180 of file geometry.py.

2180  def getSubChunkBoundingBox(self, chunkId, subChunkId):
2181  """Returns a SphericalBox bounding the given sub-chunk. Note that
2182  this is a bounding box only - not an exact representation! In
2183  particular, for a point p and a sub-chunk SC with bounding box B,
2184  B.contains(p) == True does not imply that p is assigned to SC.
2185  However, for all points p assigned to SC, B.contains(p) is True.
2186  """
2187  s = chunkId//(self.numStripes * 2)
2188  c = chunkId - s * self.numStripes * 2
2189  ssc = subChunkId//self.maxSCPerChunk
2190  scc = subChunkId - ssc * self.maxSCPerChunk
2191  ss = s * self.numSSPerStripe + ssc
2192  sc = c * self.numSCPerChunk[ss] + scc
2193  return self._getSubChunkBoundingBox(ss, sc)
2194 

◆ getSubChunkId()

def lsst.geom.geometry.SphericalBoxPartitionMap.getSubChunkId (   self,
  subStripe,
  subChunk 
)
Returns the sub-chunk ID of the sub-chunk with the given
sub-stripe/sub-chunk numbers.

Definition at line 2201 of file geometry.py.

2201  def getSubChunkId(self, subStripe, subChunk):
2202  """Returns the sub-chunk ID of the sub-chunk with the given
2203  sub-stripe/sub-chunk numbers.
2204  """
2205  ss = (subStripe % self.numSSPerStripe) * self.maxSCPerChunk
2206  sc = (subChunk % self.numSCPerChunk[subStripe])
2207  return ss + sc
2208 

◆ getSubStripe()

def lsst.geom.geometry.SphericalBoxPartitionMap.getSubStripe (   self,
  phi 
)
Returns the sub-stripe number of the sub-stripe containing points
with the given latitude angle.

Definition at line 2077 of file geometry.py.

2077  def getSubStripe(self, phi):
2078  """Returns the sub-stripe number of the sub-stripe containing points
2079  with the given latitude angle.
2080  """
2081  assert phi >= -90.0 and phi <= 90.0
2082  ss = int(math.floor((phi + 90.0) / self.subStripeHeight))
2083  if ss >= self.numSubStripes:
2084  ss = self.numSubStripes - 1
2085  return ss
2086 

◆ intersect()

def lsst.geom.geometry.SphericalBoxPartitionMap.intersect (   self,
  args 
)
Computes the intersection of a spherical box partitioning of the
unit sphere and one or more SphericalRegions. Results are
returned as an iterator over (chunkId, SubIterator) tuples. These
correspond to all chunks overlapping at least one input region,
and contain sub-iterators over all sub-chunks intersecting at least
one input region. The sub-iterators return (subChunkId, Regions)
tuples, where Regions is a set of the regions that intersect with
(but do not completely contain) a particular sub-chunk. Note that
Regions can be an empty set - this means that the sub-chunk
is completely contained in at least one of the input regions.

Definition at line 2277 of file geometry.py.

2277  def intersect(self, *args):
2278  """Computes the intersection of a spherical box partitioning of the
2279  unit sphere and one or more SphericalRegions. Results are
2280  returned as an iterator over (chunkId, SubIterator) tuples. These
2281  correspond to all chunks overlapping at least one input region,
2282  and contain sub-iterators over all sub-chunks intersecting at least
2283  one input region. The sub-iterators return (subChunkId, Regions)
2284  tuples, where Regions is a set of the regions that intersect with
2285  (but do not completely contain) a particular sub-chunk. Note that
2286  Regions can be an empty set - this means that the sub-chunk
2287  is completely contained in at least one of the input regions.
2288  """
2289  if len(args) == 0:
2290  return
2291  elif len(args) == 1 and not isinstance(args[0], SphericalRegion):
2292  # accept arbitrary sequences of SphericalRegion objects
2293  args = args[0]
2294  if not all(isinstance(r, SphericalRegion) for r in args):
2295  raise TypeError(
2296  'Input must consist of one or more SphericalRegion objects')
2297  # Construct list of (bounding box, region) tuples
2298  regions = []
2299  for r in args:
2300  b = r.getBoundingBox()
2301  if b.wraps():
2302  # Split boxes that wrap
2303  bMin = (0.0, b.getMin()[1])
2304  bMax = (360.0, b.getMax()[1])
2305  regions.append((SphericalBox(bMin, b.getMax()), r))
2306  # Cannot use SphericalBox constructor: 360.0 would get
2307  # range reduced to 0!
2308  b2 = SphericalBox()
2309  b2.min = b.getMin()
2310  b2.max = bMax
2311  regions.append((b2, r))
2312  else:
2313  regions.append((b, r))
2314  # Sort regions by minimum bounding box latitude angle
2315  regions.sort(key=lambda x: x[0].getMin()[1])
2316  minS = self.getStripe(
2317  max(-90.0, regions[0][0].getMin()[1] - ANGLE_EPSILON))
2318  sOverlap = _SubList(regions)
2319  sOverlap.append(0)
2320  # Loop over regions
2321  for i in range(1, len(regions)):
2322  s = self.getStripe(
2323  max(-90.0, regions[i][0].getMin()[1] - ANGLE_EPSILON))
2324  if s == minS:
2325  sOverlap.append(i)
2326  continue
2327  # All regions overlapping minS have been accumulated
2328  for x in self._processStripe(minS, s, sOverlap):
2329  yield x
2330  minS = s
2331  sOverlap.append(i)
2332  for x in self._processStripe(minS, self.numStripes, sOverlap):
2333  yield x
2334 
bool all(CoordinateExpr< N > const &expr)
Return true if all elements are true.
int max
Definition: BoundedField.cc:99

Member Data Documentation

◆ maxSCPerChunk

lsst.geom.geometry.SphericalBoxPartitionMap.maxSCPerChunk

Definition at line 2075 of file geometry.py.

◆ numChunks

lsst.geom.geometry.SphericalBoxPartitionMap.numChunks

Definition at line 2065 of file geometry.py.

◆ numSCPerChunk

lsst.geom.geometry.SphericalBoxPartitionMap.numSCPerChunk

Definition at line 2067 of file geometry.py.

◆ numSSPerStripe

lsst.geom.geometry.SphericalBoxPartitionMap.numSSPerStripe

Definition at line 2059 of file geometry.py.

◆ numStripes

lsst.geom.geometry.SphericalBoxPartitionMap.numStripes

Definition at line 2058 of file geometry.py.

◆ numSubStripes

lsst.geom.geometry.SphericalBoxPartitionMap.numSubStripes

Definition at line 2060 of file geometry.py.

◆ stripeHeight

lsst.geom.geometry.SphericalBoxPartitionMap.stripeHeight

Definition at line 2063 of file geometry.py.

◆ subChunkWidth

lsst.geom.geometry.SphericalBoxPartitionMap.subChunkWidth

Definition at line 2068 of file geometry.py.

◆ subStripeHeight

lsst.geom.geometry.SphericalBoxPartitionMap.subStripeHeight

Definition at line 2064 of file geometry.py.


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