LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
lsst.dax.apdb.pixelization.Pixelization Class Reference

Public Member Functions

 __init__ (self, str pixelization, int pix_level, int pix_max_ranges)
 
list[int] pixels (self, sphgeom.Region region)
 
int pixel (self, sphgeom.UnitVector3d direction)
 
list[tuple[int, int]] envelope (self, sphgeom.Region region)
 

Public Attributes

 pixelator
 

Protected Attributes

 _pix_max_ranges
 

Detailed Description

Wrapper for pixelization classes from `sphgeom` with configurable
pixelization type and parameters.

Parameters
----------
pixelization : `str`
    Name of a pixelization type, one of ""htm", "q3c", or "mq3c"
pix_level : `int`
    Pixelization level.
pix_max_ranges : `int`
    Maximum number of ranges returned from `envelope()` method.

Definition at line 33 of file pixelization.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.dax.apdb.pixelization.Pixelization.__init__ ( self,
str pixelization,
int pix_level,
int pix_max_ranges )

Definition at line 47 of file pixelization.py.

47 def __init__(self, pixelization: str, pix_level: int, pix_max_ranges: int):
48 if pixelization == "htm":
49 self.pixelator = sphgeom.HtmPixelization(pix_level)
50 elif pixelization == "q3c":
51 self.pixelator = sphgeom.Q3cPixelization(pix_level)
52 elif pixelization == "mq3c":
53 self.pixelator = sphgeom.Mq3cPixelization(pix_level)
54 else:
55 raise ValueError(f"unknown pixelization: {pixelization}")
56 self._pix_max_ranges = pix_max_ranges
57

Member Function Documentation

◆ envelope()

list[tuple[int, int]] lsst.dax.apdb.pixelization.Pixelization.envelope ( self,
sphgeom.Region region )
Generate a set of HTM indices covering specified region.

Parameters
----------
region: `sphgeom.Region`
    Region that needs to be indexed.

Returns
-------
ranges : `list` of `tuple`
    Sequence of ranges, range is a tuple (minHtmID, maxHtmID).

Definition at line 82 of file pixelization.py.

82 def envelope(self, region: sphgeom.Region) -> list[tuple[int, int]]:
83 """Generate a set of HTM indices covering specified region.
84
85 Parameters
86 ----------
87 region: `sphgeom.Region`
88 Region that needs to be indexed.
89
90 Returns
91 -------
92 ranges : `list` of `tuple`
93 Sequence of ranges, range is a tuple (minHtmID, maxHtmID).
94 """
95 _LOG.debug("region: %s", region)
96 indices = self.pixelator.envelope(region, self._pix_max_ranges)
97
98 if _LOG.isEnabledFor(logging.DEBUG):
99 for irange in indices.ranges():
100 _LOG.debug(
101 "range: %s %s",
102 self.pixelator.toString(irange[0]),
103 self.pixelator.toString(irange[1]),
104 )
105
106 return indices.ranges()

◆ pixel()

int lsst.dax.apdb.pixelization.Pixelization.pixel ( self,
sphgeom.UnitVector3d direction )
Compute the index of the pixel for given direction.

Parameters
----------
direction : `lsst.sphgeom.UnitVector3d`

Definition at line 72 of file pixelization.py.

72 def pixel(self, direction: sphgeom.UnitVector3d) -> int:
73 """Compute the index of the pixel for given direction.
74
75 Parameters
76 ----------
77 direction : `lsst.sphgeom.UnitVector3d`
78 """
79 index = self.pixelator.index(direction)
80 return index
81
table::PointKey< int > pixel

◆ pixels()

list[int] lsst.dax.apdb.pixelization.Pixelization.pixels ( self,
sphgeom.Region region )
Compute set of the pixel indices for given region.

Parameters
----------
region : `lsst.sphgeom.Region`

Definition at line 58 of file pixelization.py.

58 def pixels(self, region: sphgeom.Region) -> list[int]:
59 """Compute set of the pixel indices for given region.
60
61 Parameters
62 ----------
63 region : `lsst.sphgeom.Region`
64 """
65 # we want finest set of pixels, so ask as many pixel as possible
66 ranges = self.pixelator.envelope(region, 1_000_000)
67 indices = []
68 for lower, upper in ranges:
69 indices += list(range(lower, upper))
70 return indices
71

Member Data Documentation

◆ _pix_max_ranges

lsst.dax.apdb.pixelization.Pixelization._pix_max_ranges
protected

Definition at line 56 of file pixelization.py.

◆ pixelator

lsst.dax.apdb.pixelization.Pixelization.pixelator

Definition at line 49 of file pixelization.py.


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