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 or ForcedPlugin

Base class for the returned Plugin.

AlgClass : API compatible with SingleFrameAlgorithm or ForcedAlgorithm

C++ algorithm class to convert. May either derive directly from SingleFrameAlgorithm or ForcedAlgorithm, or be an unrelated class which has the same measure and measureN 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 to generateAlgorithmName(AlgClass) if None.

Control : Pybind11-wrapped version of a C++ class, optional

Pybind11-wrapped C++ Control class for the algorithm; AlgClass.Control is used if None. Ignored if ConfigClass is not None.

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 the Control argument.

TransformClass : subclass of MeasurementTransform, optional

Transformation which may be used to post-process the results of measurement. If None, the default defined by BasePlugin is used.

doRegister : bool, optional

If True (the default), register the plugin with Base’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 if apCorrList 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 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. If non-empty and doRegister is True then the names are added to the set retrieved by getApCorrNameSet.

hasLogName : bool, optional

True if the C++ algorithm supports logName 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 not None, an override for the default execution order for this plugin (the default is 2.0, which is usually appropriate for fluxes; bool).
Returns:
PluginClass : subclass of Base

The new plugin class.