Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-47060: Rename dipole classification "flags” and add attempted dipole classification #359

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading