Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-27086: Numpydoc conversion of meas_algorithms through gaussianPsfFactory.py #214

Merged
merged 1 commit into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. lsst-task-topic:: lsst.meas.algorithms.DynamicDetectionTask

####################
DynamicDetectionTask
####################

``DynamicDetectionTask`` detects sources on an image with a dynamic threshold.

.. _lsst.meas.algorithms.DynamicDetectionTask-summary:

Processing summary
==================

``DynamicDetectionTask`` runs this sequence of operations:

#. Detects sources using a lower threshold than normal in order to identify good sky regions.

#. Performs forced PSF photometry on identified sky regions.

#. Sets threshold so that the standard deviation of measurements matches median estimated error using PSF flux measurements and estimated errors.

.. _lsst.meas.algorithms.DynamicDetectionTask-api:

Python API summary
==================

.. lsst-task-api-summary:: lsst.meas.algorithms.DynamicDetectionTask

.. _lsst.meas.algorithms.DynamicDetectionTask-subtasks:

Retargetable subtasks
=====================

.. lsst-task-config-subtasks:: lsst.meas.algorithms.DynamicDetectionTask

.. _lsst.meas.algorithms.DynamicDetectionTask-configs:

Configuration fields
====================

.. lsst-task-config-fields:: lsst.meas.algorithms.DynamicDetectionTask

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.. lsst-task-topic:: lsst.meas.algorithms.FlaggedSourceSelectorTask

#########################
FlaggedSourceSelectorTask
#########################

``FlaggedSourceSelectorTask`` uses an existing flag field to filter
a SourceCatalog.

.. _lsst.meas.algorithms.FlaggedSourceSelectorTask-summary:

Processing summary
==================

``FlaggedSourceSelectorTask`` allows procedures that need Sources
to use those Sources to determine the PSF.

.. _lsst.meas.algorithms.FlaggedSourceSelectorTask-api:

Python API summary
==================

.. lsst-task-api-summary:: lsst.meas.algorithms.FlaggedSourceSelectorTask

.. _lsst.meas.algorithms.FlaggedSourceSelectorTask-subtasks:

Retargetable subtasks
=====================

.. lsst-task-config-subtasks:: lsst.meas.algorithms.FlaggedSourceSelectorTask

.. _lsst.meas.algorithms.FlaggedSourceSelectorTask-configs:

Configuration fields
====================

.. lsst-task-config-fields:: lsst.meas.algorithms.FlaggedSourceSelectorTask
14 changes: 7 additions & 7 deletions python/lsst/meas/algorithms/dynamicDetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@


class DynamicDetectionConfig(SourceDetectionConfig):
"""Configuration for DynamicDetectionTask"""
"""Configuration for DynamicDetectionTask
"""
prelimThresholdFactor = Field(dtype=float, default=0.5,
doc="Fraction of the threshold to use for first pass (to find sky objects)")
skyObjects = ConfigurableField(target=SkyObjectsTask, doc="Generate sky objects")
Expand All @@ -42,18 +43,17 @@ class DynamicDetectionTask(SourceDetectionTask):
those sky regions. Using those PSF flux measurements and estimated errors,
we set the threshold so that the stdev of the measurements matches the
median estimated error.

Besides the usual initialisation of configurables, we also set up
the forced measurement which is deliberately not represented in
this Task's configuration parameters because we're using it as
part of the algorithm and we don't want to allow it to be modified.
"""
ConfigClass = DynamicDetectionConfig
_DefaultName = "dynamicDetection"

def __init__(self, *args, **kwargs):
"""Constructor

Besides the usual initialisation of configurables, we also set up
the forced measurement which is deliberately not represented in
this Task's configuration parameters because we're using it as part
of the algorithm and we don't want to allow it to be modified.
"""
SourceDetectionTask.__init__(self, *args, **kwargs)
self.makeSubtask("skyObjects")

Expand Down
43 changes: 29 additions & 14 deletions python/lsst/meas/algorithms/gaussianPsfFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,21 @@ class GaussianPsfFactory(Config):
)

def computeSizeAndSigma(self, fwhm=None):
"""Compute kernel size and star width as sigma

kernel size will be odd unless minSize or maxSize is used and that value is even.

@param[in] fwhm: FWHM of core star (pixels); if None then defaultFwhm is used
@return two values:
- kernel size (width == height) in pixels
- sigma equivalent to supplied fwhm, assuming a Gaussian (pixels)

@warning assumes a valid config
"""Compute kernel size and star width as sigma. The kernel size will be
odd unless minSize or maxSize is used and that value is even. Assumes
a valid config.

Parameters
----------
fwhm : `float`
FWHM of core star (pixels); if None then defaultFwhm is used

Returns
-------
size : `int`
Kernel size (width == height) in pixels
sigma : `float`
Sigma equivalent to supplied FWHM, assuming a Gaussian (pixels)
"""
if fwhm is None:
fwhm = self.defaultFwhm
Expand All @@ -136,9 +141,17 @@ def validate(self):
def apply(self, fwhm=None):
"""Construct a GaussianPsf

@param[in] self: an instance of ConfigClass
@param[in] fwhm: FWHM of core of star (pixels); if None then self.defaultFwhm is used
@return a DoubleGaussianPsf if self.addWing is True, else a SingleGaussianPsf
Parameters
----------
fwhm : `float`
FWHM of core of star (pixels); if None then self.defaultFwhm is used

Returns
-------
DoubleGaussianPsf : ``lsst.meas.algorithms.DoubleGaussianPsf``
Returns if self.addWing is True
SingleGaussianPsf : ``lsst.meas.algorithms.SingleGaussianPsf``
Returns if self.addWing is False
"""
kernelSize, sigma = self.computeSizeAndSigma(fwhm)
if self.addWing:
Expand All @@ -154,7 +167,9 @@ def makeField(cls, doc):
def applyWrapper(config, **kwargs):
"""Construct a Gaussian PSF

@param[in] config: an instance of GaussianPsfFactory
Parameters
----------
config : instance of ``GaussianPsfFactory``
"""
return config.apply(**kwargs)
return ConfigurableField(
Expand Down