LSST Applications g02d81e74bb+86cf3d8bc9,g180d380827+7a4e862ed4,g2079a07aa2+86d27d4dc4,g2305ad1205+e1ca1c66fa,g29320951ab+012e1474a1,g295015adf3+341ea1ce94,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+c429d67c83,g48712c4677+f88676dd22,g487adcacf7+27e1e21933,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+b41db86c35,g5a732f18d5+53520f316c,g64a986408d+86cf3d8bc9,g858d7b2824+86cf3d8bc9,g8a8a8dda67+585e252eca,g99cad8db69+84912a7fdc,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+a2b54eae19,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+6681f309db,gc120e1dc64+f0fcc2f6d8,gc28159a63d+0e5473021a,gcf0d15dbbd+c429d67c83,gdaeeff99f8+f9a426f77a,ge6526c86ff+0433e6603d,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+86cf3d8bc9,w.2024.17
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
lsst.meas.base._id_generator.BaseIdGeneratorConfig Class Reference
Inheritance diagram for lsst.meas.base._id_generator.BaseIdGeneratorConfig:
lsst.pex.config.config.Config lsst.pex.config.config.ConfigMeta lsst.meas.base._id_generator.DetectorExposureIdGeneratorConfig lsst.meas.base._id_generator.DetectorVisitIdGeneratorConfig lsst.meas.base._id_generator.SkyMapIdGeneratorConfig

Public Member Functions

 make_field (cls, doc="Configuration for how to generate catalog IDs from data IDs.")
 
IdGenerator apply (self, DataCoordinate data_id, **Any kwargs)
 

Static Public Attributes

 release_id
 
 n_releases
 

Protected Member Functions

DimensionPacker _make_dimension_packer (self, DataCoordinate data_id)
 

Detailed Description

Base class for configuration of `IdGenerator` instances.

This class is abstract (it cannot use `abc.ABCMeta` due to a metaclass
conflict), and it should mostly be considered an implementation detail
of how the attributes it defines are included in its concrete derived
classes.  Derived classes must implemented `_make_dimension_packer`.

See `IdGenerator` for usage.

Definition at line 54 of file _id_generator.py.

Member Function Documentation

◆ _make_dimension_packer()

DimensionPacker lsst.meas.base._id_generator.BaseIdGeneratorConfig._make_dimension_packer ( self,
DataCoordinate data_id )
protected
Abstract hook for building a dimension packer from configuration.

Parameters
----------
data_id : `DataCoordinate`
    The data ID the `IdGenerator` will embed into all IDs.  This
    generally must be a fully-expanded data ID (i.e. have dimension
    records attached), that identifies the "instrument" or "skymap"
    dimension, though this requirement may be relaxed for certain
    dimension packer types.

Returns
-------
packer : `lsst.daf.butler.DimensionPacker`
    Object that packs data IDs into integers.

Reimplemented in lsst.meas.base._id_generator.DetectorExposureIdGeneratorConfig, lsst.meas.base._id_generator.DetectorVisitIdGeneratorConfig, and lsst.meas.base._id_generator.SkyMapIdGeneratorConfig.

Definition at line 151 of file _id_generator.py.

151 def _make_dimension_packer(self, data_id: DataCoordinate) -> DimensionPacker:
152 """Abstract hook for building a dimension packer from configuration.
153
154 Parameters
155 ----------
156 data_id : `DataCoordinate`
157 The data ID the `IdGenerator` will embed into all IDs. This
158 generally must be a fully-expanded data ID (i.e. have dimension
159 records attached), that identifies the "instrument" or "skymap"
160 dimension, though this requirement may be relaxed for certain
161 dimension packer types.
162
163 Returns
164 -------
165 packer : `lsst.daf.butler.DimensionPacker`
166 Object that packs data IDs into integers.
167 """
168 raise NotImplementedError("Method is abstract.")
169
170

◆ apply()

IdGenerator lsst.meas.base._id_generator.BaseIdGeneratorConfig.apply ( self,
DataCoordinate data_id,
**Any kwargs )
Construct an `IdGenerator` instance from this configuration.

Parameters
----------
data_id : `DataCoordinate`
    The data ID the `IdGenerator` will embed into all IDs.  This
    generally must be a fully-expanded data ID (i.e. have dimension
    records attached), that identifies the "instrument" or "skymap"
    dimension, though this requirement may be relaxed for certain
    dimension packer types.
**kwargs
    Additional keyword arguments are interpreted as dimension value
    pairs to include in the data ID.  This may be used to provide
    constraints on dimensions for which records are not available.

