PluginRegistry¶
- class lsst.meas.base.PluginRegistry(configBaseType=<class 'lsst.pex.config.config.Config'>)¶
Bases:
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.
- defaultobject, optional
The default target for the field.
- optional
bool
, optional When
False
,lsst.pex.config.Config.validate
fails if the field’s value isNone
.- multi
bool
, optional A flag to allow multiple selections in the
RegistryField
ifTrue
.- on_none: `Callable`, optional
A callable that should be invoked when
apply
is called but the selected name or names isNone
. Will be passed the field attribute proxy (RegistryInstanceDict
) and then all positional and keyword arguments passed toapply
.
- doc
- Returns:
- field
lsst.pex.config.RegistryField
RegistryField
Configuration field.
- 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 inlsst.meas.base
that measures Gaussian Flux and produces fields such asbase_GaussianFlux_instFlux
,base_GaussianFlux_instFluxErr
andbase_GaussianFlux_flag
.- shouldApCorr
bool
If
True
, then this algorithm measures an instFlux that should be aperture corrected. This is shorthand forapCorrList=[name]
and is ignored ifapCorrList
is specified.- apCorrList
list
ofstr
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 specifyapCorrList
instead. For example,modelfit_CModel
produces three such fields:apCorrList=("modelfit_CModel_exp", "modelfit_CModel_exp", "modelfit_CModel_def")
. IfapCorrList
is not empty then shouldApCorr is ignored.
- name
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 ¶