FullIdGenerator

class lsst.meas.base.FullIdGenerator(dimension_packer: DimensionPacker, data_id: DataCoordinate, release_id: int = 0, n_releases: int = 1)

Bases: IdGenerator

The subclass of IdGenerator that actually includes packed data IDs and release IDs in its generated IDs.

Parameters:
dimension_packerlsst.daf.butler.DimensionPacker

Object that packs data IDs into integers.

data_idlsst.daf.butler.DataCoordinate

Data ID to embed in all generated IDs and random seeds.

release_idint, optional

Release identifier to embed in generated IDs.

n_releasesint, optional

Number of (contiguous, starting from zero) release_id values to reserve space for. One (not zero) is used to reserve no space.

Notes

Instances of this class should usually be constructed via configuration instead of by calling the constructor directly; see IdGenerator for details.

Attributes Summary

catalog_id

The integer identifier for the full catalog with this data ID, not just one of its rows (int).

data_id

The data ID that will be embedded in all generated IDs (DataCoordinate).

release_id

The release ID that will embedded in all generated IDs (int).

Methods Summary

arange(*args, **kwargs)

Generate an array of integer IDs for this catalog.

make_source_catalog(schema)

Construct a empty catalog object with an ID factory.

make_table_id_factory()

Construct a new lsst.afw.table.IdFactory for this catalog.

unpacker_from_config(config, fixed)

Return a callable that unpacks the IDs generated by this class, from a config field.

unpacker_from_dimension_packer(dimension_packer)

Return a callable that unpacks the IDs generated by this class, from a lsst.daf.butler.DimensionPacker instance.

Attributes Documentation

catalog_id
data_id

The data ID that will be embedded in all generated IDs (DataCoordinate).

release_id

The release ID that will embedded in all generated IDs (int).

Methods Documentation

arange(*args, **kwargs) ndarray

Generate an array of integer IDs for this catalog.

All parameters are forwarded to numpy.arange to generate an array of per-catalog counter integers. These are then combined with the catalog_id` to form the returned array.

The IDs generated by arange will be equivalent to those generated by make_table_id_factory (and by extension, make_source_catalog) only if the counter integers start with 1, not 0, because that’s what IdFactory does.

make_source_catalog(schema: Schema) SourceCatalog

Construct a empty catalog object with an ID factory.

This is a convenience function for the common pattern of calling make_table_id_factory, constructing a SourceTable from that, and then constructing an (empty) SourceCatalog from that.

make_table_id_factory() IdFactory

Construct a new lsst.afw.table.IdFactory for this catalog.

classmethod unpacker_from_config(config: BaseIdGeneratorConfig, fixed: DataCoordinate) Callable[[int], tuple[lsst.daf.butler.dimensions._coordinate.DataCoordinate, int]]

Return a callable that unpacks the IDs generated by this class, from a config field.

Parameters:
configBaseIdGeneratorConfig

Configuration for an ID generator.

fixedDataCoordinate

Data ID identifying the dimensions that are considered fixed by the IdGenerator that produced the IDs: usually just instrument or skymap, depending on the configuration. For most configurations this will need to be a fully-expanded data ID.

Returns:
unpacker

Callable that takes a single int argument (an ID generated by an identically-configured IdGenerator) and returns a tuple of:

  • release_id: the integer that identifies a data release or similar (int);

  • data_id : the data ID used to initialize the original ID generator (DataCoordinate);

  • counter : the counter part of the original ID (int).

Notes

This method cannot be used on IDs generated without a data ID.

classmethod unpacker_from_dimension_packer(dimension_packer: DimensionPacker, n_releases: int = 1) Callable[[int], tuple[int, lsst.daf.butler.dimensions._coordinate.DataCoordinate, int]]

Return a callable that unpacks the IDs generated by this class, from a lsst.daf.butler.DimensionPacker instance.

Parameters:
dimension_packerlsst.daf.butler.DimensionPacker

Dimension packer used to construct the original DimensionPackerIdGenerator.

n_releasesint, optional

Number of (contiguous, starting from zero) release_id values to reserve space for. One (not zero) is used to reserve no space.

Returns:
unpacker

Callable that takes a single int argument (an ID generated by an identically-constructed DimensionPackerIdGenerator) and returns a tuple of:

  • release_id: the integer that identifies a data release or similar (int);

  • data_id : the data ID used to initialize the original ID generator (DataCoordinate);

  • counter : the counter part of the original ID (int).

Notes

This method cannot be used on IDs generated with no data ID.