lsst.pipe.tasks  21.0.0-105-g89a8187d+5c5fa69342
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pipe.tasks.photoCal.PhotoCalTask Class Reference

More...

Inheritance diagram for lsst.pipe.tasks.photoCal.PhotoCalTask:

Public Member Functions

def __init__ (self, refObjLoader, schema=None, **kwds)
 Create the photometric calibration task. More...
 
def getSourceKeys (self, schema)
 
def extractMagArrays (self, matches, filterLabel, sourceKeys)
 Extract magnitude and magnitude error arrays from the given matches. More...
 
def run (self, exposure, sourceCat, expId=0)
 Do photometric calibration - select matches to use and (possibly iteratively) compute the zero point. More...
 
def displaySources (self, exposure, matches, reserved, frame=1)
 
def getZeroPoint (self, src, ref, srcErr=None, zp0=None)
 Flux calibration code, returning (ZeroPoint, Distribution Width, Number of stars) More...
 

Public Attributes

 scatterPlot
 
 fig
 
 usedKey
 
 match
 

Static Public Attributes

 ConfigClass = PhotoCalConfig
 

Detailed Description

Calculate the zero point of an exposure given a lsst.afw.table.ReferenceMatchVector.

Contents

Description

Calculate an Exposure's zero-point given a set of flux measurements of stars matched to an input catalogue. The type of flux to use is specified by PhotoCalConfig.fluxField.

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

Note
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 A complete example of using PhotoCalTask

Task initialisation

Create the photometric calibration task. See PhotoCalTask.init for documentation

Inputs/Outputs to the run method

Do photometric calibration - select matches to use and (possibly iteratively) compute the zero point.

Parameters
[in]exposureExposure upon which the sources in the matches were detected.
[in]sourceCatA 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.).
Returns
Struct of:

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.

Configuration parameters

See PhotoCalConfig

Debug variables

The command line task interface supports a flag -d to import debug.py from your PYTHONPATH; see Using lsstDebug to control debugging output for more about debug.py files.

The available variables in PhotoCalTask are:

display
If True enable other debug outputs
displaySources
If True, display the exposure on the display'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)

A complete example of using PhotoCalTask

This code is in , and can be run as e.g examples/photoCalTask.py photoCalTask.py Import the tasks (there are some other standard imports; read the file for details) from lsst.pipe.tasks.astrometry measPhotocal We need to create both our tasks before processing any data as the task constructors can add extra columns to the schema which we get from the input catalogue, scrCat: getSchema Astrometry first: AstrometryTask.ConfigClass aTask (that filterMap line is because our test code doesn't use a filter that the reference catalogue recognises, so we tell it to use the r band) Then photometry: measPhotocal pTask If the schema has indeed changed we need to add the new columns to the source table (yes; this should be easier!) srcCat srcCat = cat We're now ready to process the data (we could loop over multiple exposures/catalogues using the same task objects): matches result We can then unpack and use the results: calib np.log To investigate the Debug variables, put something like

import lsstDebug
def DebugInfo(name):
di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively
if name.endswith(".PhotoCal"):
di.display = 1
return di
lsstDebug.Info = DebugInfo

into your debug.py file and run photoCalTask.py with the –debug flag.

Definition at line 126 of file photoCal.py.

Constructor & Destructor Documentation

◆ __init__()

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

Create the photometric calibration task.

See PhotoCalTask.init for documentation

Definition at line 247 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`
    Frame number for display.

Definition at line 486 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.

    @param[in] matches Reference/source matches, a @link lsst::afw::table::ReferenceMatchVector@endlink
    @param[in] filterLabel Label of filter being calibrated
    @param[in] sourceKeys  Struct of source catalog keys, as returned by getSourceKeys()

    @return Struct containing srcMag, refMag, srcMagErr, refMagErr, and magErr numpy arrays
    where magErr is 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.
    Struct also contains refFluxFieldList: a list of field names of the reference catalog used for fluxes
    (1 or 2 strings)
    @note These magnitude arrays are the @em inputs to the photometric calibration, some may have been
    discarded by clipping while estimating the calibration (https://jira.lsstcorp.org/browse/DM-813)

Definition at line 286 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`
    Result struct with components:

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

Definition at line 263 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)

    We perform nIter iterations of a simple sigma-clipping algorithm with a couple of twists:
    1.  We use the median/interquartile range to estimate the position to clip around, and the
    "sigma" to use.
    2.  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.
    3.  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 2.)

    @return Struct of:
     - zp ---------- Photometric zero point (mag)
     - sigma ------- Standard deviation of fit of zero point (mag)
     - ngood ------- Number of sources used to fit zero point

Definition at line 511 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
[in]exposureExposure upon which the sources in the matches were detected.
[in]sourceCatA 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.).
Returns
Struct of:

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.

Definition at line 391 of file photoCal.py.

Member Data Documentation

◆ ConfigClass

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

Definition at line 244 of file photoCal.py.

◆ fig

lsst.pipe.tasks.photoCal.PhotoCalTask.fig

Definition at line 252 of file photoCal.py.

◆ match

lsst.pipe.tasks.photoCal.PhotoCalTask.match

Definition at line 258 of file photoCal.py.

◆ scatterPlot

lsst.pipe.tasks.photoCal.PhotoCalTask.scatterPlot

Definition at line 251 of file photoCal.py.

◆ usedKey

lsst.pipe.tasks.photoCal.PhotoCalTask.usedKey

Definition at line 254 of file photoCal.py.


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