|
| __init__ (self, refObjLoader=None, schema=None, **kwds) |
|
| getSourceKeys (self, schema) |
|
| extractMagArrays (self, matches, filterLabel, sourceKeys) |
|
| run (self, exposure, sourceCat, expId=0) |
|
| displaySources (self, exposure, matches, reserved, frame=1) |
|
| getZeroPoint (self, src, ref, srcErr=None, zp0=None) |
|
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`
A reference object loader object; gen3 pipeline tasks will pass `None`
and call `match.setRefObjLoader` in `runQuantum`.
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 119 of file photoCal.py.
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 206 of file photoCal.py.
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 461 of file photoCal.py.
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 the matcher
``matchMeta`` : metadata needed to unpersist matches, as returned
by the matcher (`lsst.daf.base.PropertyList`)
``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 317 of file photoCal.py.