Returns
-------
id_generator : `IdGenerator`
    Object that generates integer IDs for catalogs and their rows by
    embedding the given data ID and a configurably-optional release ID.

Notes
-----
This method is called `apply` for consistency with the pattern of using
`lsst.pex.config.ConfigurableField` and `lsst.pex.config.RegistryField`
to construct the objects whose configuration they hold.  It doesn't
actually use those mechanisms because we have many config classes for
the one `IdGenerator` class, instead of the other way around, and as a
result a "config as factory" approach works better.

Definition at line 112 of file _id_generator.py.

112 def apply(self, data_id: DataCoordinate, **kwargs: Any) -> IdGenerator:
113 """Construct an `IdGenerator` instance from this configuration.
114
115 Parameters
116 ----------
117 data_id : `DataCoordinate`
118 The data ID the `IdGenerator` will embed into all IDs. This
119 generally must be a fully-expanded data ID (i.e. have dimension
120 records attached), that identifies the "instrument" or "skymap"
121 dimension, though this requirement may be relaxed for certain
122 dimension packer types.
123 **kwargs
124 Additional keyword arguments are interpreted as dimension value
125 pairs to include in the data ID. This may be used to provide
126 constraints on dimensions for which records are not available.
127
128 Returns
129 -------
130 id_generator : `IdGenerator`
131 Object that generates integer IDs for catalogs and their rows by
132 embedding the given data ID and a configurably-optional release ID.
133
134 Notes
135 -----
136 This method is called `apply` for consistency with the pattern of using
137 `lsst.pex.config.ConfigurableField` and `lsst.pex.config.RegistryField`
138 to construct the objects whose configuration they hold. It doesn't
139 actually use those mechanisms because we have many config classes for
140 the one `IdGenerator` class, instead of the other way around, and as a
141 result a "config as factory" approach works better.
142 """
143 packer = self._make_dimension_packer(data_id)
144 return FullIdGenerator(
145 packer,
146 DataCoordinate.standardize(data_id, **kwargs, dimensions=packer.dimensions),
147 release_id=self.release_id,
148 n_releases=self.n_releases,
149 )
150

◆ make_field()

lsst.meas.base._id_generator.BaseIdGeneratorConfig.make_field ( cls,
doc = "Configuration for how to generate catalog IDs from data IDs." )
Return a config field that holds an instance of this class.

Parameters
----------
doc : `str`, optional
    Documentation for the config field.  As this configuration almost
    always plays the same role in any parent config, the default is
    usually fine.

Returns
-------
field : `lsst.pex.config.ConfigField`
    New config field for instances of this class.

Notes
-----
This method is provided as a convenience to reduce boilerplate
downstream: it typically saves an import or two, and it allows the same
usually-appropriate docstring to be reused instead of rewritten each
time.  It does not need to be used in order to use this config class.

Definition at line 86 of file _id_generator.py.

88 ):
89 """Return a config field that holds an instance of this class.
90
91 Parameters
92 ----------
93 doc : `str`, optional
94 Documentation for the config field. As this configuration almost
95 always plays the same role in any parent config, the default is
96 usually fine.
97
98 Returns
99 -------
100 field : `lsst.pex.config.ConfigField`
101 New config field for instances of this class.
102
103 Notes
104 -----
105 This method is provided as a convenience to reduce boilerplate
106 downstream: it typically saves an import or two, and it allows the same
107 usually-appropriate docstring to be reused instead of rewritten each
108 time. It does not need to be used in order to use this config class.
109 """
110 return ConfigField(doc, dtype=cls)
111

Member Data Documentation

◆ n_releases

lsst.meas.base._id_generator.BaseIdGeneratorConfig.n_releases
static
Initial value:
= Field(
doc=(
"Number of (contiguous, starting from zero) `release_id` values to reserve space for. "
"One (not zero) is used to reserve no space."
),
dtype=int,
default=DEFAULT_N_RELEASES,
check=lambda x: x > 0,
)

Definition at line 75 of file _id_generator.py.

◆ release_id

lsst.meas.base._id_generator.BaseIdGeneratorConfig.release_id
static
Initial value:
= Field(
doc=(
"Identifier for a data release or other version to embed in generated IDs. "
"Zero is reserved for IDs with no embedded release identifier."
),
dtype=int,
default=DEFAULT_RELEASE_ID,
check=lambda x: x >= 0,
)

Definition at line 65 of file _id_generator.py.


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