LSST Applications g0265f82a02+093ff98f47,g02d81e74bb+3975d4ac1c,g2079a07aa2+14824f138e,g2bbee38e9b+093ff98f47,g337abbeb29+093ff98f47,g3ddfee87b4+626790451e,g3e7165581c+1687b54203,g487adcacf7+018f045a06,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g568d43a26c+02eca3db7e,g591dd9f2cf+3cba9d5141,g858d7b2824+3975d4ac1c,g8a8a8dda67+a6fc98d2e7,g8cdfe0ae6a+66d966b544,g99cad8db69+948283481e,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga2e4dd1c03+626790451e,ga8c6da7877+c38891e457,gae46bcf261+093ff98f47,gb0e22166c9+3863383f4c,gba4ed39666+9664299f35,gbb8dafda3b+dce3423368,gbeb006f7da+65b42827f3,gbf5cecdb8a+3975d4ac1c,gc0f3af6251+39f4c7265c,gc120e1dc64+1d31f3ee8b,gc28159a63d+093ff98f47,gcf0d15dbbd+626790451e,gd2a12a3803+bbf96b9899,gdaeeff99f8+a38ce5ea23,ge79ae78c31+093ff98f47,gee10cc3b42+a6fc98d2e7,gf1cff7945b+3975d4ac1c,v24.1.5.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lsst.meas.deblender.plugins.DeblenderPlugin Class Reference

Public Member Functions

 __init__ (self, func, onReset=None, maxIterations=50, **kwargs)
 
 run (self, debResult, log)
 
 __str__ (self)
 
 __repr__ (self)
 

Public Attributes

 func
 
 kwargs
 
 onReset
 
 maxIterations
 
 iterations
 

Detailed Description

Class to define plugins for the deblender.

The new deblender executes a series of plugins specified by the user.
Each plugin defines the function to be executed, the keyword arguments
required by the function, and whether or not certain portions of the
deblender might need to be rerun as a result of the function.

Definition at line 68 of file plugins.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.deblender.plugins.DeblenderPlugin.__init__ ( self,
func,
onReset = None,
maxIterations = 50,
** kwargs )
Initialize a deblender plugin

Parameters
----------
func: `function`
    Function to run when the plugin is executed.
    The function should always take
    `debResult`, a `DeblenderResult` that stores the deblender result,
    and `log`, an `lsst.log`, as the first two arguments, as well as
    any additional keyword arguments (that must
    be specified in ``kwargs``). The function should also return
    ``modified``, a `bool` that tells the deblender whether
    or not any templates have been modified by the function.
    If ``modified==True``, the deblender will go back to step
    ``onReset``, unless the has already been run ``maxIterations``.
onReset: `int`
    Index of the deblender plugin to return to if ``func`` modifies
    any templates. The default is ``None``, which does not re-run
    any plugins.
maxIterations: `int`
    Maximum number of times the deblender will reset when
    the current plugin
    returns ``True``.

Definition at line 76 of file plugins.py.

76 def __init__(self, func, onReset=None, maxIterations=50, **kwargs):
77 """Initialize a deblender plugin
78
79 Parameters
80 ----------
81 func: `function`
82 Function to run when the plugin is executed.
83 The function should always take
84 `debResult`, a `DeblenderResult` that stores the deblender result,
85 and `log`, an `lsst.log`, as the first two arguments, as well as
86 any additional keyword arguments (that must
87 be specified in ``kwargs``). The function should also return
88 ``modified``, a `bool` that tells the deblender whether
89 or not any templates have been modified by the function.
90 If ``modified==True``, the deblender will go back to step
91 ``onReset``, unless the has already been run ``maxIterations``.
92 onReset: `int`
93 Index of the deblender plugin to return to if ``func`` modifies
94 any templates. The default is ``None``, which does not re-run
95 any plugins.
96 maxIterations: `int`
97 Maximum number of times the deblender will reset when
98 the current plugin
99 returns ``True``.
100 """
101 self.func = func
102 self.kwargs = kwargs
103 self.onReset = onReset
104 self.maxIterations = maxIterations
105 self.kwargs = kwargs
106 self.iterations = 0
107

Member Function Documentation

◆ __repr__()

lsst.meas.deblender.plugins.DeblenderPlugin.__repr__ ( self)

Definition at line 125 of file plugins.py.

125 def __repr__(self):
126 return self.__str__()
127
128

◆ __str__()

lsst.meas.deblender.plugins.DeblenderPlugin.__str__ ( self)

Definition at line 122 of file plugins.py.

122 def __str__(self):
123 return ("<Deblender Plugin: func={0}, kwargs={1}".format(self.func.__name__, self.kwargs))
124

◆ run()

lsst.meas.deblender.plugins.DeblenderPlugin.run ( self,
debResult,
log )
Execute the current plugin

Once the plugin has finished, check to see if part of the deblender
must be executed again.

Definition at line 108 of file plugins.py.

108 def run(self, debResult, log):
109 """Execute the current plugin
110
111 Once the plugin has finished, check to see if part of the deblender
112 must be executed again.
113 """
114 log.trace("Executing %s", self.func.__name__)
115 reset = self.func(debResult, log, **self.kwargs)
116 if reset:
117 self.iterations += 1
118 if self.iterations < self.maxIterations:
119 return self.onReset
120 return None
121

Member Data Documentation

◆ func

lsst.meas.deblender.plugins.DeblenderPlugin.func

Definition at line 101 of file plugins.py.

◆ iterations

lsst.meas.deblender.plugins.DeblenderPlugin.iterations

Definition at line 106 of file plugins.py.

◆ kwargs

lsst.meas.deblender.plugins.DeblenderPlugin.kwargs

Definition at line 102 of file plugins.py.

◆ maxIterations

lsst.meas.deblender.plugins.DeblenderPlugin.maxIterations

Definition at line 104 of file plugins.py.

◆ onReset

lsst.meas.deblender.plugins.DeblenderPlugin.onReset

Definition at line 103 of file plugins.py.


The documentation for this class was generated from the following file: