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-32285: Fix yy <-> xy bug in SdssShape uncertainties #199

Merged
merged 3 commits into from Oct 21, 2021

Conversation

arunkannawadi
Copy link
Member

Due to a convention mismatch, the _yyErr and _xyErr components are interchanged for base_SdssShape plugin. This PR fixes this bug and adds a MonteCarlo unit test that would have caught it in the first place.

@arunkannawadi
Copy link
Member Author

The convention adopted in calc_fisher function, specifically this line suggests that index 2 refers to yy and not xy. The MonteCarlo test would fail for the specified tolerance levels if the bugfix comment is dropped.

Copy link
Contributor

@jmeyers314 jmeyers314 left a comment

Choose a reason for hiding this comment

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

Looks good. Just a few minor nits to pick.

// convention in afw::geom::ellipses is to order moments (xx, yy, xy),
// but the older algorithmic code uses (xx, xy, yy) - the order of
// indices here is not a bug.
// convention is to order moments (xx, yy, xy)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good, but can you smash the first two commits so there isn't a commit with the code change but not the doc change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point

@@ -129,6 +139,47 @@ def testMeasureBadPsf(self):
self._checkShape(result, record)
self.assertTrue(result.getFlag(lsst.meas.base.SdssShapeAlgorithm.PSF_SHAPE_BAD.number))

def testMonteCarlo(self):
"""Test an ideal simulation, with no noise.
Copy link
Contributor

Choose a reason for hiding this comment

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

"with no noise" doesn't seem right. Maybe "with known noise" or "with controlled noise"?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was just copy-pasted from other MonteCarlo tests. But you're right that this is not accurate and will change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed it to "with deterministic noise"


Demonstrate that:

- We get exactly the right answer, and
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd omit "exactly"

for suffix in ["xx", "yy", "xy"]:
shapeMean = np.mean(catalog["base_SdssShape_"+suffix])
shapeErrMean = np.nanmean(catalog["base_SdssShape_"+suffix+"Err"])
shapeStandardDeviation = 0.5*(np.nanpercentile(catalog["base_SdssShape_"+suffix], 84)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe call this shapeInterval68? I think it's only equivalent to the standard deviation for a Gaussian distribution.

@arunkannawadi arunkannawadi merged commit 4fd6b65 into master Oct 21, 2021
@arunkannawadi arunkannawadi deleted the tickets/DM-32285 branch October 21, 2021 03:17
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