lsst.ip.diffim g1ab274d823+f0a0a53c05
Loading...
Searching...
No Matches
lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin Class Reference
Inheritance diagram for lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin:

Public Member Functions

 getExecutionOrder (cls)
 
 __init__ (self, config, name, schema, metadata, logName=None)
 
 measureDipoles (self, measRecord, exposure, posExp=None, negExp=None)
 
 doClassify (self, measRecord, chi2val)
 
 fail (self, measRecord, error=None)
 

Public Attributes

 log = logging.getLogger(logName)
 
 posFluxKey
 
 negFluxKey
 
 fluxKey = measBase.FluxResultKey.addFields(schema, name, doc)
 
 posCentroidKey
 
 negCentroidKey
 
 centroidKey
 
 orientationKey
 
 separationKey
 
 chi2dofKey
 
 nDataKey
 
 signalToNoiseKey
 
 classificationFlagKey
 
 classificationAttemptedFlagKey
 
 flagKey
 
 edgeFlagKey
 

Static Public Attributes

 ConfigClass = DipoleFitPluginConfig
 
 DipoleFitAlgorithmClass = DipoleFitAlgorithm
 
int FAILURE_EDGE = 1
 
int FAILURE_FIT = 2
 
int FAILURE_NOT_DIPOLE = 4
 
int FAILURE_TOO_LARGE = 8
 

Protected Member Functions

 _setupSchema (self, config, name, schema, metadata)
 

Detailed Description

A single frame measurement plugin that fits dipoles to all merged (two-peak) ``diaSources``.

This measurement plugin accepts up to three input images in
its `measure` method. If these are provided, it includes data
from the pre-subtraction posImage (science image) and optionally
negImage (template image) to constrain the fit. The meat of the
fitting routines are in the class `~lsst.module.name.DipoleFitAlgorithm`.

