LSST Applications g04a91732dc+146a938ab0,g07dc498a13+80b84b0d75,g0fba68d861+0decac7526,g1409bbee79+80b84b0d75,g1a7e361dbc+80b84b0d75,g1fd858c14a+f6e422e056,g20f46db602+483a84333a,g21d47ad084+4a6cd485de,g35bb328faa+fcb1d3bbc8,g42c1b31a95+a1301e4c20,g4d39ba7253+9b833be27e,g4e0f332c67+5d362be553,g53246c7159+fcb1d3bbc8,g60b5630c4e+9b833be27e,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g8852436030+790117df0f,g89139ef638+80b84b0d75,g8d6b6b353c+9b833be27e,g9125e01d80+fcb1d3bbc8,g989de1cb63+80b84b0d75,g9f33ca652e+9c6b68d7f3,ga9baa6287d+9b833be27e,gaaedd4e678+80b84b0d75,gabe3b4be73+1e0a283bba,gb1101e3267+9f3571abad,gb58c049af0+f03b321e39,gb90eeb9370+691e4ab549,gc741bbaa4f+5f483edd21,gcf25f946ba+790117df0f,gd24842266e+c54cdbdbd2,gd315a588df+5b65d88fe4,gd6cbbdb0b4+c8606af20c,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+c99546153d,ge278dab8ac+932305ba37,ge82c20c137+76d20ab76d,w.2025.10
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst.meas.base.pluginRegistry Namespace Reference

Classes

class  PluginMap
 
class  PluginRegistry
 

Functions

 generateAlgorithmName (AlgClass)
 
 register (name, shouldApCorr=False, apCorrList=())
 

Detailed Description

Registry for measurement plugins and utilities for plugin management.

Function Documentation

◆ generateAlgorithmName()

lsst.meas.base.pluginRegistry.generateAlgorithmName ( AlgClass)
Generate a name for an algorithm.

This generates a short name for an algorithmic class that strips away
terms that are generally redundant while remaining easy to trace to the
code.

Parameters
----------
AlgClass : subclass of `BaseAlgorithm`
    The class to generate a name for.

Returns
-------
name : `str`
    A short name for the algorithm.

Notes
-----
The returned name will cobmine the package name, with any ``lsst`` and/or
``meas`` prefix removed, with the class name, with any ``Algorithm``
suffix removed.  For instance, ``lsst.meas.base.SdssShapeAlgorithm``
becomes ``base_SdssShape``.

Definition at line 34 of file pluginRegistry.py.

34def generateAlgorithmName(AlgClass):
35 """Generate a name for an algorithm.
36
37 This generates a short name for an algorithmic class that strips away
38 terms that are generally redundant while remaining easy to trace to the
39 code.
40
41 Parameters
42 ----------
43 AlgClass : subclass of `BaseAlgorithm`
44 The class to generate a name for.
45
46 Returns
47 -------
48 name : `str`
49 A short name for the algorithm.
50
51 Notes
52 -----
53 The returned name will cobmine the package name, with any ``lsst`` and/or
54 ``meas`` prefix removed, with the class name, with any ``Algorithm``
55 suffix removed. For instance, ``lsst.meas.base.SdssShapeAlgorithm``
56 becomes ``base_SdssShape``.
57 """
58 name = AlgClass.__name__
59 pkg = AlgClass.__module__
60 name = name.replace("Algorithm", "")
61 terms = pkg.split(".")
62 # Hide private module name only if it's part of a public package
63 if len(terms) > 1 and terms[-1].startswith("_"):
64 terms = terms[:-1]
65 if len(terms) > 1 and terms[-1].endswith("Lib"):
66 terms = terms[:-1]
67 if terms[0] == "lsst":
68 terms = terms[1:]
69 if terms[0] == "meas":
70 terms = terms[1:]
71 if name.lower().startswith(terms[-1].lower()):
72 terms = terms[:-1]
73 return "%s_%s" % ("_".join(terms), name)
74
75

◆ register()

lsst.meas.base.pluginRegistry.register ( name,
shouldApCorr = False,
apCorrList = () )
A decorator to register a plugin class in its base class's registry.

Parameters
----------
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.

Definition at line 163 of file pluginRegistry.py.

163def register(name, shouldApCorr=False, apCorrList=()):
164 """A decorator to register a plugin class in its base class's registry.
165
166 Parameters
167 ----------
168 shouldApCorr : `bool`
169 If `True`, then this algorithm measures an instFlux that should be
170 aperture corrected. This is shorthand for ``apCorrList=[name]`` and is
171 ignored if ``apCorrList`` is specified.
172 apCorrList : `list` of `str`
173 List of field name prefixes for instFlux fields to be aperture
174 corrected. If an algorithm produces a single instFlux that should be
175 aperture corrected then it is simpler to set ``shouldApCorr=True``.
176 But if an algorithm produces multiple such fields then it must specify
177 ``apCorrList`` instead. For example, ``modelfit_CModel`` produces
178 three such fields: ``apCorrList=("modelfit_CModel_exp",
179 "modelfit_CModel_exp", "modelfit_CModel_def")``. If ``apCorrList`` is
180 not empty then shouldApCorr is ignored.
181
182 """
183
184 def decorate(PluginClass):
185 PluginClass.registry.register(name, PluginClass, shouldApCorr=shouldApCorr, apCorrList=apCorrList)
186 return PluginClass
187 return decorate
188
189