Skip to content

Commit bd29c5e

Browse files
committed
Flake8 fixes.
1 parent 8d83c69 commit bd29c5e

File tree

1 file changed

+40
-31
lines changed

1 file changed

+40
-31
lines changed

python/lsst/pipe/tasks/calibrateImage.py

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ class CalibrateImageConfig(pipeBase.PipelineTaskConfig, pipelineConnections=Cali
312312
"for the bright stars used for psf estimation.",
313313
)
314314

315-
# TODO DM-39203: we can remove aperture correction from this task once we are
316-
# using the shape-based star/galaxy code.
315+
# TODO DM-39203: we can remove aperture correction from this task once we
316+
# are using the shape-based star/galaxy code.
317317
measure_aperture_correction = pexConfig.ConfigurableField(
318318
target=lsst.meas.algorithms.measureApCorr.MeasureApCorrTask,
319319
doc="Task to compute the aperture correction from the bright stars."
@@ -467,8 +467,8 @@ def setDefaults(self):
467467
self.install_simple_psf.fwhm = 4
468468

469469
# S/N>=50 sources for PSF determination, but detection to S/N=10.
470-
# The thresholdValue sets the minimum flux in a pixel to be included in the
471-
# footprint, while peaks are only detected when they are above
470+
# The thresholdValue sets the minimum flux in a pixel to be included
471+
# in the footprint, while peaks are only detected when they are above
472472
# thresholdValue * includeThresholdMultiplier. The low thresholdValue
473473
# ensures that the footprints are large enough for the noise replacer
474474
# to mask out faint undetected neighbors that are not to be measured.
@@ -483,8 +483,8 @@ def setDefaults(self):
483483
# Minimal measurement plugins for PSF determination.
484484
# TODO DM-39203: We can drop GaussianFlux and PsfFlux, if we use
485485
# shapeHSM/moments for star/galaxy separation.
486-
# TODO DM-39203: we can remove aperture correction from this task once
487-
# we are using the shape-based star/galaxy code.
486+
# TODO DM-39203: we can remove aperture correction from this task
487+
# once we are using the shape-based star/galaxy code.
488488
self.psf_source_measurement.plugins = ["base_PixelFlags",
489489
"base_SdssCentroid",
490490
"ext_shapeHSM_HsmSourceMoments",
@@ -528,9 +528,9 @@ def setDefaults(self):
528528
self.star_measurement.plugins["base_CircularApertureFlux"].radii = [12.0]
529529
self.star_measurement.plugins["base_CompensatedTophatFlux"].apertures = [12]
530530

531-
# We measure and apply the normalization aperture correction with the
532-
# psf_normalized_calibration_flux task, and we only apply the normalization
533-
# aperture correction for the full list of stars.
531+
# We measure and apply the normalization aperture correction with
532+
# the psf_normalized_calibration_flux task, and we only apply the
533+
# normalization aperture correction for the full list of stars.
534534
self.star_normalized_calibration_flux.do_measure_ap_corr = False
535535

536536
# Select stars with reliable measurements and no bad flags.
@@ -717,7 +717,8 @@ def __init__(self, initial_stars_schema=None, **kwargs):
717717
# astrometric fitting, and aperture correction calculations.
718718
self.psf_fields = ("calib_psf_candidate", "calib_psf_used", "calib_psf_reserved",
719719
"calib_astrometry_used",
720-
# TODO DM-39203: these can be removed once apcorr is gone.
720+
# TODO DM-39203:
721+
# these can be removed once apcorr is gone.
721722
"apcorr_slot_CalibFlux_used", "apcorr_base_GaussianFlux_used",
722723
"apcorr_base_PsfFlux_used",)
723724
for field in self.psf_fields:
@@ -782,7 +783,8 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs):
782783
self.photometry.match.setRefObjLoader(photometry_loader)
783784

784785
if self.config.doMaskDiffractionSpikes:
785-
# Use the same photometry reference catalog for the bright star mask
786+
# Use the same photometry reference catalog for the bright star
787+
# mask.
786788
self.diffractionSpikeMask.setRefObjLoader(photometry_loader)
787789

788790
if self.config.do_illumination_correction:
@@ -851,7 +853,8 @@ def run(
851853
852854
Parameters
853855
----------
854-
exposures : `lsst.afw.image.Exposure` or `list` [`lsst.afw.image.Exposure`]
856+
exposures : `lsst.afw.image.Exposure` or \
857+
`list` [`lsst.afw.image.Exposure`]
855858
Post-ISR exposure(s), with an initial WCS, VisitInfo, and Filter.
856859
Modified in-place during processing if only one is passed.
857860
If two exposures are passed, treat them as snaps and combine
@@ -899,10 +902,12 @@ def run(
899902
This is `None` if ``config.do_calibrate_pixels`` is `False`.
900903
``astrometry_matches``
901904
Reference catalog stars matches used in the astrometric fit.
902-
(`list` [`lsst.afw.table.ReferenceMatch`] or `lsst.afw.table.BaseCatalog`)
905+
(`list` [`lsst.afw.table.ReferenceMatch`] or
906+
`lsst.afw.table.BaseCatalog`).
903907
``photometry_matches``
904908
Reference catalog stars matches used in the photometric fit.
905-
(`list` [`lsst.afw.table.ReferenceMatch`] or `lsst.afw.table.BaseCatalog`)
909+
(`list` [`lsst.afw.table.ReferenceMatch`] or
910+
`lsst.afw.table.BaseCatalog`).
906911
``mask``
907912
Copy of the mask plane of `exposure`.
908913
(`lsst.afw.image.Mask`)
@@ -1035,7 +1040,8 @@ def run(
10351040
photometry_meta, photo_calib = self._fit_photometry(result.exposure, result.stars_footprints)
10361041
have_fit_photometry = True
10371042
self.metadata["photometry_matches_count"] = len(photometry_matches)
1038-
# fit_photometry returns a new catalog, so we need a new astropy table view.
1043+
# fit_photometry returns a new catalog, so we need a new astropy
1044+
# table view.
10391045
result.stars = result.stars_footprints.asAstropy()
10401046
# summary stats don't make use of the calibrated fluxes, but we
10411047
# might as well use the best catalog we've got in case that
@@ -1055,12 +1061,12 @@ def run(
10551061
result.exposure.setWcs(None)
10561062
if not have_fit_photometry:
10571063
result.exposure.setPhotoCalib(None)
1058-
# Summary stat calculations can handle missing components gracefully,
1059-
# but we want to run them as late as possible (but still before we
1060-
# calibrate pixels, if we do that at all).
1061-
# So we run them after we succeed or if we get an AlgorithmError. We
1062-
# intentionally don't use 'finally' here because we don't want to run
1063-
# them if we get some other kind of error.
1064+
# Summary stat calculations can handle missing components
1065+
# gracefully, but we want to run them as late as possible (but
1066+
# still before we calibrate pixels, if we do that at all).
1067+
# So we run them after we succeed or if we get an AlgorithmError.
1068+
# We intentionally don't use 'finally' here because we don't
1069+
# want to run them if we get some other kind of error.
10641070
self._summarize(result.exposure, summary_stat_catalog, result.background)
10651071
raise
10661072
else:
@@ -1098,7 +1104,8 @@ def _apply_illumination_correction(self, exposure, background_flat, illumination
10981104
background_flat : `lsst.afw.image.Exposure`
10991105
Flat image that had previously been applied to exposure.
11001106
illumination_correction : `lsst.afw.image.Exposure`
1101-
Illumination correction image to convert to photometric-flattened image.
1107+
Illumination correction image to convert to photometric-flattened
1108+
image.
11021109
11031110
Returns
11041111
-------
@@ -1165,11 +1172,11 @@ def log_psf(msg, addToMetadata=False):
11651172
11661173
Parameters
11671174
----------
1168-
msg : `str`
1169-
Message to prepend the log info with.
1170-
addToMetadata : `bool`, optional
1171-
Whether to add the final psf sigma value to the task metadata
1172-
(the default is False).
1175+
msg : `str`
1176+
Message to prepend the log info with.
1177+
addToMetadata : `bool`, optional
1178+
Whether to add the final psf sigma value to the task
1179+
metadata (the default is False).
11731180
"""
11741181
position = exposure.psf.getAveragePosition()
11751182
sigma = exposure.psf.computeShape(position).getDeterminantRadius()
@@ -1282,8 +1289,8 @@ def _measure_aperture_correction(self, exposure, bright_sources):
12821289
Exposure to set the ApCorrMap on.
12831290
bright_sources : `lsst.afw.table.SourceCatalog`
12841291
Catalog of detected bright sources; modified to include columns
1285-
necessary for point source determination for the aperture correction
1286-
calculation.
1292+
necessary for point source determination for the aperture
1293+
correction calculation.
12871294
"""
12881295
norm_ap_corr_map = self.psf_normalized_calibration_flux.run(
12891296
exposure=exposure,
@@ -1414,7 +1421,8 @@ def _find_stars(self, exposure, background, id_generator, background_to_photomet
14141421
sel[indices] = True
14151422
sources = sources[sel]
14161423

1417-
# TODO investigation: Could this deblender throw away blends of non-PSF sources?
1424+
# TODO investigation: Could this deblender throw away blends of
1425+
# non-PSF sources?
14181426
self.star_deblend.run(exposure=exposure, sources=sources)
14191427
# The deblender may not produce a contiguous catalog; ensure
14201428
# contiguity for subsequent tasks.
@@ -1588,7 +1596,8 @@ def _apply_photometry(self, exposure, background, background_to_photometric_rati
15881596
"Background calibration assumes a constant PhotoCalib; PhotoCalTask should always return that."
15891597

15901598
for bg in background:
1591-
# The statsImage is a view, but we can't assign to a function call in python.
1599+
# The statsImage is a view, but we can't assign to a function call
1600+
# in python.
15921601
binned_image = bg[0].getStatsImage()
15931602
binned_image *= photo_calib.getCalibrationMean()
15941603

0 commit comments

Comments
 (0)