LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Classes | Functions | Variables
lsst.meas.base.pluginRegistry Namespace Reference

Classes

class  PluginRegistry
 Base class for plugin registries. More...
 
class  PluginMap
 Map of plugins (instances of subclasses of BasePlugin) to be run for a task. More...
 

Functions

def generateAlgorithmName
 
def register
 A Python decorator that registers a class, using the given name, in its base class's PluginRegistry. More...
 

Variables

tuple __all__ = ("generateAlgorithmName", "PluginRegistry", "register", "PluginMap")
 

Function Documentation

def lsst.meas.base.pluginRegistry.generateAlgorithmName (   AlgClass)
Generate a string name for an algorithm class that strips away terms that are generally redundant
while (hopefully) remaining easy to trace to the code.

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 
35 def generateAlgorithmName(AlgClass):
36  """Generate a string name for an algorithm class that strips away terms that are generally redundant
37  while (hopefully) remaining easy to trace to the code.
38 
39  The returned name will cobmine the package name, with any "lsst" and/or "meas" prefix removed,
40  with the class name, with any "Algorithm" suffix removed. For instance,
41  lsst.meas.base.SdssShapeAlgorithm becomes "base_SdssShape".
42  """
43  name = AlgClass.__name__
44  pkg = AlgClass.__module__
45  name = name.replace("Algorithm", "")
46  terms = pkg.split(".")
47  if terms[-1].endswith("Lib"):
48  terms = terms[:-1]
49  if terms[0] == "lsst":
50  terms = terms[1:]
51  if terms[0] == "meas":
52  terms = terms[1:]
53  if name.lower().startswith(terms[-1].lower()):
54  terms = terms[:-1]
55  return "%s_%s" % ("_".join(terms), name)
def lsst.meas.base.pluginRegistry.register (   name,
  shouldApCorr = False 
)

A Python decorator that registers a class, using the given name, in its base class's PluginRegistry.

For example,

1 @register("base_TransformedCentroid")
2 class ForcedTransformedCentroidPlugin(ForcedPlugin):
3  ...

is equivalent to:

1 class ForcedTransformedCentroidPlugin(ForcedPlugin):
2  ...
3 @ForcedPlugin.registry.register("base_TransformedCentroid", ForcedTransformedCentroidPlugin)

Definition at line 122 of file pluginRegistry.py.

123 def register(name, shouldApCorr=False):
124  """!
125  A Python decorator that registers a class, using the given name, in its base class's PluginRegistry.
126  For example,
127  @code
128  @register("base_TransformedCentroid")
129  class ForcedTransformedCentroidPlugin(ForcedPlugin):
130  ...
131  @endcode
132  is equivalent to:
133  @code
134  class ForcedTransformedCentroidPlugin(ForcedPlugin):
135  ...
136  @ForcedPlugin.registry.register("base_TransformedCentroid", ForcedTransformedCentroidPlugin)
137  @endcode
138  """
139  def decorate(PluginClass):
140  PluginClass.registry.register(name, PluginClass, shouldApCorr=shouldApCorr)
141  return PluginClass
142  return decorate
143 
def register
A Python decorator that registers a class, using the given name, in its base class's PluginRegistry...

Variable Documentation

tuple lsst.meas.base.pluginRegistry.__all__ = ("generateAlgorithmName", "PluginRegistry", "register", "PluginMap")

Definition at line 32 of file pluginRegistry.py.