LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
Classes | Functions
lsst.meas.base.pluginRegistry Namespace Reference

Classes

class  PluginMap
 
class  PluginRegistry
 

Functions

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

Function Documentation

◆ generateAlgorithmName()

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

34 def 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()

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

163 def 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 
lsst::meas::base.pluginRegistry.generateAlgorithmName
def generateAlgorithmName(AlgClass)
Definition: pluginRegistry.py:34
lsst::meas::base.pluginRegistry.register
def register(name, shouldApCorr=False, apCorrList=())
Definition: pluginRegistry.py:163