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 | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin Class Reference
Inheritance diagram for lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin:
lsst.meas.base.sfm.SingleFramePlugin lsst.meas.base.baseMeasurement.BaseMeasurementPlugin lsst.meas.base.pluginsBase.BasePlugin

Public Member Functions

def getExecutionOrder (cls)
 
def __init__ (self, config, name, schema, metadata)
 
def measure (self, measRecord, exposure)
 
def fail (self, measRecord, error=None)
 
def measureN (self, measCat, exposure)
 
def getLogName (self)
 

Static Public Member Functions

def getTransformClass ()
 

Public Attributes

 keyXC
 
 keyYC
 
 keyX0
 
 keyY0
 
 keyX1
 
 keyY1
 
 keyL
 
 keyTheta
 
 keyFlux
 
 keyRChiSq
 
 NON_CONVERGE
 
 NO_NAIVE
 
 flagHandler
 
 centroidExtractor
 
 config
 
 name
 
 logName
 

Static Public Attributes

 ConfigClass = SingleFrameVeresTrailConfig
 
 registry = PluginRegistry(SingleFramePluginConfig)
 
float CENTROID_ORDER = 0.0
 
float SHAPE_ORDER = 1.0
 
float FLUX_ORDER = 2.0
 
float APCORR_ORDER = 3.0
 
float DEFAULT_CATALOGCALCULATION = 4.0
 

Detailed Description

Veres trailed source characterization plugin.

Measures the length, angle, flux, centroid, and end points of a trailed
source using the Veres et al. 2012 model [1]_.

Parameters
----------
config: `SingleFrameNaiveTrailConfig`
    Plugin configuration.
name: `str`
    Plugin name.
schema: `lsst.afw.table.Schema`
    Schema for the output catalog.
metadata: `lsst.daf.base.PropertySet`
    Metadata to be attached to output catalog.

Notes
-----
This plugin is designed to refine the measurements of trail length,
angle, and end points from `NaivePlugin`, and of flux and centroid from
previous measurement algorithms. Vereš et al. 2012 [1]_ derive a model for
the flux in a given image pixel by convolving an axisymmetric Gaussian with
a line. The model is parameterized by the total flux, trail length, angle
from the x-axis, and the centroid. The best estimates are computed using a
chi-squared minimization.

References
----------
.. [1] Vereš, P., et al. "Improved Asteroid Astrometry and Photometry with
   Trail Fitting" PASP, vol. 124, 2012.

See also
--------
lsst.meas.base.SingleFramePlugin

Definition at line 52 of file VeresPlugin.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.__init__ (   self,
  config,
  name,
  schema,
  metadata 
)

Definition at line 97 of file VeresPlugin.py.

97  def __init__(self, config, name, schema, metadata):
98  super().__init__(config, name, schema, metadata)
99 
100  self.keyXC = schema.addField(
101  name + "_centroid_x", type="D", doc="Trail centroid X coordinate.", units="pixel")
102  self.keyYC = schema.addField(
103  name + "_centroid_y", type="D", doc="Trail centroid Y coordinate.", units="pixel")
104  self.keyX0 = schema.addField(name + "_x0", type="D", doc="Trail head X coordinate.", units="pixel")
105  self.keyY0 = schema.addField(name + "_y0", type="D", doc="Trail head Y coordinate.", units="pixel")
106  self.keyX1 = schema.addField(name + "_x1", type="D", doc="Trail tail X coordinate.", units="pixel")
107  self.keyY1 = schema.addField(name + "_y1", type="D", doc="Trail tail Y coordinate.", units="pixel")
108  self.keyL = schema.addField(name + "_length", type="D", doc="Length of trail.", units="pixel")
109  self.keyTheta = schema.addField(name + "_angle", type="D", doc="Angle of trail from +x-axis.")
110  self.keyFlux = schema.addField(name + "_flux", type="D", doc="Trailed source flux.", units="count")
111  self.keyRChiSq = schema.addField(name + "_rChiSq", type="D", doc="Reduced chi-squared of fit")
112 
113  flagDefs = FlagDefinitionList()
114  flagDefs.addFailureFlag("No trailed-sources measured")
115  self.NON_CONVERGE = flagDefs.add("flag_nonConvergence", "Optimizer did not converge")
116  self.NO_NAIVE = flagDefs.add("flag_noNaive", "Naive measurement contains NaNs")
117  self.flagHandler = FlagHandler.addFields(schema, name, flagDefs)
118 
119  self.centroidExtractor = SafeCentroidExtractor(schema, name)
120 

