22__all__ = (
"SkyMapDimensionPacker",)
24from lsst.daf.butler
import DimensionPacker, DimensionGraph, DataCoordinate
28 """A `DimensionPacker` for tract, patch and optionally band,
33 fixed : `lsst.daf.butler.DataCoordinate`
34 Expanded data ID that must include at least the skymap dimension.
35 dimensions : `lsst.daf.butler.DimensionGraph`
36 The dimensions of data IDs packed by this instance. Must include
37 skymap, tract, and patch,
and may include band.
42 + list(
"ugrizyUBGVRIZYJHK")
43 + [f
"N{d}" for d
in (387, 515, 656, 816, 921, 1010)]
45 """band names supported by this packer.
47 New filters should be added to the end of the list to maximize
48 compatibility with existing IDs.
53 """Return an integer that represents the band with the given
59 raise NotImplementedError(f
"band '{name}' not supported by this ID packer.")
63 """Return an band name from its integer representation.
74 assert dimensions.given == [
"skymap"]
75 assert dimensions.required.issuperset([
"tract",
"patch"])
76 metadata = {
"skymap": [
"tract_max",
"patch_nx_max",
"patch_ny_max"]}
80 def __init__(self, fixed: DataCoordinate, dimensions: DimensionGraph):
82 record = fixed.records[
"skymap"]
84 self.
_patchMax = record.patch_nx_max * record.patch_ny_max
86 if "band" in dimensions:
97 return packedMax.bit_length()
99 def _pack(self, dataId: DataCoordinate) -> int:
101 packed = dataId[
"patch"] + self.
_patchMax*dataId[
"tract"]
106 def unpack(self, packedId: int) -> DataCoordinate:
114 return DataCoordinate.standardize(d, graph=self.dimensions)
def getFilterNameFromInt(cls, num)
def __init__(self, DataCoordinate fixed, DimensionGraph dimensions)
def getMaxIntForFilters(cls)
def getIntFromFilter(cls, name)
def configure(cls, dimensions)
DataCoordinate unpack(self, int packedId)