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

Review for DM-3400 (Eliminate circular aliases in slot centroid definition) #11

Merged
merged 1 commit into from Aug 6, 2015

Conversation

jdswinbank
Copy link
Contributor

No description provided.

sfm_config.plugins = ["base_CircularApertureFlux", "base_PsfFlux"]
sfm_config.slots.centroid = None
sfm_config.plugins = ["base_GaussianCentroid", "base_CircularApertureFlux", "base_PsfFlux"]
sfm_config.slots.centroid = "base_GaussianCentroid"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, this test is already defining and using a centroid slot. Isn't it simpler to just use that rather than also running the Gaussian centroid algorithm? I think something like this would work:

--- a/tests/measure.py
+++ b/tests/measure.py
@@ -347,8 +347,8 @@ class GaussianPsfTestCase(unittest.TestCase):
         schema.addField("centroid_flag", type='Flag')
         sfm_config = measBase.SingleFrameMeasurementConfig()
         sfm_config.doReplaceWithNoise = False
-        sfm_config.plugins = ["base_GaussianCentroid", "base_CircularApertureFlux", "base_PsfFlux"]
-        sfm_config.slots.centroid = "base_GaussianCentroid"
+        sfm_config.plugins = ["base_CircularApertureFlux", "base_PsfFlux"]
+        sfm_config.slots.centroid = "centroid"
         sfm_config.slots.shape = None
         sfm_config.slots.psfFlux = None
         sfm_config.slots.instFlux = None
@@ -359,7 +359,6 @@ class GaussianPsfTestCase(unittest.TestCase):
         sfm_config.plugins["base_CircularApertureFlux"].radii = [rad]
         task = measBase.SingleFrameMeasurementTask(schema, config=sfm_config)
         measCat = afwTable.SourceCatalog(schema)
-        measCat.defineCentroid("centroid")
         source = measCat.addNew()
         source.set("centroid_x", self.xc)
         source.set("centroid_y", self.yc)

Alternatively, just use the slot defined by the algorithm:

--- a/tests/measure.py
+++ b/tests/measure.py
@@ -342,9 +342,6 @@ class GaussianPsfTestCase(unittest.TestCase):
         rad = 10.0

         schema = afwTable.SourceTable.makeMinimalSchema()
-        schema.addField("centroid_x", type=float)
-        schema.addField("centroid_y", type=float)
-        schema.addField("centroid_flag", type='Flag')
         sfm_config = measBase.SingleFrameMeasurementConfig()
         sfm_config.doReplaceWithNoise = False
         sfm_config.plugins = ["base_GaussianCentroid", "base_CircularApertureFlux", "base_PsfFlux"]
@@ -359,10 +356,9 @@ class GaussianPsfTestCase(unittest.TestCase):
         sfm_config.plugins["base_CircularApertureFlux"].radii = [rad]
         task = measBase.SingleFrameMeasurementTask(schema, config=sfm_config)
         measCat = afwTable.SourceCatalog(schema)
-        measCat.defineCentroid("centroid")
         source = measCat.addNew()
-        source.set("centroid_x", self.xc)
-        source.set("centroid_y", self.yc)
+        source.set("base_GaussianCentroid_x", self.xc)
+        source.set("base_GaussianCentroid_y", self.yc)
         task.run(measCat, self.exp)
         for algName in ["base_CircularApertureFlux_10_0", "base_PsfFlux"]:
             flux = source.get(algName + "_flux")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't notice there already was a centroid. I'll go with your first suggestion.

@TallJimbo TallJimbo merged commit 4f29618 into master Aug 6, 2015
@ktlim ktlim deleted the tickets/DM-3400 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants