lsst.meas.extensions.trailedSources g74acd417e5+42f3387864
Loading...
Searching...
No Matches
lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin Class Reference
Inheritance diagram for lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin:

Public Member Functions

 getExecutionOrder (cls)
 
 __init__ (self, config, name, schema, metadata, logName=None)
 
 measure (self, measRecord, exposure)
 
 check_trail (self, measRecord, exposure, x0, y0, x1, y1, length)
 
 fail (self, measRecord, error=None)
 
 findLength (cls, Ixx, Iyy)
 

Static Public Member Functions

 computeLength (Ixx, Iyy)
 
 computeRaDec (exposure, x, y)
 

Public Attributes

 keyRa = schema.addField(name + "_ra", type="D", doc="Trail centroid right ascension.")
 
 keyDec = schema.addField(name + "_dec", type="D", doc="Trail centroid declination.")
 
 keyX0 = schema.addField(name + "_x0", type="D", doc="Trail head X coordinate.", units="pixel")
 
 keyY0 = schema.addField(name + "_y0", type="D", doc="Trail head Y coordinate.", units="pixel")
 
 keyX1 = schema.addField(name + "_x1", type="D", doc="Trail tail X coordinate.", units="pixel")
 
 keyY1 = schema.addField(name + "_y1", type="D", doc="Trail tail Y coordinate.", units="pixel")
 
 keyFlux = schema.addField(name + "_flux", type="D", doc="Trailed source flux.", units="count")
 
 keyLength = schema.addField(name + "_length", type="D", doc="Trail length.", units="pixel")
 
 keyAngle = schema.addField(name + "_angle", type="D", doc="Angle measured from +x-axis.")
 
 keyX0Err
 
 keyY0Err
 
 keyX1Err
 
 keyY1Err
 
 keyFluxErr
 
 keyLengthErr
 
 keyAngleErr = schema.addField(name + "_angleErr", type="D", doc="Trail angle error.")
 
 FAILURE = flagDefs.addFailureFlag("No trailed-source measured")
 
 NO_FLUX = flagDefs.add("flag_noFlux", "No suitable prior flux measurement")
 
 NO_CONVERGE = flagDefs.add("flag_noConverge", "The root finder did not converge")
 
 NO_SIGMA = flagDefs.add("flag_noSigma", "No PSF width (sigma)")
 
 EDGE = flagDefs.add("flag_edge", "Trail contains edge pixels")
 
 OFFIMAGE = flagDefs.add("flag_off_image", "Trail extends off image")
 
 NAN = flagDefs.add("flag_nan", "One or more trail coordinates are missing")
 
 SUSPECT_LONG_TRAIL
 
 SHAPE = flagDefs.add("flag_shape", "Shape flag is set, trail length not calculated")
 
 flagHandler = FlagHandler.addFields(schema, name, flagDefs)
 
 log = logging.getLogger(self.logName)
 

Static Public Attributes

 ConfigClass = SingleFrameNaiveTrailConfig
 

Static Protected Member Functions

 _computeSecondMomentDiff (z, c)
 
 _gradFindLength (Ixx, Iyy, z, c)
 

Detailed Description

Naive trailed source measurement plugin

Measures the length, angle from +x-axis, and end points of an extended
source using the second moments.

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 measurement plugin aims to utilize the already measured adaptive
second moments to naively estimate the length and angle, and thus
end-points, of a fast-moving, trailed source. The length is solved for via
finding the root of the difference between the numerical (stack computed)
and the analytic adaptive second moments. The angle, theta, from the x-axis
is also computed via adaptive moments: theta = arctan(2*Ixy/(Ixx - Iyy))/2.
The end points of the trail are then given by (xc +/- (length/2)*cos(theta)
and yc +/- (length/2)*sin(theta)), with xc and yc being the centroid
coordinates.

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

Definition at line 53 of file NaivePlugin.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.__init__ ( self,
config,
name,
schema,
metadata,
logName = None )

Definition at line 95 of file NaivePlugin.py.

Member Function Documentation

◆ _computeSecondMomentDiff()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin._computeSecondMomentDiff ( z,
c )
staticprotected
Compute difference of the numerical and analytic second moments.

Parameters
----------
z : `float`
    Proportional to the length of the trail. (see notes)
c : `float`
    Constant (see notes)

