lsst.pipe.tasks gb62d540790+b6d38464c3
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pipe.tasks.photoCal.PhotoCalTask Class Reference
Inheritance diagram for lsst.pipe.tasks.photoCal.PhotoCalTask:

Public Member Functions

def __init__ (self, refObjLoader, schema=None, **kwds)
 
def getSourceKeys (self, schema)
 
def extractMagArrays (self, matches, filterLabel, sourceKeys)
 
def run (self, exposure, sourceCat, expId=0)
 
def displaySources (self, exposure, matches, reserved, frame=1)
 
def getZeroPoint (self, src, ref, srcErr=None, zp0=None)
 

Public Attributes

 scatterPlot
 
 fig
 
 usedKey
 
 match
 

Static Public Attributes

 ConfigClass = PhotoCalConfig
 

Detailed Description

Calculate an Exposure's zero-point given a set of flux measurements
of stars matched to an input catalogue.

Parameters
----------
refObjLoader : `lsst.meas.algorithms.ReferenceObjectLoader`
    An instance of LoadReferenceObjectsTasks that supplies an external reference
    catalog.
schema : `lsst.afw.table.Schema`, optional
    The schema of the detection catalogs used as input to this task.
**kwds
    Additional keyword arguments.

Notes
-----
The type of flux to use is specified by PhotoCalConfig.fluxField.

The algorithm clips outliers iteratively, with parameters set in the configuration.

This task can adds fields to the schema, so any code calling this task must ensure that
these columns are indeed present in the input match list; see `pipe_tasks_photocal_Example`.

Debugging:

The available `~lsst.base.lsstDebug` variables in PhotoCalTask are:

display :
    If True enable other debug outputs.
displaySources :
    If True, display the exposure on ds9's frame 1 and overlay the source catalogue.

red o :
    Reserved objects.
green o :
    Objects used in the photometric calibration.

scatterPlot :
    Make a scatter plot of flux v. reference magnitude as a function of reference magnitude:

    - good objects in blue
    - rejected objects in red

(if scatterPlot is 2 or more, prompt to continue after each iteration)

Definition at line 118 of file photoCal.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.tasks.photoCal.PhotoCalTask.__init__ (   self,
  refObjLoader,
  schema = None,
**  kwds 
)

Definition at line 167 of file photoCal.py.

Member Function Documentation

◆ displaySources()

def lsst.pipe.tasks.photoCal.PhotoCalTask.displaySources (   self,
  exposure,
  matches,
  reserved,
  frame = 1 
)
Display sources we'll use for photocal.

Sources that will be actually used will be green.
Sources reserved from the fit will be red.

Parameters
----------
exposure : `lsst.afw.image.ExposureF`
    Exposure to display.
matches : `list` of `lsst.afw.table.RefMatch`
    Matches used for photocal.
reserved : `numpy.ndarray` of type `bool`
    Boolean array indicating sources that are reserved.
frame : `int`, optional
    Frame number for display.

Definition at line 429 of file photoCal.py.

◆ extractMagArrays()

def lsst.pipe.tasks.photoCal.PhotoCalTask.extractMagArrays (   self,
  matches,
  filterLabel,
  sourceKeys 
)
Extract magnitude and magnitude error arrays from the given matches.

Parameters
----------
matches : `lsst.afw.table.ReferenceMatchVector`
    Reference/source matches.
filterLabel : `str`
    Label of filter being calibrated.
sourceKeys : `lsst.pipe.base.Struct`
    Struct of source catalog keys, as returned by getSourceKeys().

Returns
-------
result : `lsst.pipe.base.Struct`
    Results as a struct with attributes:

    ``srcMag``
        Source magnitude (`np.array`).
    ``refMag``
        Reference magnitude (`np.array`).
    ``srcMagErr``
        Source magnitude error (`np.array`).
    ``refMagErr``
        Reference magnitude error (`np.array`).
    ``magErr``
        An error in the magnitude; the error in ``srcMag`` - ``refMag``.
        If nonzero, ``config.magErrFloor`` will be added to ``magErr`` only
        (not ``srcMagErr`` or ``refMagErr``), as
        ``magErr`` is what is later used to determine the zero point (`np.array`).
    ``refFluxFieldList``
        A list of field names of the reference catalog used for fluxes (1 or 2 strings) (`list`).

Definition at line 205 of file photoCal.py.

◆ getSourceKeys()

def lsst.pipe.tasks.photoCal.PhotoCalTask.getSourceKeys (   self,
  schema 
)
Return a struct containing the source catalog keys for fields used
by PhotoCalTask.

