Skip to content

Commit

Permalink
Handful of Flake8 and doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenam committed Jul 11, 2022
1 parent 1be5484 commit 4342392
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions python/lsst/meas/base/forcedPhotCcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,17 @@ def makeDataRefList(self, namespace):
calexp = ref.get("calexp")
wcs = calexp.getWcs()
box = calexp.getBBox()
# Going with just the nearest tract. Since we're throwing all tracts for the visit
# together, this shouldn't be a problem unless the tracts are much smaller than a CCD.
# Going with just the nearest tract. Since we're throwing
# all tracts for the visit together, this shouldn't be a
# problem unless the tracts are much smaller than a CCD.
tract = skymap.findTract(wcs.pixelToSky(box.getCenter()))
if imageOverlapsTract(tract, wcs, box, log=log):
visitTract[visit].add(tract.getId())
else:
self.refList.extend(ref for ref in namespace.butler.subset(self.datasetType, dataId=dataId))

# Ensure all components of a visit are kept together by putting them all in the same set of tracts
# Ensure all components of a visit are kept together by putting them
# all in the same set of tracts.
for visit, tractSet in visitTract.items():
for ref in visitRefs[visit]:
for tract in tractSet:
Expand Down Expand Up @@ -397,8 +399,8 @@ class ForcedPhotCcdConfig(pipeBase.PipelineTaskConfig,

def setDefaults(self):
# Docstring inherited.
# Make catalogCalculation a no-op by default as no modelFlux is setup by default in
# ForcedMeasurementTask
# Make catalogCalculation a no-op by default as no modelFlux is setup
# by default in ForcedMeasurementTask.
super().setDefaults()
self.measurement.plugins.names |= ['base_LocalPhotoCalib', 'base_LocalWcs']
self.catalogCalculation.plugins.names = []
Expand All @@ -423,15 +425,15 @@ class ForcedPhotCcdTask(pipeBase.PipelineTask, pipeBase.CmdLineTask):
Notes
-----
The `runDataRef` method takes a `~lsst.daf.persistence.ButlerDataRef` argument
that corresponds to a single CCD. This should contain the data ID keys that
correspond to the ``forced_src`` dataset (the output dataset for this
task), which are typically all those used to specify the ``calexp`` dataset
(``visit``, ``raft``, ``sensor`` for LSST data) as well as a coadd tract.
The tract is used to look up the appropriate coadd measurement catalogs to
use as references (e.g. ``deepCoadd_src``; see
The `runDataRef` method takes a `~lsst.daf.persistence.ButlerDataRef`
argument that corresponds to a single CCD. This should contain the data
ID keys that correspond to the ``forced_src`` dataset (the output dataset
for this task), which are typically all those used to specify the
``calexp`` dataset (``visit``, ``raft``, ``sensor`` for LSST data) as well
as a coadd tract. The tract is used to look up the appropriate coadd
measurement catalogs to use as references (e.g. ``deepCoadd_src``; see
:lsst-task:`lsst.meas.base.references.CoaddSrcReferencesTask` for more
information). While the tract must be given as part of the dataRef, the
information). While the tract must be given as part of the dataRef, the
patches are determined automatically from the bounding box and WCS of the
calexp to be measured, and the filter used to fetch references is set via
the ``filter`` option in the configuration of
Expand All @@ -453,8 +455,9 @@ def __init__(self, butler=None, refSchema=None, initInputs=None, **kwds):
if refSchema is None:
refSchema = self.references.schema
self.makeSubtask("measurement", refSchema=refSchema)
# It is necessary to get the schema internal to the forced measurement task until such a time
# that the schema is not owned by the measurement task, but is passed in by an external caller
# It is necessary to get the schema internal to the forced measurement
# task until such a time that the schema is not owned by the
# measurement task, but is passed in by an external caller.
if self.config.doApCorr:
self.makeSubtask("applyApCorr", schema=self.measurement.schema)
self.makeSubtask('catalogCalculation', schema=self.measurement.schema)
Expand Down Expand Up @@ -684,7 +687,7 @@ def runDataRef(self, dataRef, psfCache=None):
the ``getExposure`` method (implemented by derived classes) to
read the measurment image, and the ``fetchReferences`` method to
get the exposure and load the reference catalog (see
:lsst-task`lsst.meas.base.references.CoaddSrcReferencesTask`).
:lsst-task:`lsst.meas.base.references.CoaddSrcReferencesTask`).
Refer to derived class documentation for details of the datasets
and data ID keys which are used.
psfCache : `int`, optional
Expand Down Expand Up @@ -829,21 +832,22 @@ def fetchReferences(self, dataRef, exposure):
badParents.add(record.getId())
elif record.getParent() not in badParents:
references.append(record)
# catalog must be sorted by parent ID for lsst.afw.table.getChildren to work
# Catalog must be sorted by parent ID for lsst.afw.table.getChildren to
# work.
references.sort(lsst.afw.table.SourceTable.getParentKey())
return references

def attachFootprints(self, sources, refCat, exposure, refWcs):
r"""Attach footprints to blank sources prior to measurements.
"""Attach footprints to blank sources prior to measurements.
Notes
-----
`~lsst.afw.detection.Footprint`\ s for forced photometry must be in the
pixel coordinate system of the image being measured, while the actual
detections may start out in a different coordinate system.
`~lsst.afw.detection.Footprint` objects for forced photometry must
be in the pixel coordinate system of the image being measured, while
the actual detections may start out in a different coordinate system.
Subclasses of this class may implement this method to define how
those `~lsst.afw.detection.Footprint`\ s should be generated.
those `~lsst.afw.detection.Footprint` objects should be generated.
This default implementation transforms depends on the
``footprintSource`` configuration parameter.
Expand Down

0 comments on commit 4342392

Please sign in to comment.