wrapAlgorithm¶
-
lsst.meas.base.
wrapAlgorithm
(Base, AlgClass, factory, executionOrder, name=None, Control=None, ConfigClass=None, TransformClass=None, doRegister=True, shouldApCorr=False, apCorrList=(), hasLogName=False, **kwds)¶ Wrap a C++ algorithm class to create a measurement plugin.
Parameters: - Base :
SingleFramePlugin
orForcedPlugin
Base class for the returned Plugin.
- AlgClass : API compatible with
SingleFrameAlgorithm
orForcedAlgorithm
C++ algorithm class to convert. May either derive directly from
SingleFrameAlgorithm
orForcedAlgorithm
, or be an unrelated class which has the samemeasure
andmeasureN
signatures.- factory : callable
A callable that is used to construct an instance of
AlgClass
. It must take four arguments, either(config, name, schema, metadata)
or(config, name, schemaMapper, metadata)
, depending on whether the algorithm is single-frame or forced.- executionOrder :
float
The order this plugin should be run, relative to others (see
BasePlugin.getExecutionOrder
).- name :
str
, optional String to use when registering the algorithm. Ignored if
doRegistry=False
, set togenerateAlgorithmName(AlgClass)
ifNone
.- Control : Pybind11-wrapped version of a C++ class, optional
Pybind11-wrapped C++ Control class for the algorithm;
AlgClass.Control
is used ifNone
. Ignored ifConfigClass
is notNone
.- ConfigClass : subclass of
BaseMeasurementPluginConfig
Python config class that wraps the C++ algorithm’s pybind11-wrapped Control class. If
None
,wrapAlgorithmControl
is called to generate a Config class using theControl
argument.- TransformClass : subclass of
MeasurementTransform
, optional Transformation which may be used to post-process the results of measurement. If
None
, the default defined byBasePlugin
is used.- doRegister :
bool
, optional If
True
(the default), register the plugin withBase
’s registry, allowing it to be used by measurement tasks.- shouldApCorr :
bool
, optional Does this algorithm measure an instFlux that can be aperture corrected? This is shorthand for
apCorrList=[name]
and is ignored ifapCorrList
is specified.- apCorrList : iterable of
str
, optional Field name prefixes for instFlux fields to be aperture corrected. If an algorithm measures a single instFlux that should be aperture corrected, then it is simpler to set
shouldApCorr=True
. However, if an algorithm produces multiple such fields, then specifyapCorrList
instead. For example,modelfit_CModel
produces three such fields:apCorrList= ("modelfit_CModel_exp", "modelfit_CModel_exp", "modelfit_CModel_def")
IfapCorrList
is not empty thenshouldApCorr
is ignored. If non-empty anddoRegister
isTrue
then the names are added to the set retrieved bygetApCorrNameSet
.- hasLogName :
bool
, optional True
if the C++ algorithm supportslogName
as a constructor argument.- **kwds
Additional keyword arguments passed to generateAlgorithmControl, which may include:
hasMeasureN
: Whether the plugin supports fitting multiple objects at once ;if so, a config option to enable/disable this will be added (bool
).executionOrder
: If notNone
, an override for the default execution order for this plugin (the default is2.0
, which is usually appropriate for fluxes;bool
).
Returns: - PluginClass : subclass of
Base
The new plugin class.
- Base :