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)]
44 + [f
"N{d}" for d
in (419, 540, 708, 964)]
46 """band names supported by this packer.
48 New filters should be added to the end of the list to maximize
49 compatibility with existing IDs.
54 """Return an integer that represents the band with the given
60 raise NotImplementedError(f
"band '{name}' not supported by this ID packer.")
64 """Return an band name from its integer representation.
75 assert dimensions.given == [
"skymap"]
76 assert dimensions.required.issuperset([
"tract",
"patch"])
77 metadata = {
"skymap": [
"tract_max",
"patch_nx_max",
"patch_ny_max"]}
81 def __init__(self, fixed: DataCoordinate, dimensions: DimensionGraph):
83 record = fixed.records[
"skymap"]
85 self.
_patchMax = record.patch_nx_max * record.patch_ny_max
87 if "band" in dimensions:
98 return packedMax.bit_length()
100 def _pack(self, dataId: DataCoordinate) -> int:
102 packed = dataId[
"patch"] + self.
_patchMax*dataId[
"tract"]
107 def unpack(self, packedId: int) -> DataCoordinate:
115 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)