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-5922: Rework camera geometry to use the replacement for XYTransform #87

Merged
merged 8 commits into from Sep 2, 2017

Conversation

r-owen
Copy link
Contributor

@r-owen r-owen commented Aug 11, 2017

Update the HSC distortion model to use an astshim PolyMap
Change PUPIL to FIELD_ANGLE
Use lsst.afw.geom.transformRegistry instead of xyTransformRegistry
Update the UPS table to include numpy and astshim

@r-owen r-owen force-pushed the tickets/DM-5922 branch 7 times, most recently from 3332a6d to 87928cb Compare August 18, 2017 18:52
Copy link
Contributor

@PaulPrice PaulPrice left a comment

Choose a reason for hiding this comment

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

Some small comments, but in general this is great, thanks!

from lsst.pex.config import Config, Field, ListField
from lsst.obs.subaru import HscDistortion, DistortionPolynomial
__all__ = ["xyTransformRegistry"]
__all__ = ["transformRegistry"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we export something that we've imported? That seems dangerous.

@@ -131,9 +136,11 @@ class HscDistortionConfig(Config):
1.98549941035e-37,
-8.74305862185e-38,
])
skyToCcdOrder = Field(dtype=int, doc="Polynomial order for conversion from sky to CCD (x and y identical)",
skyToCcdOrder = Field(dtype=int,
doc="(ignored) Polynomial order for conversion from field angle to focal plane",
Copy link
Contributor

Choose a reason for hiding this comment

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

If these are ignored, can we just remove them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. As long as you don't mind. In the long run I'd much rather have usable coefficients instead of using an iterative inverse, but that's out of scope for this ticket.


Paramaters
----------
order: int
Copy link
Contributor

Choose a reason for hiding this comment

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

`int`

----------
order: int
Polynomial order
xCoeffs, yCoeffs: list of float
Copy link
Contributor

Choose a reason for hiding this comment

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

`list` of `float`


Returns
-------
Forward or inverse coefficients for astshim.PolyMap
Copy link
Contributor

Choose a reason for hiding this comment

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

coeffs : `numpy.ndarray`
    Coefficients for `astshim.PolyMap`.

@@ -61,8 +65,12 @@ def testDistortion(self):
self.fail("Cannot find saved data %r; set SAVE_DATA = True and run again to save new data" %
dataPath)

fieldAngleToFocalPlaneTolerance = transformRegistry["hsc"].ConfigClass().tolerance
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to put a hard number here rather than using a Config value which could change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The value I'm testing against is the value used to determine the quantity being tested -- the default value of tolerance in the config. Yes if somebody changes that default then the unit test might fail, but that change would have to be done in this package, so the person who changed the default will see the problem right away and be able to deal with it.

@@ -1,9 +1,12 @@
from __future__ import absolute_import, division, print_function

__all__ = ["transformRegistry"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Squash this part with the previous commit. (But I don't think we should be exporting transformRegistry.)

@@ -1,91 +0,0 @@
// -*- lsst-c++ -*-
Copy link
Contributor

Choose a reason for hiding this comment

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

Explain in the commit message why it's being removed.

@@ -1,3 +1,4 @@
from __future__ import absolute_import, division, print_function
Copy link
Contributor

Choose a reason for hiding this comment

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

Squash with previous commit that had the same goal.

####bkgd = afwMath.makeStatistics(mi, afwMath.MEDIAN, sctrl).getValue()
# ###sctrl = afwMath.StatisticsControl()
# ###sctrl.setAndMask(mi.getMask().getPlaneBitMask("DETECTED"))
# ###bkgd = afwMath.makeStatistics(mi, afwMath.MEDIAN, sctrl).getValue()
Copy link
Contributor

Choose a reason for hiding this comment

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

Just delete these lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great! Thank you for permission.

@r-owen r-owen force-pushed the tickets/DM-5922 branch 6 times, most recently from d23497f to 268a587 Compare September 1, 2017 15:45
Update the HSC distortion model to use an astshim PolyMap
Change PUPIL to FIELD_ANGLE
Use lsst.afw.geom.transformRegistry instead of xyTransformRegistry
Tighten inverse tolerance in test_distortion because the new code
does better than the old
Update the UPS table to include numpy and astshim
Fix pep8 issues
Remove initial #!/...
The old C++ HscDistortion model is no longer usable for camera
geometry (since it is an XYTransform) and has been superseded.
@r-owen r-owen merged commit ef4c45f into master Sep 2, 2017
@ktlim ktlim deleted the tickets/DM-5922 branch August 25, 2018 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants