From b385dab87bd91abaffddca622efd7d79c6fa7f40 Mon Sep 17 00:00:00 2001 From: John Parejko Date: Thu, 25 Jan 2024 16:48:31 -0800 Subject: [PATCH] Rename output to exposure The input is now a multiple `exposures`, so we can use that to simplify the code. --- python/lsst/pipe/tasks/calibrateImage.py | 20 ++++++++++---------- tests/test_calibrateImage.py | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/python/lsst/pipe/tasks/calibrateImage.py b/python/lsst/pipe/tasks/calibrateImage.py index 74474e3e6..bb040076b 100644 --- a/python/lsst/pipe/tasks/calibrateImage.py +++ b/python/lsst/pipe/tasks/calibrateImage.py @@ -78,7 +78,7 @@ class CalibrateImageConnections(pipeBase.PipelineTaskConnections, # TODO DM-38732: We want some kind of flag on Exposures/Catalogs to make # it obvious which components had failed to be computed/persisted. - output_exposure = connectionTypes.Output( + exposure = connectionTypes.Output( doc="Photometrically calibrated exposure with fitted calibrations and summary statistics.", name="initial_pvi", storageClass="ExposureF", @@ -455,7 +455,7 @@ def run(self, *, exposures, result=None): result : `lsst.pipe.base.Struct` Results as a struct with attributes: - ``output_exposure`` + ``exposure`` Calibrated exposure, with pixels in nJy units. (`lsst.afw.image.Exposure`) ``stars`` @@ -479,7 +479,7 @@ def run(self, *, exposures, result=None): (`list` [`lsst.afw.table.ReferenceMatch`] or `lsst.afw.table.BaseCatalog`) """ if result is None: - result = pipeBase.Struct(output_exposure=None, + result = pipeBase.Struct(exposure=None, stars=None, background=None, psf_stars=None, @@ -488,26 +488,26 @@ def run(self, *, exposures, result=None): photometry_matches=None, ) - result.output_exposure = self._handle_snaps(exposures) + result.exposure = self._handle_snaps(exposures) - result.psf_stars, result.background, candidates = self._compute_psf(result.output_exposure) + result.psf_stars, result.background, candidates = self._compute_psf(result.exposure) - self._measure_aperture_correction(result.output_exposure, result.psf_stars) + self._measure_aperture_correction(result.exposure, result.psf_stars) - stars = self._find_stars(result.output_exposure, result.background) + stars = self._find_stars(result.exposure, result.background) result.stars = stars - astrometry_matches, astrometry_meta = self._fit_astrometry(result.output_exposure, stars) + astrometry_matches, astrometry_meta = self._fit_astrometry(result.exposure, stars) if self.config.optional_outputs: result.astrometry_matches = lsst.meas.astrom.denormalizeMatches(astrometry_matches, astrometry_meta) result.stars, photometry_matches, \ - photometry_meta, result.applied_photo_calib = self._fit_photometry(result.output_exposure, + photometry_meta, result.applied_photo_calib = self._fit_photometry(result.exposure, result.stars) if self.config.optional_outputs: photometry_matches = lsst.meas.astrom.denormalizeMatches(photometry_matches, photometry_meta) - self._summarize(result.output_exposure, stars, result.background) + self._summarize(result.exposure, stars, result.background) return result diff --git a/tests/test_calibrateImage.py b/tests/test_calibrateImage.py index 5e17356f9..050094ed0 100644 --- a/tests/test_calibrateImage.py +++ b/tests/test_calibrateImage.py @@ -132,7 +132,7 @@ def _check_run(self, calibrate, result, *, photo_calib): self.assertEqual(len(result.background), 4) # Check that the summary statistics are reasonable. - summary = result.output_exposure.info.getSummaryStats() + summary = result.exposure.info.getSummaryStats() self.assertFloatsAlmostEqual(summary.psfSigma, 2.0, rtol=1e-2) self.assertFloatsAlmostEqual(summary.ra, self.sky_center.getRa().asDegrees(), rtol=1e-7) self.assertFloatsAlmostEqual(summary.dec, self.sky_center.getDec().asDegrees(), rtol=1e-7) @@ -470,7 +470,7 @@ def test_runQuantum(self): "astrometry_ref_cat": [self.htm_id], "photometry_ref_cat": [self.htm_id], # outputs - "output_exposure": self.visit_id, + "exposure": self.visit_id, "stars": self.visit_id, "background": self.visit_id, "psf_stars": self.visit_id, @@ -497,7 +497,7 @@ def test_runQuantum_2_snaps(self): "astrometry_ref_cat": [self.htm_id], "photometry_ref_cat": [self.htm_id], # outputs - "output_exposure": self.visit_id, + "exposure": self.visit_id, "stars": self.visit_id, "background": self.visit_id, "psf_stars": self.visit_id, @@ -526,7 +526,7 @@ def test_runQuantum_no_optional_outputs(self): "astrometry_ref_cat": [self.htm_id], "photometry_ref_cat": [self.htm_id], # outputs - "output_exposure": self.visit_id, + "exposure": self.visit_id, "stars": self.visit_id, "applied_photo_calib": self.visit_id, "background": self.visit_id,