LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Public Attributes | List of all members
lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxMixin Class Reference
Inheritance diagram for lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxMixin:
lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxForcedPlugin lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxSingleFramePlugin

Public Member Functions

def __init__ (self, config, name, schema)
 
def measure (self, measRecord, exposure)
 
def fail (self, measRecord, error=None)
 

Public Attributes

 sequence
 

Detailed Description

Mixin base class for fitting shapelet approximations to the PSF model

This class does almost all of the work for its two derived classes,
GeneralShapeletPsfApproxSingleFramePlugin and
GeneralShapeletPsfApproxForcedPlugin, which simply adapt it to the
slightly different interfaces for single-frame and forced measurement.  It
in turn delegates its work to the C++ GeneralPsfFitter class; it holds
sequence of these corresponding to different models (generally with
increasing complexity). Each GeneralPsfFitter starts with the result of
the previous one as an input, using GeneralPsfFitter::adapt to hopefully
allow these previous fits to reduce the time spent on the next one.

At present, this plugin does not define any failure flags, which will
almost certainly have to be changed in the future.  So far, however, I
haven't actually seen it fail on any PSFs I've given it, so I'll wait
until we can run on large enough data volumes to see what the actual
failure modes are, instead of trying to guess them in advance.

Definition at line 107 of file psfContinued.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxMixin.__init__ (   self,
  config,
  name,
  schema 
)
Initialize the plugin, creating a sequence of GeneralPsfFitter
instances to do the fitting and MultiShapeletFunctionKey instances to
save the results to a record.

Definition at line 127 of file psfContinued.py.

127  def __init__(self, config, name, schema):
128  """Initialize the plugin, creating a sequence of GeneralPsfFitter
129  instances to do the fitting and MultiShapeletFunctionKey instances to
130  save the results to a record.
131  """
132  self.sequence = []
133  for m in config.sequence:
134  fitter = GeneralPsfFitterAlgorithm(
135  config.models[m].makeControl(),
136  schema,
137  schema[name][m].getPrefix()
138  )
139  self.sequence.append((fitter, schema[name][m].getPrefix()))
140 
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
Definition: functional.cc:33

Member Function Documentation

◆ fail()

def lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxMixin.fail (   self,
  measRecord,
  error = None 
)

Reimplemented in lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxForcedPlugin, and lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxSingleFramePlugin.

Definition at line 183 of file psfContinued.py.

183  def fail(self, measRecord, error=None):
184  pass
185 
186 

◆ measure()

def lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxMixin.measure (   self,
  measRecord,
  exposure 
)
Fit the configured sequence of models the given Exposure's Psf, as
evaluated at measRecord.getCentroid(), then save the results to
measRecord.

Reimplemented in lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxSingleFramePlugin.

Definition at line 141 of file psfContinued.py.

141  def measure(self, measRecord, exposure):
142  """Fit the configured sequence of models the given Exposure's Psf, as
143  evaluated at measRecord.getCentroid(), then save the results to
144  measRecord.
145  """
146  if not exposure.hasPsf():
148  "GeneralShapeletPsfApprox requires Exposure to have a Psf")
149  psf = exposure.getPsf()
150  psfImage = psf.computeKernelImage(measRecord.getCentroid())
151  psfShape = psf.computeShape(measRecord.getCentroid())
152  lastError = None
153  lastModel = None
154  # Fit the first element in the sequence, using the PSFs moments to
155  # initialize the parameters For every other element in the fitting
156  # sequence, use the previous fit to initialize the parameters
157  lastResult = None
158  for fitter, name in self.sequence:
159  try:
160  if lastModel is None:
161  fitter.measure(measRecord, psfImage, psfShape)
162  else:
163  fitter.measure(measRecord, psfImage,
164  fitter.adapt(lastResult, lastModel))
165  lastResult = measRecord.get(fitter.getKey())
166  lastModel = fitter.getModel()
167  except lsst.meas.base.baseMeasurement.FATAL_EXCEPTIONS:
168  raise
169  except lsst.meas.base.MeasurementError as error:
170  fitter.fail(measRecord, error.cpp)
171  lastError = error
172  except Exception as error:
173  fitter.fail(measRecord)
174  lastError = error
175  # When we are done with all the fitters, raise the last error if there
176  # was one. This gives the calling task a chance to do whatever it
177  # wants
178  if lastError is not None:
179  raise lastError
180 
Exception to be thrown when a measurement algorithm experiences a fatal error.
Definition: exceptions.h:76
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Definition: exceptions.h:48
def measure(mi, x, y, size, statistic, stats)
Definition: fringe.py:517

Member Data Documentation

◆ sequence

lsst.meas.modelfit.psf.psfContinued.GeneralShapeletPsfApproxMixin.sequence

Definition at line 132 of file psfContinued.py.


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