Parameters
----------
schema : `lsst.afw.table.schema`
    Schema of the catalog to get keys from.

Returns
-------
result : `lsst.pipe.base.Struct`
    Results as a struct with attributes:

    ``instFlux``
        Instrument flux key.
    ``instFluxErr``
        Instrument flux error key.

Definition at line 181 of file photoCal.py.

◆ getZeroPoint()

def lsst.pipe.tasks.photoCal.PhotoCalTask.getZeroPoint (   self,
  src,
  ref,
  srcErr = None,
  zp0 = None 
)
Flux calibration code, returning (ZeroPoint, Distribution Width, Number of stars).

Returns
-------
result : `lsst.pipe.base.Struct`
    Results as a struct with attributes:

    ``zp``
        Photometric zero point (mag, `float`).
    ``sigma``
        Standard deviation of fit of photometric zero point (mag, `float`).
    ``ngood``
        Number of sources used to fit photometric zero point (`int`).

Notes
-----
We perform nIter iterations of a simple sigma-clipping algorithm with a couple of twists:
- We use the median/interquartile range to estimate the position to clip around, and the
"sigma" to use.
- We never allow sigma to go _above_ a critical value sigmaMax --- if we do, a sufficiently
large estimate will prevent the clipping from ever taking effect.
- Rather than start with the median we start with a crude mode.  This means that a set of magnitude
residuals with a tight core and asymmetrical outliers will start in the core.  We use the width of
this core to set our maximum sigma (see second bullet).

Definition at line 454 of file photoCal.py.

◆ run()

def lsst.pipe.tasks.photoCal.PhotoCalTask.run (   self,
  exposure,
  sourceCat,
  expId = 0 
)
Do photometric calibration - select matches to use and (possibly iteratively) compute
the zero point.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure upon which the sources in the matches were detected.
sourceCat : `lsst.afw.image.SourceCatalog`
    A catalog of sources to use in the calibration
    (i.e. a `list` of `lsst.afw.table.Match` with
    first being of type `lsst.afw.table.SimpleRecord` and second type `lsst.afw.table.SourceRecord`
    the reference object and matched object respectively).
    Will not be modified except to set the outputField if requested.
expId : `int`, optional
    Exposure ID.

Returns
-------
result : `lsst.pipe.base.Struct`
    Results as a struct with attributes:

    ``photoCalib``
        Object containing the zero point (`lsst.afw.image.Calib`).
    ``arrays``
        Magnitude arrays returned be `PhotoCalTask.extractMagArrays`.
    ``matches``
        ReferenceMatchVector, as returned by `PhotoCalTask.selectMatches`.
    ``zp``
        Photometric zero point (mag, `float`).
    ``sigma``
        Standard deviation of fit of photometric zero point (mag, `float`).
    ``ngood``
        Number of sources used to fit photometric zero point (`int`).

Raises
------
RuntimeError
    Raised if any of the following occur:
    - No matches to use for photocal.
    - No matches are available (perhaps no sources/references were selected by the matcher).
    - No reference stars are available.
    - No matches are available from which to extract magnitudes.

Notes
-----
The exposure is only used to provide the name of the filter being calibrated (it may also be
used to generate debugging plots).

The reference objects:
- Must include a field ``photometric``; True for objects which should be considered as
photometric standards.
- Must include a field ``flux``; the flux used to impose a magnitude limit and also to calibrate
the data to (unless a color term is specified, in which case ColorTerm.primary is used;
See https://jira.lsstcorp.org/browse/DM-933).
- May include a field ``stargal``; if present, True means that the object is a star.
- May include a field ``var``; if present, True means that the object is variable.

The measured sources:
- Must include PhotoCalConfig.fluxField; the flux measurement to be used for calibration.

Definition at line 316 of file photoCal.py.

Member Data Documentation

◆ ConfigClass

lsst.pipe.tasks.photoCal.PhotoCalTask.ConfigClass = PhotoCalConfig
static

Definition at line 164 of file photoCal.py.

◆ fig

lsst.pipe.tasks.photoCal.PhotoCalTask.fig

Definition at line 170 of file photoCal.py.

◆ match

lsst.pipe.tasks.photoCal.PhotoCalTask.match

Definition at line 176 of file photoCal.py.

◆ scatterPlot

lsst.pipe.tasks.photoCal.PhotoCalTask.scatterPlot

Definition at line 169 of file photoCal.py.

◆ usedKey

lsst.pipe.tasks.photoCal.PhotoCalTask.usedKey

Definition at line 172 of file photoCal.py.


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