Member Function Documentation

◆ fail()

def lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.fail (   self,
  measRecord,
  error = None 
)
Record failure

See also
--------
lsst.meas.base.SingleFramePlugin.fail

Reimplemented from lsst.meas.base.pluginsBase.BasePlugin.

Definition at line 178 of file VeresPlugin.py.

178  def fail(self, measRecord, error=None):
179  """Record failure
180 
181  See also
182  --------
183  lsst.meas.base.SingleFramePlugin.fail
184  """
185  if error is None:
186  self.flagHandler.handleFailure(measRecord)
187  else:
188  self.flagHandler.handleFailure(measRecord, error.cpp)

◆ getExecutionOrder()

def lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.getExecutionOrder (   cls)
Get the relative execution order of this plugin.

Must be reimplemented as a class method by concrete derived classes.

Reimplemented from lsst.meas.base.pluginsBase.BasePlugin.

Definition at line 92 of file VeresPlugin.py.

92  def getExecutionOrder(cls):
93  # Needs centroids, shape, flux, and NaivePlugin measurements.
94  # Make sure this always runs after NaivePlugin.
95  return SingleFrameNaiveTrailPlugin.getExecutionOrder() + 0.1
96 

◆ getLogName()

def lsst.meas.base.pluginsBase.BasePlugin.getLogName (   self)
inherited

Definition at line 134 of file pluginsBase.py.

134  def getLogName(self):
135  return self.logName
136 

◆ getTransformClass()

def lsst.meas.base.pluginsBase.BasePlugin.getTransformClass ( )
staticinherited
Get the measurement transformation appropriate to this plugin.

This returns a subclass of `transforms.MeasurementTransform`, which
may be instantiated with details of the algorithm configuration and
then called with information about calibration and WCS to convert from
raw measurement quantities to calibrated units. Calibrated data is
then provided in a separate output table.

Notes
-----
By default, we copy everything from the input to the output without
transformation.

Reimplemented in lsst.meas.base.plugins.ForcedPeakCentroidPlugin, and lsst.meas.base.plugins.SingleFramePeakCentroidPlugin.

Definition at line 169 of file pluginsBase.py.

169  def getTransformClass():
170  """Get the measurement transformation appropriate to this plugin.
171 
172  This returns a subclass of `transforms.MeasurementTransform`, which
173  may be instantiated with details of the algorithm configuration and
174  then called with information about calibration and WCS to convert from
175  raw measurement quantities to calibrated units. Calibrated data is
176  then provided in a separate output table.
177 
178  Notes
179  -----
180  By default, we copy everything from the input to the output without
181  transformation.
182  """
183  return PassThroughTransform

◆ measure()

def lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.measure (   self,
  measRecord,
  exposure 
)
Run the Veres trailed source measurement plugin.

Parameters
----------
measRecord : `lsst.afw.table.SourceRecord`
    Record describing the object being measured.
exposure : `lsst.afw.image.Exposure`
    Pixel data to be measured.

See also
--------
lsst.meas.base.SingleFramePlugin.measure

Reimplemented from lsst.meas.base.sfm.SingleFramePlugin.

Definition at line 121 of file VeresPlugin.py.

