From 69452cbc33a7670e70f5a8f2f6f0bd11d783ec8e Mon Sep 17 00:00:00 2001 From: Jakob T McCann Date: Wed, 20 Sep 2023 12:00:20 -0700 Subject: [PATCH 1/2] Exclude injected sources during astrometric fitting --- python/lsst/pipe/tasks/calibrate.py | 3 +++ python/lsst/pipe/tasks/calibrateImage.py | 6 ++++++ python/lsst/pipe/tasks/multiBand.py | 10 ++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/python/lsst/pipe/tasks/calibrate.py b/python/lsst/pipe/tasks/calibrate.py index ac2d6b2b8..f0654570d 100644 --- a/python/lsst/pipe/tasks/calibrate.py +++ b/python/lsst/pipe/tasks/calibrate.py @@ -310,6 +310,9 @@ def setDefaults(self): self.astromRefObjLoader.anyFilterMapsToThis = "phot_g_mean" # The photoRefCat connection is the name to use for the colorterms. self.photoCal.photoCatName = self.connections.photoRefCat + # Set injected pixel flags. + self.calibrate.measurement.plugins["base_PixelFlags"].masksFpAnywhere.append("INJECTED") + self.calibrate.measurement.plugins["base_PixelFlags"].masksFpCenter.append("INJECTED_CORE") # Keep track of which footprints contain streaks self.measurement.plugins['base_PixelFlags'].masksFpAnywhere = ['STREAK'] diff --git a/python/lsst/pipe/tasks/calibrateImage.py b/python/lsst/pipe/tasks/calibrateImage.py index b3273aa68..b5b1ad90f 100644 --- a/python/lsst/pipe/tasks/calibrateImage.py +++ b/python/lsst/pipe/tasks/calibrateImage.py @@ -274,6 +274,9 @@ def setDefaults(self): "base_GaussianFlux", "base_PsfFlux", ] + # Set injected pixel flags. + self.psf_source_measurement.plugins["base_PixelFlags"].masksFpAnywhere.append("INJECTED") + self.psf_source_measurement.plugins["base_PixelFlags"].masksFpCenter.append("INJECTED_CORE") self.psf_source_measurement.slots.shape = "ext_shapeHSM_HsmSourceMoments" # Only measure apertures we need for PSF measurement. # TODO DM-40064: psfex has a hard-coded value of 9 in a psfex-config @@ -302,6 +305,9 @@ def setDefaults(self): "base_PsfFlux", "base_CircularApertureFlux", ] + # Set injected pixel flags. + self.star_measurement.plugins["base_PixelFlags"].masksFpAnywhere.append("INJECTED") + self.star_measurement.plugins["base_PixelFlags"].masksFpCenter.append("INJECTED_CORE") self.star_measurement.slots.psfShape = "ext_shapeHSM_HsmPsfMoments" self.star_measurement.slots.shape = "ext_shapeHSM_HsmSourceMoments" # Only measure the apertures we need for star selection. diff --git a/python/lsst/pipe/tasks/multiBand.py b/python/lsst/pipe/tasks/multiBand.py index f0c1d99dc..b2b535912 100644 --- a/python/lsst/pipe/tasks/multiBand.py +++ b/python/lsst/pipe/tasks/multiBand.py @@ -447,10 +447,12 @@ def setDefaults(self): 'base_Variance', 'base_LocalPhotoCalib', 'base_LocalWcs'] - self.measurement.plugins['base_PixelFlags'].masksFpAnywhere = ['CLIPPED', 'SENSOR_EDGE', - 'INEXACT_PSF', 'STREAK'] - self.measurement.plugins['base_PixelFlags'].masksFpCenter = ['CLIPPED', 'SENSOR_EDGE', - 'INEXACT_PSF', 'STREAK'] + self.measurement.plugins['base_PixelFlags'].masksFpAnywhere = [ + 'CLIPPED', 'SENSOR_EDGE', 'INEXACT_PSF', 'STREAK', 'INJECTED' + ] + self.measurement.plugins['base_PixelFlags'].masksFpCenter = [ + 'CLIPPED', 'SENSOR_EDGE', 'INEXACT_PSF', 'STREAK', 'INJECTED_CORE' + ] class MeasureMergedCoaddSourcesTask(PipelineTask): From 4cd64f7e1c29cb631003e22500ed6c7b3485800d Mon Sep 17 00:00:00 2001 From: Jakob T McCann Date: Wed, 20 Sep 2023 12:14:07 -0700 Subject: [PATCH 2/2] draft --- python/lsst/pipe/tasks/calibrate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/lsst/pipe/tasks/calibrate.py b/python/lsst/pipe/tasks/calibrate.py index f0654570d..0abec5a9a 100644 --- a/python/lsst/pipe/tasks/calibrate.py +++ b/python/lsst/pipe/tasks/calibrate.py @@ -311,8 +311,8 @@ def setDefaults(self): # The photoRefCat connection is the name to use for the colorterms. self.photoCal.photoCatName = self.connections.photoRefCat # Set injected pixel flags. - self.calibrate.measurement.plugins["base_PixelFlags"].masksFpAnywhere.append("INJECTED") - self.calibrate.measurement.plugins["base_PixelFlags"].masksFpCenter.append("INJECTED_CORE") + self.measurement.plugins["base_PixelFlags"].masksFpAnywhere.append("INJECTED") + self.measurement.plugins["base_PixelFlags"].masksFpCenter.append("INJECTED_CORE") # Keep track of which footprints contain streaks self.measurement.plugins['base_PixelFlags'].masksFpAnywhere = ['STREAK']