Returns
-------
diff : `float`
    Difference in numerical and analytic second moments.

Notes
-----
This is a simplified expression for the difference between the stack
computed adaptive second-moment and the analytic solution. The variable
z is proportional to the length such that length=2*z*sqrt(2*(Ixx+Iyy)),
and c is a constant (c = 4*Ixx/((Ixx+Iyy)*sqrt(pi))). Both have been
defined to avoid unnecessary floating-point operations in the root
finder.

Definition at line 358 of file NaivePlugin.py.

◆ _gradFindLength()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin._gradFindLength ( Ixx,
Iyy,
z,
c )
staticprotected
Compute the gradient of the findLength function.

Definition at line 424 of file NaivePlugin.py.

◆ check_trail()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.check_trail ( self,
measRecord,
exposure,
x0,
y0,
x1,
y1,
length )
 Set flags for edge pixels, off chip, and nan trail coordinates and
flag if trail length is three times larger than psf.

Check if the coordinates of the beginning and ending of the trail fall
inside the exposures bounding box. If not, set the off_chip flag.
If the beginning or ending falls within a pixel marked as edge, set the
edge flag. If any of the coordinates happens to fall on a nan, then
set the nan flag.
Additionally, check if the trail is three times larger than the psf. If
so, set the suspect trail flag.

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

x0: `float`
    x coordinate of the beginning of the trail.
y0: `float`
    y coordinate of the beginning of the trail.
x1: `float`
    x coordinate of the end of the trail.
y1: `float`
    y coordinate of the end of the trail.

Definition at line 272 of file NaivePlugin.py.

◆ computeLength()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.computeLength ( Ixx,
Iyy )
static
Compute the length of a trail, given unweighted second-moments.

Definition at line 450 of file NaivePlugin.py.

◆ computeRaDec()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.computeRaDec ( exposure,
x,
y )
static
Convert pixel coordinates to RA and Dec.

Parameters
----------
exposure : `lsst.afw.image.ExposureF`
    Exposure object containing the WCS.
x : `float`
    x coordinate of the trail centroid
y : `float`
    y coodinate of the trail centroid

Returns
-------
ra : `float`
    Right ascension.
dec : `float`
    Declination.

Definition at line 462 of file NaivePlugin.py.

◆ fail()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.fail ( self,
measRecord,
error = None )
Record failure

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

Definition at line 345 of file NaivePlugin.py.

◆ findLength()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.findLength ( cls,
Ixx,
Iyy )
Find the length of a trail, given adaptive second-moments.

Uses a root finder to compute the length of a trail corresponding to
the adaptive second-moments computed by previous measurements
(ie. SdssShape).

Parameters
----------
Ixx : `float`
    Adaptive second-moment along x-axis.
Iyy : `float`
    Adaptive second-moment along y-axis.

Returns
-------
length : `float`
    Length of the trail.
results : `scipy.optimize.RootResults`
    Contains messages about convergence from the root finder.

Definition at line 387 of file NaivePlugin.py.

◆ getExecutionOrder()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.getExecutionOrder ( cls)

Definition at line 90 of file NaivePlugin.py.

◆ measure()

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.measure ( self,
measRecord,
exposure )
Run the Naive trailed source measurement algorithm.

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

Definition at line 141 of file NaivePlugin.py.

Member Data Documentation

◆ ConfigClass

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.ConfigClass = SingleFrameNaiveTrailConfig
static

Definition at line 87 of file NaivePlugin.py.

◆ EDGE

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.EDGE = flagDefs.add("flag_edge", "Trail contains edge pixels")

Definition at line 131 of file NaivePlugin.py.

◆ FAILURE

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.FAILURE = flagDefs.addFailureFlag("No trailed-source measured")

Definition at line 127 of file NaivePlugin.py.

◆ flagHandler

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.flagHandler = FlagHandler.addFields(schema, name, flagDefs)

Definition at line 137 of file NaivePlugin.py.

◆ keyAngle

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyAngle = schema.addField(name + "_angle", type="D", doc="Angle measured from +x-axis.")

Definition at line 109 of file NaivePlugin.py.

◆ keyAngleErr

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyAngleErr = schema.addField(name + "_angleErr", type="D", doc="Trail angle error.")

Definition at line 124 of file NaivePlugin.py.

