LSST Applications g0b6bd0c080+a72a5dd7e6,g1182afd7b4+2a019aa3bb,g17e5ecfddb+2b8207f7de,g1d67935e3f+06cf436103,g38293774b4+ac198e9f13,g396055baef+6a2097e274,g3b44f30a73+6611e0205b,g480783c3b1+98f8679e14,g48ccf36440+89c08d0516,g4b93dc025c+98f8679e14,g5c4744a4d9+a302e8c7f0,g613e996a0d+e1c447f2e0,g6c8d09e9e7+25247a063c,g7271f0639c+98f8679e14,g7a9cd813b8+124095ede6,g9d27549199+a302e8c7f0,ga1cf026fa3+ac198e9f13,ga32aa97882+7403ac30ac,ga786bb30fb+7a139211af,gaa63f70f4e+9994eb9896,gabf319e997+ade567573c,gba47b54d5d+94dc90c3ea,gbec6a3398f+06cf436103,gc6308e37c7+07dd123edb,gc655b1545f+ade567573c,gcc9029db3c+ab229f5caf,gd01420fc67+06cf436103,gd877ba84e5+06cf436103,gdb4cecd868+6f279b5b48,ge2d134c3d5+cc4dbb2e3f,ge448b5faa6+86d1ceac1d,gecc7e12556+98f8679e14,gf3ee170dca+25247a063c,gf4ac96e456+ade567573c,gf9f5ea5b4d+ac198e9f13,gff490e6085+8c2580be5c,w.2022.27
LSST Data Management Base Package
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.

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
table::Key< std::string > name
Definition: Amplifier.cc:116
table::Key< int > to
table::Key< int > a
Measure the image moments of source using adaptive Gaussian weights.
Definition: SdssShape.h:150
bool any(CoordinateExpr< N > const &expr) noexcept
Return true if any elements are true.

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

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