121  def measure(self, measRecord, exposure):
122  """Run the Veres trailed source measurement plugin.
123 
124  Parameters
125  ----------
126  measRecord : `lsst.afw.table.SourceRecord`
127  Record describing the object being measured.
128  exposure : `lsst.afw.image.Exposure`
129  Pixel data to be measured.
130 
131  See also
132  --------
133  lsst.meas.base.SingleFramePlugin.measure
134  """
135  xc, yc = self.centroidExtractor(measRecord, self.flagHandler)
136 
137  # Look at measRecord for Naive measurements
138  # ASSUMES NAIVE ALREADY RAN
139  F = measRecord.get("ext_trailedSources_Naive_flux")
140  L = measRecord.get("ext_trailedSources_Naive_length")
141  theta = measRecord.get("ext_trailedSources_Naive_angle")
142  if not np.isfinite(F) or not np.isfinite(L) or not np.isfinite(theta):
143  raise MeasurementError(self.NO_NAIVE.doc, self.NO_NAIVE.number)
144 
145  # Make VeresModel
146  model = VeresModel(exposure)
147 
148  # Do optimization with scipy
149  params = np.array([xc, yc, F, L, theta])
150  results = sciOpt.minimize(
151  model, params, method=self.config.optimizerMethod, jac=model.gradient)
152 
153  # Check if optimizer converged
154  if not results.success:
155  raise MeasurementError(self.NON_CONVERGE.doc, self.NON_CONVERGE.number)
156 
157  # Calculate end points and reduced chi-squared
158  xc_fit, yc_fit, F_fit, L_fit, theta_fit = results.x
159  a = L_fit/2
160  x0_fit = xc_fit - a * np.cos(theta_fit)
161  y0_fit = yc_fit - a * np.sin(theta_fit)
162  x1_fit = xc_fit + a * np.cos(theta_fit)
163  y1_fit = yc_fit + a * np.sin(theta_fit)
164  rChiSq = results.fun / (exposure.image.array.size - 6)
165 
166  # Set keys
167  measRecord.set(self.keyXC, xc_fit)
168  measRecord.set(self.keyYC, yc_fit)
169  measRecord.set(self.keyX0, x0_fit)
170  measRecord.set(self.keyY0, y0_fit)
171  measRecord.set(self.keyX1, x1_fit)
172  measRecord.set(self.keyY1, y1_fit)
173  measRecord.set(self.keyFlux, F_fit)
174  measRecord.set(self.keyL, L_fit)
175  measRecord.set(self.keyTheta, theta_fit)
176  measRecord.set(self.keyRChiSq, rChiSq)
177 
def measure(mi, x, y, size, statistic, stats)
Definition: fringe.py:517

◆ measureN()

def lsst.meas.base.sfm.SingleFramePlugin.measureN (   self,
  measCat,
  exposure 
)
inherited
Measure the properties of blended sources on a single image.

This operates on all members of a blend family at once. The image may
be from a single epoch, or it may be a coadd.

Parameters
----------
measCat : `lsst.afw.table.SourceCatalog`
    Catalog describing the objects (and only those objects) being
    measured. Previously-measured quantities will be retrieved from
    here, and it will be updated in-place with the outputs of this
    plugin.
exposure : `lsst.afw.image.ExposureF`
    The pixel data to be measured, together with the associated PSF,
    WCS, etc. All other sources in the image should have been replaced
    by noise according to deblender outputs.

Notes
-----
Derived classes that do not implement ``measureN`` should just inherit
this disabled version.  Derived classes that do implement ``measureN``
should additionally add a bool doMeasureN config field to their config
class to signal that measureN-mode is available.

Reimplemented in lsst.meas.base.wrappers.WrappedSingleFramePlugin.

Definition at line 105 of file sfm.py.