Notes
-----
The motivation behind this plugin and the necessity for including more than
one exposure are documented in DMTN-007 (http://dmtn-007.lsst.io).

This class is named `ip_diffim_DipoleFit` so that it may be used alongside
the existing `ip_diffim_DipoleMeasurement` classes until such a time as those
are deemed to be replaceable by this.

Definition at line 1002 of file dipoleFitTask.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.__init__ ( self,
config,
name,
schema,
metadata,
logName = None )

Definition at line 1036 of file dipoleFitTask.py.

Member Function Documentation

◆ _setupSchema()

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin._setupSchema ( self,
config,
name,
schema,
metadata )
protected
Add fields for the outputs, and save the keys for fast assignment.

Definition at line 1045 of file dipoleFitTask.py.

◆ doClassify()

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.doClassify ( self,
measRecord,
chi2val )
Classify a source as a dipole.

Parameters
----------
measRecord : TODO: DM-17458
    TODO: DM-17458
chi2val : TODO: DM-17458
    TODO: DM-17458

Notes
-----
Sources are classified as dipoles, or not, according to three criteria:

1. Does the total signal-to-noise surpass the ``minSn``?
2. Are the pos/neg fluxes greater than 1.0 and no more than 0.65 (``maxFluxRatio``)
   of the total flux? By default this will never happen since ``posFlux == negFlux``.
3. Is it a good fit (``chi2dof`` < 1)? (Currently not used.)

Definition at line 1203 of file dipoleFitTask.py.

◆ fail()

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.fail ( self,
measRecord,
error = None )
Catch failures and set the correct flags.

Fallback on the current slot centroid positions, but set the dipole
failure flag, since we attempted to fit the source.

Definition at line 1255 of file dipoleFitTask.py.

◆ getExecutionOrder()

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.getExecutionOrder ( cls)
This algorithm simultaneously fits the centroid and flux, and does
not require any previous centroid fit.

Definition at line 1030 of file dipoleFitTask.py.

◆ measureDipoles()

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.measureDipoles ( self,
measRecord,
exposure,
posExp = None,
negExp = None )
Perform the non-linear least squares minimization on the putative dipole source.

Parameters
----------
measRecord : `lsst.afw.table.SourceRecord`
    diaSources that will be measured using dipole measurement
exposure : `lsst.afw.image.Exposure`
    Difference exposure on which the diaSources were detected; `exposure = posExp-negExp`
    If both `posExp` and `negExp` are `None`, will attempt to fit the
    dipole to just the `exposure` with no constraint.
posExp : `lsst.afw.image.Exposure`, optional
    "Positive" exposure, typically a science exposure, or None if unavailable
    When `posExp` is `None`, will compute `posImage = exposure + negExp`.
negExp : `lsst.afw.image.Exposure`, optional
    "Negative" exposure, typically a template exposure, or None if unavailable
    When `negExp` is `None`, will compute `negImage = posExp - exposure`.

Notes
-----
The main functionality of this routine was placed outside of
this plugin (into `DipoleFitAlgorithm.fitDipole()`) so that
`DipoleFitAlgorithm.fitDipole()` can be called separately for
testing (@see `tests/testDipoleFitter.py`)

Definition at line 1106 of file dipoleFitTask.py.

Member Data Documentation

◆ centroidKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.centroidKey
Initial value:
= measBase.CentroidResultKey.addFields(schema,
name,
"Dipole centroid position.",
measBase.UncertaintyEnum.SIGMA_ONLY)

Definition at line 1065 of file dipoleFitTask.py.

◆ chi2dofKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.chi2dofKey
Initial value:
= schema.addField(
schema.join(name, "chi2dof"), type=float,
doc="Chi2 per degree of freedom (chi2/(nData-nVariables)) of dipole fit")

Definition at line 1078 of file dipoleFitTask.py.

◆ classificationAttemptedFlagKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.classificationAttemptedFlagKey
Initial value:
= schema.addField(
schema.join(name, "classificationAttempted"), type="Flag",
doc="Flag indicating diaSource was attempted to be classified as a dipole")

Definition at line 1094 of file dipoleFitTask.py.

◆ classificationFlagKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.classificationFlagKey
Initial value:
= schema.addField(
schema.join(name, "classification"), type="Flag",
doc="Flag indicating diaSource is classified as a dipole")

Definition at line 1090 of file dipoleFitTask.py.

◆ ConfigClass

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.ConfigClass = DipoleFitPluginConfig
static

Definition at line 1021 of file dipoleFitTask.py.

◆ DipoleFitAlgorithmClass

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.DipoleFitAlgorithmClass = DipoleFitAlgorithm
static

Definition at line 1022 of file dipoleFitTask.py.

◆ edgeFlagKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.edgeFlagKey
Initial value:
= schema.addField(
schema.join(name, "flag", "edge"), type="Flag",
doc="Flag set when dipole is too close to edge of image")

Definition at line 1102 of file dipoleFitTask.py.

◆ FAILURE_EDGE

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.FAILURE_EDGE = 1
static

Definition at line 1024 of file dipoleFitTask.py.

◆ FAILURE_FIT

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.FAILURE_FIT = 2
static

Definition at line 1025 of file dipoleFitTask.py.

◆ FAILURE_NOT_DIPOLE

int lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.FAILURE_NOT_DIPOLE = 4
static

Definition at line 1026 of file dipoleFitTask.py.

◆ FAILURE_TOO_LARGE

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.FAILURE_TOO_LARGE = 8
static

Definition at line 1027 of file dipoleFitTask.py.

◆ flagKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.flagKey
Initial value:
= schema.addField(
schema.join(name, "flag"), type="Flag",
doc="General failure flag for dipole fit")

Definition at line 1098 of file dipoleFitTask.py.

◆ fluxKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.fluxKey = measBase.FluxResultKey.addFields(schema, name, doc)

Definition at line 1055 of file dipoleFitTask.py.

◆ log

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.log = logging.getLogger(logName)

Definition at line 1041 of file dipoleFitTask.py.

◆ nDataKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.nDataKey
Initial value:
= schema.addField(
schema.join(name, "nData"), type=np.int64,
doc="Number of data points in the dipole fit")

Definition at line 1082 of file dipoleFitTask.py.

◆ negCentroidKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.negCentroidKey
Initial value:
= measBase.CentroidResultKey.addFields(schema,
schema.join(name, "neg"),
"Dipole negative lobe centroid position.",
measBase.UncertaintyEnum.SIGMA_ONLY)

Definition at line 1061 of file dipoleFitTask.py.

◆ negFluxKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.negFluxKey
Initial value:
= measBase.FluxResultKey.addFields(schema,
schema.join(name, "neg"),
"Dipole negative lobe instrumental flux.")

Definition at line 1051 of file dipoleFitTask.py.

◆ orientationKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.orientationKey
Initial value:
= schema.addField(
schema.join(name, "orientation"), type=float, units="rad",
doc="Dipole orientation. Convention is CCW from +x on image.")

Definition at line 1070 of file dipoleFitTask.py.

◆ posCentroidKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.posCentroidKey
Initial value:
= measBase.CentroidResultKey.addFields(schema,
schema.join(name, "pos"),
"Dipole positive lobe centroid position.",
measBase.UncertaintyEnum.SIGMA_ONLY)

Definition at line 1057 of file dipoleFitTask.py.

◆ posFluxKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.posFluxKey
Initial value:
= measBase.FluxResultKey.addFields(schema,
schema.join(name, "pos"),
"Dipole positive lobe instrumental flux.")

Definition at line 1048 of file dipoleFitTask.py.

◆ separationKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.separationKey
Initial value:
= schema.addField(
schema.join(name, "separation"), type=float, units="pixel",
doc="Pixel separation between positive and negative lobes of dipole")

Definition at line 1074 of file dipoleFitTask.py.

◆ signalToNoiseKey

lsst.ip.diffim.dipoleFitTask.DipoleFitPlugin.signalToNoiseKey
Initial value:
= schema.addField(
schema.join(name, "signalToNoise"), type=float,
doc="Estimated signal-to-noise of dipole fit")

Definition at line 1086 of file dipoleFitTask.py.


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