◆ keyDec

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyDec = schema.addField(name + "_dec", type="D", doc="Trail centroid declination.")

Definition at line 102 of file NaivePlugin.py.

◆ keyFlux

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyFlux = schema.addField(name + "_flux", type="D", doc="Trailed source flux.", units="count")

Definition at line 107 of file NaivePlugin.py.

◆ keyFluxErr

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyFluxErr
Initial value:
= schema.addField(name + "_fluxErr", type="D",
doc="Trail flux error.", units="count")

Definition at line 120 of file NaivePlugin.py.

◆ keyLength

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyLength = schema.addField(name + "_length", type="D", doc="Trail length.", units="pixel")

Definition at line 108 of file NaivePlugin.py.

◆ keyLengthErr

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyLengthErr
Initial value:
= schema.addField(name + "_lengthErr", type="D",
doc="Trail length error.", units="pixel")

Definition at line 122 of file NaivePlugin.py.

◆ keyRa

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyRa = schema.addField(name + "_ra", type="D", doc="Trail centroid right ascension.")

Definition at line 101 of file NaivePlugin.py.

◆ keyX0

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyX0 = schema.addField(name + "_x0", type="D", doc="Trail head X coordinate.", units="pixel")

Definition at line 103 of file NaivePlugin.py.

◆ keyX0Err

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyX0Err
Initial value:
= schema.addField(name + "_x0Err", type="D",
doc="Trail head X coordinate error.", units="pixel")

Definition at line 112 of file NaivePlugin.py.

◆ keyX1

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyX1 = schema.addField(name + "_x1", type="D", doc="Trail tail X coordinate.", units="pixel")

Definition at line 105 of file NaivePlugin.py.

◆ keyX1Err

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyX1Err
Initial value:
= schema.addField(name + "_x1Err", type="D",
doc="Trail tail X coordinate error.", units="pixel")

Definition at line 116 of file NaivePlugin.py.

◆ keyY0

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyY0 = schema.addField(name + "_y0", type="D", doc="Trail head Y coordinate.", units="pixel")

Definition at line 104 of file NaivePlugin.py.

◆ keyY0Err

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyY0Err
Initial value:
= schema.addField(name + "_y0Err", type="D",
doc="Trail head Y coordinate error.", units="pixel")

Definition at line 114 of file NaivePlugin.py.

◆ keyY1

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyY1 = schema.addField(name + "_y1", type="D", doc="Trail tail Y coordinate.", units="pixel")

Definition at line 106 of file NaivePlugin.py.

◆ keyY1Err

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.keyY1Err
Initial value:
= schema.addField(name + "_y1Err", type="D",
doc="Trail tail Y coordinate error.", units="pixel")

Definition at line 118 of file NaivePlugin.py.

◆ log

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.log = logging.getLogger(self.logName)

Definition at line 139 of file NaivePlugin.py.

◆ NAN

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.NAN = flagDefs.add("flag_nan", "One or more trail coordinates are missing")

Definition at line 133 of file NaivePlugin.py.

◆ NO_CONVERGE

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.NO_CONVERGE = flagDefs.add("flag_noConverge", "The root finder did not converge")

Definition at line 129 of file NaivePlugin.py.

◆ NO_FLUX

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.NO_FLUX = flagDefs.add("flag_noFlux", "No suitable prior flux measurement")

Definition at line 128 of file NaivePlugin.py.

◆ NO_SIGMA

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.NO_SIGMA = flagDefs.add("flag_noSigma", "No PSF width (sigma)")

Definition at line 130 of file NaivePlugin.py.

◆ OFFIMAGE

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.OFFIMAGE = flagDefs.add("flag_off_image", "Trail extends off image")

Definition at line 132 of file NaivePlugin.py.

◆ SHAPE

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.SHAPE = flagDefs.add("flag_shape", "Shape flag is set, trail length not calculated")

Definition at line 136 of file NaivePlugin.py.

◆ SUSPECT_LONG_TRAIL

lsst.meas.extensions.trailedSources.NaivePlugin.SingleFrameNaiveTrailPlugin.SUSPECT_LONG_TRAIL
Initial value:
= flagDefs.add("flag_suspect_long_trail",
"Trail length is greater than three times the psf radius")

Definition at line 134 of file NaivePlugin.py.


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