LSST Applications g0f08755f38+c89d42e150,g1635faa6d4+b6cf076a36,g1653933729+a8ce1bb630,g1a0ca8cf93+4c08b13bf7,g28da252d5a+f33f8200ef,g29321ee8c0+0187be18b1,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+e740673f1a,g5fbc88fb19+17cd334064,g7642f7d749+c89d42e150,g781aacb6e4+a8ce1bb630,g80478fca09+f8b2ab54e1,g82479be7b0+e2bd23ab8b,g858d7b2824+c89d42e150,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+065360aec4,gacf8899fa4+9553554aa7,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gbd46683f8f+ac57cbb13d,gc28159a63d+9634bc57db,gcf0d15dbbd+e37acf7834,gda3e153d99+c89d42e150,gda6a2b7d83+e37acf7834,gdaeeff99f8+1711a396fd,ge2409df99d+cb1e6652d6,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+02b11634a5,w.2024.45
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: