lsst.pipe.tasks g3d3fc359a7+8335dcbd4d
|
Public Member Functions | |
def | __init__ (self, schema=None, **kwargs) |
Create the detection task. More... | |
def | run (self, exposure, sources, expId=0, matches=None) |
Measure the PSF. More... | |
def | usesMatches (self) |
Public Attributes | |
candidateKey | |
usedKey | |
Static Public Attributes | |
ConfigClass = MeasurePsfConfig | |
Measure the PSF
A task that selects stars from a catalog of sources and uses those to measure the PSF.
The star selector is a subclass of lsst.meas.algorithms.BaseStarSelectorTask and the PSF determiner is a sublcass of lsst.meas.algorithms.BasePsfDeterminerTask
Measure the PSF.
@param[in,out] exposure Exposure to process; measured PSF will be added. @param[in,out] sources Measured sources on exposure; flag fields will be set marking stars chosen by the star selector and the PSF determiner if a schema was passed to the task constructor. @param[in] expId Exposure id used for generating random seed. @param[in] matches A list of lsst.afw.table.ReferenceMatch objects (@em i.e. of lsst.afw.table.Match with @c first being of type lsst.afw.table.SimpleRecord and @c second type lsst.afw.table.SourceRecord --- the reference object and detected object respectively) as returned by @em e.g. the AstrometryTask. Used by star selectors that choose to refer to an external catalog. @return a pipe.base.Struct with fields: - psf: The measured PSF (also set in the input exposure) - cellSet: an lsst.afw.math.SpatialCellSet containing the PSF candidates as returned by the psf determiner.
See MeasurePsfConfig.
The command line task interface supports a flag -d
to import debug.py from your PYTHONPATH
; see the lsstDebug documentation for more about debug.py files.
display
Additionally you can enable any debug outputs that your chosen star selector and psf determiner support.
This code is in measurePsfTask.py
in the examples directory, and can be run as e.g.
The example also runs SourceDetectionTask and SingleFrameMeasurementTask.
Import the tasks (there are some other standard imports; read the file to see them all):
We need to create the tasks before processing any data as the task constructor can add an extra column to the schema, but first we need an almost-empty Schema:
We can now call the constructors for the tasks we need to find and characterize candidate PSF stars:
Note that we've chosen a minimal set of measurement plugins: we need the outputs of base_SdssCentroid
, base_SdssShape
and base_CircularApertureFlux
as inputs to the PSF measurement algorithm, while base_PixelFlags
identifies and flags bad sources (e.g. with pixels too close to the edge) so they can be removed later.
Now we can create and configure the task that we're interested in:
We're now ready to process the data (we could loop over multiple exposures/catalogues using the same task objects). First create the output table:
And process the image:
We can then unpack and use the results:
If you specified --doDisplay
you can see the PSF candidates:
To investigate the Debug variables, put something like
into your debug.py file and run measurePsfTask.py with the --debug
flag.
Definition at line 66 of file measurePsf.py.
def lsst.pipe.tasks.measurePsf.MeasurePsfTask.__init__ | ( | self, | |
schema = None , |
|||
** | kwargs | ||
) |
Create the detection task.
Most arguments are simply passed onto pipe.base.Task.
@param schema An lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog @param **kwargs Keyword arguments passed to lsst.pipe.base.task.Task.__init__. If schema is not None, 'calib_psf_candidate' and 'calib_psf_used' fields will be added to identify which stars were employed in the PSF estimation. @note This task can add fields to the schema, so any code calling this task must ensure that these fields are indeed present in the input table.
Definition at line 216 of file measurePsf.py.
def lsst.pipe.tasks.measurePsf.MeasurePsfTask.run | ( | self, | |
exposure, | |||
sources, | |||
expId = 0 , |
|||
matches = None |
|||
) |
Measure the PSF.
@param[in,out] exposure Exposure to process; measured PSF will be added. @param[in,out] sources Measured sources on exposure; flag fields will be set marking stars chosen by the star selector and the PSF determiner if a schema was passed to the task constructor. @param[in] expId Exposure id used for generating random seed. @param[in] matches A list of lsst.afw.table.ReferenceMatch objects (@em i.e. of lsst.afw.table.Match with @c first being of type lsst.afw.table.SimpleRecord and @c second type lsst.afw.table.SourceRecord --- the reference object and detected object respectively) as returned by @em e.g. the AstrometryTask. Used by star selectors that choose to refer to an external catalog. @return a pipe.base.Struct with fields: - psf: The measured PSF (also set in the input exposure) - cellSet: an lsst.afw.math.SpatialCellSet containing the PSF candidates as returned by the psf determiner.
Definition at line 251 of file measurePsf.py.
def lsst.pipe.tasks.measurePsf.MeasurePsfTask.usesMatches | ( | self | ) |
Return True if this task makes use of the "matches" argument to the run method
Definition at line 344 of file measurePsf.py.
lsst.pipe.tasks.measurePsf.MeasurePsfTask.candidateKey |
Definition at line 231 of file measurePsf.py.
|
static |
Definition at line 213 of file measurePsf.py.
lsst.pipe.tasks.measurePsf.MeasurePsfTask.usedKey |
Definition at line 236 of file measurePsf.py.