PluginRegistry

class lsst.meas.base.PluginRegistry(configBaseType=<class 'lsst.pex.config.config.Config'>)

Bases: lsst.pex.config.Registry

Base class for plugin registries.

Notes

The class of plugins allowed in the registry is defined in the constructor of the registry.

Single-frame and forced plugins have different registries.

Methods Summary

get(k[,d])
items()
keys()
makeField(doc[, default, optional, multi]) Create a RegistryField configuration field from this registry.
register(name, PluginClass[, shouldApCorr, …]) Register a plugin class with the given name.
values()

Methods Documentation

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
makeField(doc, default=None, optional=False, multi=False)

Create a RegistryField configuration field from this registry.

Parameters:
doc : str

A description of the field.

default : object, optional

The default target for the field.

optional : bool, optional

When False, lsst.pex.config.Config.validate fails if the field’s value is None.

multi : bool, optional

A flag to allow multiple selections in the RegistryField if True.

Returns:
field : lsst.pex.config.RegistryField

RegistryField Configuration field.

register(name, PluginClass, shouldApCorr=False, apCorrList=())

Register a plugin class with the given name.

Parameters:
name : str

The name of the plugin. This is used as a prefix for all fields produced by the plugin, and it should generally contain the name of the plugin or algorithm class itself as well as enough of the namespace to make it clear where to find the code. For example base_GaussianFlux indicates an algorithm in lsst.meas.base that measures Gaussian Flux and produces fields such as base_GaussianFlux_instFlux, base_GaussianFlux_instFluxErr and base_GaussianFlux_flag.

shouldApCorr : bool

If True, then this algorithm measures an instFlux that should be aperture corrected. This is shorthand for apCorrList=[name] and is ignored if apCorrList is specified.

apCorrList : list of str

List of field name prefixes for instFlux fields to be aperture corrected. If an algorithm produces a single instFlux that should be aperture corrected then it is simpler to set shouldApCorr=True. But if an algorithm produces multiple such fields then it must specify apCorrList instead. For example, modelfit_CModel produces three such fields: apCorrList=("modelfit_CModel_exp", "modelfit_CModel_exp", "modelfit_CModel_def"). If apCorrList is not empty then shouldApCorr is ignored.

Notes

The same plugin may be registered multiple times with different names; this can be useful if we often want to run it multiple times with different configuration.

values() → an object providing a view on D's values