LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
Classes | Functions
lsst.meas.base.pluginRegistry Namespace Reference

Classes

class  PluginRegistry
 
class  PluginMap
 

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 
def register(name, shouldApCorr=False, apCorrList=())