From 1c7a7f60f85ede639d79bc8d14ae661e4baaeb6c Mon Sep 17 00:00:00 2001 From: Ian Sullivan Date: Fri, 6 Dec 2024 13:17:19 -0800 Subject: [PATCH] =?UTF-8?q?Revert=20"Rename=20dipole=20classification=20"f?= =?UTF-8?q?lags=E2=80=9D=20and=20add=20attempted=20dipole=20classification?= =?UTF-8?q?=20to=20APDB"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3af77a3252e7600649c081fba370d1809b517e4c. --- 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 804f8274..57e5e7f6 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_classification"]] + dipoleSources = selectSources[selectSources["ip_diffim_DipoleFit_flag_classification"]] dipoleDensity = len(dipoleSources)/area if dipoleSources: diff --git a/python/lsst/ip/diffim/dipoleFitTask.py b/python/lsst/ip/diffim/dipoleFitTask.py index 666ae062..fad38d33 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, "classification"), type="Flag", + schema.join(name, "flag", "classification"), type="Flag", doc="Flag indicating diaSource is classified as a dipole") self.classificationAttemptedFlagKey = schema.addField( - schema.join(name, "classificationAttempted"), type="Flag", + schema.join(name, "flag", "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 474318eb..173897df 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_classification" + dipoleFlag = "ip_diffim_DipoleFit_flag_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_classification" + dipoleFlag = "ip_diffim_DipoleFit_flag_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_classification" + dipoleFlag = "ip_diffim_DipoleFit_flag_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 5da747eb..cfcc5fed 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_classification']) + self.assertTrue(result['ip_diffim_DipoleFit_flag_classification']) # compare to the original ip_diffim_PsfDipoleFlux measurements result2 = r1.extract("ip_diffim_PsfDipoleFlux*")