105  def measureN(self, measCat, exposure):
106  """Measure the properties of blended sources on a single image.
107 
108  This operates on all members of a blend family at once. The image may
109  be from a single epoch, or it may be a coadd.
110 
111  Parameters
112  ----------
113  measCat : `lsst.afw.table.SourceCatalog`
114  Catalog describing the objects (and only those objects) being
115  measured. Previously-measured quantities will be retrieved from
116  here, and it will be updated in-place with the outputs of this
117  plugin.
118  exposure : `lsst.afw.image.ExposureF`
119  The pixel data to be measured, together with the associated PSF,
120  WCS, etc. All other sources in the image should have been replaced
121  by noise according to deblender outputs.
122 
123  Notes
124  -----
125  Derived classes that do not implement ``measureN`` should just inherit
126  this disabled version. Derived classes that do implement ``measureN``
127  should additionally add a bool doMeasureN config field to their config
128  class to signal that measureN-mode is available.
129  """
130  raise NotImplementedError()
131 
132 

Member Data Documentation

◆ APCORR_ORDER

float lsst.meas.base.pluginsBase.BasePlugin.APCORR_ORDER = 3.0
staticinherited

Definition at line 98 of file pluginsBase.py.

◆ CENTROID_ORDER

float lsst.meas.base.pluginsBase.BasePlugin.CENTROID_ORDER = 0.0
staticinherited

Definition at line 72 of file pluginsBase.py.

◆ centroidExtractor

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.centroidExtractor

Definition at line 119 of file VeresPlugin.py.

◆ config

lsst.meas.base.pluginsBase.BasePlugin.config
inherited

Definition at line 130 of file pluginsBase.py.

◆ ConfigClass

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.ConfigClass = SingleFrameVeresTrailConfig
static

Definition at line 89 of file VeresPlugin.py.

◆ DEFAULT_CATALOGCALCULATION

float lsst.meas.base.pluginsBase.BasePlugin.DEFAULT_CATALOGCALCULATION = 4.0
staticinherited

Definition at line 108 of file pluginsBase.py.

◆ flagHandler

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.flagHandler

Definition at line 117 of file VeresPlugin.py.

◆ FLUX_ORDER

float lsst.meas.base.pluginsBase.BasePlugin.FLUX_ORDER = 2.0
staticinherited

Definition at line 89 of file pluginsBase.py.

◆ keyFlux

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyFlux

Definition at line 110 of file VeresPlugin.py.

◆ keyL

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyL

Definition at line 108 of file VeresPlugin.py.

◆ keyRChiSq

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyRChiSq

Definition at line 111 of file VeresPlugin.py.

◆ keyTheta

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyTheta

Definition at line 109 of file VeresPlugin.py.

◆ keyX0

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyX0

Definition at line 104 of file VeresPlugin.py.

◆ keyX1

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyX1

Definition at line 106 of file VeresPlugin.py.

◆ keyXC

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyXC

Definition at line 100 of file VeresPlugin.py.

◆ keyY0

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyY0

Definition at line 105 of file VeresPlugin.py.

◆ keyY1

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyY1

Definition at line 107 of file VeresPlugin.py.

◆ keyYC

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.keyYC

Definition at line 102 of file VeresPlugin.py.

◆ logName

lsst.meas.base.pluginsBase.BasePlugin.logName
inherited

Definition at line 132 of file pluginsBase.py.

◆ name

lsst.meas.base.pluginsBase.BasePlugin.name
inherited

Definition at line 131 of file pluginsBase.py.

◆ NO_NAIVE

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.NO_NAIVE

Definition at line 116 of file VeresPlugin.py.

◆ NON_CONVERGE

lsst.meas.extensions.trailedSources.VeresPlugin.SingleFrameVeresTrailPlugin.NON_CONVERGE

Definition at line 115 of file VeresPlugin.py.

◆ registry

lsst.meas.base.sfm.SingleFramePlugin.registry = PluginRegistry(SingleFramePluginConfig)
staticinherited

Definition at line 78 of file sfm.py.

◆ SHAPE_ORDER

float lsst.meas.base.pluginsBase.BasePlugin.SHAPE_ORDER = 1.0
staticinherited

Definition at line 80 of file pluginsBase.py.


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