Skip to content

Commit

Permalink
Rename dipole classification "flag" and add attempted dipole classifi…
Browse files Browse the repository at this point in the history
…cation
  • Loading branch information
abudlong committed Jan 8, 2025
1 parent b092a60 commit 645a14d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion python/lsst/ip/diffim/computeSpatiallySampledMetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/ip/diffim/dipoleFitTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_detectAndMeasure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dipoleFitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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*")
Expand Down

0 comments on commit 645a14d

Please sign in to comment.