lsst.skymap ga8c6da7877+7a34fce641
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
lsst.skymap.packers.SkyMapDimensionPacker Class Reference
Inheritance diagram for lsst.skymap.packers.SkyMapDimensionPacker:

Public Member Functions

 __init__ (self, DataCoordinate fixed, DimensionGroup|DimensionGraph|None dimensions=None, Mapping[str, int]|None bands=None, int|None n_bands=None, int|None n_tracts=None, int|None n_patches=None)
 
ConfigurableField make_config_field (cls, str doc="How to pack tract, patch, and possibly band into an integer.")
 
SkyMapDimensionPacker from_config (cls, DataCoordinate data_id, SkyMapDimensionPackerConfig config)
 
int maxBits (self)
 
DataCoordinate unpack (self, int packedId)
 

Static Public Attributes

tuple SUPPORTED_FILTERS
 
 ConfigClass = SkyMapDimensionPackerConfig
 

Protected Member Functions

int _pack (self, DataCoordinate dataId)
 

Protected Attributes

 _bands
 
 _n_bands
 
 _n_tracts
 
 _n_patches
 
 _bands_list
 

Detailed Description

A `DimensionPacker` for tract, patch and optionally band,
given a SkyMap.

Parameters
----------
fixed : `lsst.daf.butler.DataCoordinate`
    Data ID that identifies just the ``skymap`` dimension.  Must have
    dimension records attached unless ``n_tracts`` and ``n_patches`` are
    not `None`.
dimensions : `lsst.daf.butler.DimensionGraph`, or \
        `lsst.daf.butler.DimensionGroup`, optional
    The dimensions of data IDs packed by this instance.  Must include
    ``{skymap, tract, patch}``, and may include ``band``.  If not provided,
    this will be set to include ``band`` if ``n_bands != 0``.
bands : `~collections.abc.Mapping` [ `str`, `int` ] or `None`, optional
    Mapping from band name to integer to use in the packed ID.  `None` uses
    a fixed set of bands defined in this class.  When calling code can
    enumerate the bands it is likely to see, providing an explicit mapping
    is preferable.
n_bands : `int` or `None`, optional
    The number of bands to leave room for in the packed ID.  If `None`,
    this will be set to ``len(bands)``.  If ``0``, the band will not be
    included in the dimensions at all.  If ``1``, the band will be included
    in the dimensions but will not occupy any extra bits in the packed ID.
    This may be larger or smaller than ``len(bands)``, to reserve extra
    space for the future or align to byte boundaries, or support a subset
    of a larger mapping, respectively.
n_tracts : `int` or `None`, optional
    The number of tracts to leave room for in the packed ID.  If `None`,
    this will be set via the ``skymap`` dimension record in ``fixed``.
n_patches : `int` or `None`, optional
    The number of patches (per tract) to leave room for in the packed ID.
    If `None`, this will be set via the ``skymap`` dimension record in
    ``fixed``.

Notes
-----
The standard pattern for constructing instances of this class is to use
`make_config_field`::

    class SomeConfig(lsst.pex.config.Config):
        packer = ObservationDimensionPacker.make_config_field()

    class SomeTask(lsst.pipe.base.Task):
        ConfigClass = SomeConfig

        def run(self, ..., data_id: DataCoordinate):
            packer = self.config.packer.apply(data_id)
            packed_id = packer.pack(data_id)
            ...

Definition at line 67 of file packers.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.skymap.packers.SkyMapDimensionPacker.__init__ ( self,
DataCoordinate fixed,
DimensionGroup | DimensionGraph | None dimensions = None,
Mapping[str, int] | None bands = None,
int | None n_bands = None,
int | None n_tracts = None,
int | None n_patches = None )

Definition at line 137 of file packers.py.

Member Function Documentation

◆ _pack()

int lsst.skymap.packers.SkyMapDimensionPacker._pack ( self,
DataCoordinate dataId )
protected

Definition at line 247 of file packers.py.

◆ from_config()

SkyMapDimensionPacker lsst.skymap.packers.SkyMapDimensionPacker.from_config ( cls,
DataCoordinate data_id,
SkyMapDimensionPackerConfig config )
Construct a dimension packer from a config object and a data ID.

Parameters
----------
data_id : `lsst.daf.butler.DataCoordinate`
    Data ID that identifies at least the ``skymap`` dimension.  Must
    have dimension records attached unless ``config.n_tracts`` and
    ``config.n_patches`` are both not `None`.
config : `SkyMapDimensionPackerConfig`
    Configuration object.

Returns
-------
packer : `SkyMapDimensionPackerConfig`
    New dimension packer.

Notes
-----
This interface is provided for consistency with the `lsst.pex.config`
"Configurable" concept, and is invoked when ``apply(data_id)`` is
called on a config instance attribute that corresponds to a field
created by `make_config_field`.  The constructor signature cannot play
this role easily for backwards compatibility reasons.

Definition at line 204 of file packers.py.

◆ make_config_field()

ConfigurableField lsst.skymap.packers.SkyMapDimensionPacker.make_config_field ( cls,
str doc = "How to pack tract, patch, and possibly band into an integer." )
Make a config field to control how skymap data IDs are packed.

Parameters
----------
doc : `str`, optional
    Documentation for the config field.

Returns
-------
field : `lsst.pex.config.ConfigurableField`
    A config field whose instance values are [wrapper proxies to]
    `SkyMapDimensionPackerConfig` instances.

Definition at line 184 of file packers.py.

◆ maxBits()

int lsst.skymap.packers.SkyMapDimensionPacker.maxBits ( self)

Definition at line 240 of file packers.py.

◆ unpack()

DataCoordinate lsst.skymap.packers.SkyMapDimensionPacker.unpack ( self,
int packedId )

Definition at line 268 of file packers.py.

Member Data Documentation

◆ _bands

lsst.skymap.packers.SkyMapDimensionPacker._bands
protected

Definition at line 177 of file packers.py.

◆ _bands_list

lsst.skymap.packers.SkyMapDimensionPacker._bands_list
protected

Definition at line 181 of file packers.py.

◆ _n_bands

lsst.skymap.packers.SkyMapDimensionPacker._n_bands
protected

Definition at line 178 of file packers.py.

◆ _n_patches

lsst.skymap.packers.SkyMapDimensionPacker._n_patches
protected

Definition at line 180 of file packers.py.

◆ _n_tracts

lsst.skymap.packers.SkyMapDimensionPacker._n_tracts
protected

Definition at line 179 of file packers.py.

◆ ConfigClass

lsst.skymap.packers.SkyMapDimensionPacker.ConfigClass = SkyMapDimensionPackerConfig
static

Definition at line 135 of file packers.py.

◆ SUPPORTED_FILTERS

tuple lsst.skymap.packers.SkyMapDimensionPacker.SUPPORTED_FILTERS
static
Initial value:
= (
[None]
+ list("ugrizyUBGVRIZYJHK") # split string into single chars
+ [f"N{d}" for d in (387, 515, 656, 816, 921, 1010)] # HSC narrow-bands
+ [f"N{d}" for d in (419, 540, 708, 964)] # DECam narrow-bands
)

Definition at line 121 of file packers.py.


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