LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Classes | Functions | Variables
lsst.meas.base.base Namespace Reference

Classes

class  PluginRegistry
 Base class for plugin registries. More...
 
class  PluginMap
 Map of plugins to be run for a task. More...
 
class  BasePluginConfig
 Base class measurement Plugin config classes. More...
 
class  BasePlugin
 Base class for measurement plugins. More...
 
class  SourceSlotConfig
 Slot configuration which assigns a particular named plugin to each of a set of slots. More...
 
class  BaseMeasurementConfig
 Base config class for all measurement driver tasks. More...
 
class  BaseMeasurementTask
 Ultimate base class for all measurement tasks. More...
 

Functions

def generateAlgorithmName
 
def Version0FlagMapper
 
def addDependencyFlagAliases
 Add aliases to flag fields that an algorithm depends on. More...
 
def register
 A Python decorator that registers a class, using the given name, in its base class's PluginRegistry. More...
 

Variables

tuple FATAL_EXCEPTIONS = (MemoryError, FatalAlgorithmError)
 
dictionary _flagMap
 

Function Documentation

def lsst.meas.base.base.addDependencyFlagAliases (   AlgClass,
  name,
  schema 
)

Add aliases to flag fields that an algorithm depends on.

When an algorithm relies on the slot centroid or shape as an input, it can fail (or be unreliable) simply because the algorithm it depends on failed. In that case, we already have a flag field that indicates why the algorithm failed (the slot failure flag), but it's not obviously connected to the failure of the dependent algorithm. This function adds aliases to the appropriate slot flag for C++ algorithms that depend on that slot, in the namespace of the dependent algorithm.

Parameters
[in]AlgClassSwig-wrappped C++ algorithm class; must have a class attribute Input that constains the type of Input object it requires.
[in]nameName of the dependent algorithm
[out]schemaSchema to add the aliases to

Definition at line 84 of file base.py.

84 
85 def addDependencyFlagAliases(AlgClass, name, schema):
86  """!
87  Add aliases to flag fields that an algorithm depends on.
88 
89  When an algorithm relies on the slot centroid or shape as an input, it can fail (or be unreliable)
90  simply because the algorithm it depends on failed. In that case, we already have a flag field
91  that indicates why the algorithm failed (the slot failure flag), but it's not obviously connected
92  to the failure of the dependent algorithm. This function adds aliases to the appropriate slot flag
93  for C++ algorithms that depend on that slot, in the namespace of the dependent algorithm.
94 
95  @param[in] AlgClass Swig-wrappped C++ algorithm class; must have a class attribute Input that
96  constains the type of Input object it requires.
97  @param[in] name Name of the dependent algorithm
98  @param[out] schema Schema to add the aliases to
99 
100  """
101  if issubclass(AlgClass.Input, FootprintCentroidInput):
102  schema.getAliasMap().set("%s_flag_badCentroid" % name, "slot_Centroid_flag")
103  if issubclass(AlgClass.Input, FootprintCentroidShapeInput):
104  schema.getAliasMap().set("%s_flag_badShape" % name, "slot_Shape_flag")
105 
def addDependencyFlagAliases
Add aliases to flag fields that an algorithm depends on.
Definition: base.py:84
def lsst.meas.base.base.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 40 of file base.py.

40 
41 def generateAlgorithmName(AlgClass):
42  """Generate a string name for an algorithm class that strips away terms that are generally redundant
43  while (hopefully) remaining easy to trace to the code.
44 
45  The returned name will cobmine the package name, with any "lsst" and/or "meas" prefix removed,
46  with the class name, with any "Algorithm" suffix removed. For instance,
47  lsst.meas.base.SdssShapeAlgorithm becomes "base_SdssShape".
48  """
49  name = AlgClass.__name__
50  pkg = AlgClass.__module__
51  name = name.replace("Algorithm", "")
52  terms = pkg.split(".")
53  if terms[-1].endswith("Lib"):
54  terms = terms[:-1]
55  if terms[0] == "lsst":
56  terms = terms[1:]
57  if terms[0] == "meas":
58  terms = terms[1:]
59  if name.lower().startswith(terms[-1].lower()):
60  terms = terms[:-1]
61  return "%s_%s" % ("_".join(terms), name)
62 
63 # Translation map from new PixelFlags to old ones defined in meas_algorithms
def generateAlgorithmName
Definition: base.py:40
def lsst.meas.base.base.register (   name)

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)
4 @enedcode

Definition at line 155 of file base.py.

156 def register(name):
157  """!
158  A Python decorator that registers a class, using the given name, in its base class's PluginRegistry.
159  For example,
160  @code
161  @register("base_TransformedCentroid")
162  class ForcedTransformedCentroidPlugin(ForcedPlugin):
163  ...
164  @endcode
165  is equivalent to:
166  @code
167  class ForcedTransformedCentroidPlugin(ForcedPlugin):
168  ...
169  @ForcedPlugin.registry.register("base_TransformedCentroid", ForcedTransformedCentroidPlugin)
170  @enedcode
171  """
172  def decorate(PluginClass):
173  PluginClass.registry.register(name, PluginClass)
174  return PluginClass
175  return decorate
176 
def register
A Python decorator that registers a class, using the given name, in its base class's PluginRegistry...
Definition: base.py:155
def lsst.meas.base.base.Version0FlagMapper (   flags)

Definition at line 75 of file base.py.

75 
76 def Version0FlagMapper(flags):
77  _flags = []
78  for name in flags:
79  if name in _flagMap.keys():
80  _flags.append(_flagMap[name])
81  else:
82  _flags.append(name)
83  return _flags
def Version0FlagMapper
Definition: base.py:75

Variable Documentation

dictionary lsst.meas.base.base._flagMap
Initial value:
1 = {
2  "base_PixelFlags_flag_bad":"flags.pixel.bad",
3  "base_PixelFlags_flag_edge":"flags.pixel.edge",
4  "base_PixelFlags_flag_interpolated":"flags.pixel.interpolated.any",
5  "base_PixelFlags_flag_saturated":"flags.pixel.saturated.any",
6  "base_PixelFlags_flag_cr":"flags.pixel.cr.any",
7  "base_PixelFlags_flag_interpolatedCenter":"flags.pixel.interpolated.center",
8  "base_PixelFlags_flag_saturatedCenter":"flags.pixel.saturated.center",
9  "base_PixelFlags_flag_crCenter":"flags.pixel.cr.center",
10  }

Definition at line 64 of file base.py.

tuple lsst.meas.base.base.FATAL_EXCEPTIONS = (MemoryError, FatalAlgorithmError)

Definition at line 38 of file base.py.