From 645a14d8cc44d3691affb4e6641f4fa449f6df9a Mon Sep 17 00:00:00 2001 From: Audrey Budlong Date: Wed, 11 Dec 2024 20:49:01 -0800 Subject: [PATCH] Rename dipole classification "flag" and add attempted dipole classification --- python/lsst/ip/diffim/computeSpatiallySampledMetrics.py | 2 +- python/lsst/ip/diffim/dipoleFitTask.py | 4 ++-- tests/test_detectAndMeasure.py | 6 +++--- tests/test_dipoleFitter.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/python/lsst/ip/diffim/computeSpatiallySampledMetrics.py b/python/lsst/ip/diffim/computeSpatiallySampledMetrics.py index 57e5e7f6..804f8274 100644 --- a/python/lsst/ip/diffim/computeSpatiallySampledMetrics.py +++ b/python/lsst/ip/diffim/computeSpatiallySampledMetrics.py @@ -284,7 +284,7 @@ def _evaluateLocalMetric(self, src, science, matchedTemplate, template, differen src.setCoord(science.wcs.pixelToSky(peak['i_x'], peak['i_y'])) selectSources = diaSources[bbox.contains(diaSources.getX(), diaSources.getY())] sourceDensity = len(selectSources)/area - dipoleSources = selectSources[selectSources["ip_diffim_DipoleFit_flag_classification"]] + dipoleSources = selectSources[selectSources["ip_diffim_DipoleFit_classification"]] dipoleDensity = len(dipoleSources)/area if dipoleSources: diff --git a/python/lsst/ip/diffim/dipoleFitTask.py b/python/lsst/ip/diffim/dipoleFitTask.py index fad38d33..666ae062 100644 --- a/python/lsst/ip/diffim/dipoleFitTask.py +++ b/python/lsst/ip/diffim/dipoleFitTask.py @@ -1041,11 +1041,11 @@ def _setupSchema(self, config, name, schema, metadata): doc="Estimated signal-to-noise of dipole fit") self.classificationFlagKey = schema.addField( - schema.join(name, "flag", "classification"), type="Flag", + schema.join(name, "classification"), type="Flag", doc="Flag indicating diaSource is classified as a dipole") self.classificationAttemptedFlagKey = schema.addField( - schema.join(name, "flag", "classificationAttempted"), type="Flag", + schema.join(name, "classificationAttempted"), type="Flag", doc="Flag indicating diaSource was attempted to be classified as a dipole") self.flagKey = schema.addField( diff --git a/tests/test_detectAndMeasure.py b/tests/test_detectAndMeasure.py index 173897df..474318eb 100644 --- a/tests/test_detectAndMeasure.py +++ b/tests/test_detectAndMeasure.py @@ -360,11 +360,11 @@ def test_detect_dipoles(self): # Avoid placing sources near the edge for this test, so that we can # easily check that the correct number of sources are detected. templateBorderSize = kernelSize//2 - dipoleFlag = "ip_diffim_DipoleFit_flag_classification" + dipoleFlag = "ip_diffim_DipoleFit_classification" kwargs = {"seed": staticSeed, "psfSize": 2.4, "fluxLevel": fluxLevel, "fluxRange": fluxRange, "nSrc": nSources, "templateBorderSize": templateBorderSize, "kernelSize": kernelSize, "xSize": xSize, "ySize": ySize} - dipoleFlag = "ip_diffim_DipoleFit_flag_classification" + dipoleFlag = "ip_diffim_DipoleFit_classification" science, sources = makeTestImage(noiseLevel=noiseLevel, noiseSeed=6, **kwargs) matchedTemplate, _ = makeTestImage(noiseLevel=noiseLevel/4, noiseSeed=7, **kwargs) difference = science.clone() @@ -773,7 +773,7 @@ def test_detect_dipoles(self): # Avoid placing sources near the edge for this test, so that we can # easily check that the correct number of sources are detected. templateBorderSize = kernelSize//2 - dipoleFlag = "ip_diffim_DipoleFit_flag_classification" + dipoleFlag = "ip_diffim_DipoleFit_classification" kwargs = {"seed": staticSeed, "psfSize": 2.4, "fluxLevel": fluxLevel, "fluxRange": fluxRange, "nSrc": nSources, "templateBorderSize": templateBorderSize, "kernelSize": kernelSize, "xSize": xSize, "ySize": ySize} diff --git a/tests/test_dipoleFitter.py b/tests/test_dipoleFitter.py index cfcc5fed..5da747eb 100644 --- a/tests/test_dipoleFitter.py +++ b/tests/test_dipoleFitter.py @@ -176,7 +176,7 @@ def _checkTaskOutput(self, dipoleTestImage, sources, rtol=None): dipoleTestImage.yc[i] - offsets[i], rtol=rtol) # Note this is dependent on the noise (variance) being realistic in the image. # otherwise it throws off the chi2 estimate, which is used for classification: - self.assertTrue(result['ip_diffim_DipoleFit_flag_classification']) + self.assertTrue(result['ip_diffim_DipoleFit_classification']) # compare to the original ip_diffim_PsfDipoleFlux measurements result2 = r1.extract("ip_diffim_PsfDipoleFlux*")