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-13886: Simplify Transform to contain a Mapping instead of a FrameSet #340
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handful of comments. You're good to merge once you've cleaned those up.
include/lsst/afw/geom/SkyWcs.h
Outdated
@@ -405,6 +408,7 @@ class SkyWcs final : public table::io::PersistableFacade<SkyWcs>, public table:: | |||
*/ | |||
std::shared_ptr<ast::FrameDict> _checkFrameDict(ast::FrameDict const &frameDict) const; | |||
|
|||
std::shared_ptr<const ast::FrameDict> _frameDict; | |||
std::shared_ptr<const TransformPoint2ToSpherePoint> _transform; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth having a comment here that explains the relationship between _frameDict
and _transform
.
include/lsst/afw/geom/Transform.h
Outdated
* @param[in] mapping ast::Mapping describing the desired transformation | ||
* @param[in] simplify Simplify the mapping? This combines component mappings | ||
* and removes redundant components where possible. | ||
* where it possible to do so without affecting accuracy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where it is possible...
include/lsst/afw/geom/Transform.h
Outdated
* redundant components where possible. However it | ||
* does not remove any frames. | ||
* @param[in] simplify Simplify the mapping? This combines component mappings | ||
* where it possible to do so without affecting accuracy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where it is possible...
And should it be indented to match the rest of the docstring block?
python/lsst/afw/geom/testUtils.py
Outdated
@@ -857,17 +858,10 @@ def checkTransformFromFrameSet(self, fromName, toName): | |||
|
|||
self.checkPersistence(transform) | |||
|
|||
frameSetCopy = transform.getFrameSet() | |||
transformCopy = TransformClass(frameSetCopy) | |||
mappingFromFrameSet = transform.getMapping() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this one called mappingFromFrameSet
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I'll fix it.
std::ostringstream os; | ||
os << "TransformBoundedField (containing " << _transform.getFrameSet()->getNFrame() << " frames)"; | ||
return os.str(); | ||
return "TransformBoundedField"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if there's a better way to get some amount more description in this returned string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not thought of one
inPointsRoundTrip = transform.applyInverse(outPoints) | ||
self.assertPairListsAlmostEqual(inPoints, inPointsRoundTrip) | ||
self.assertSpherePointListsAlmostEqual(wcs1.pixelToSky(inPoints), | ||
wcs2.pixelToSky(outPoints)) | ||
|
||
def testSameWcs(self): | ||
"""Confirm that pairing two identical Wcs gives an identity transform. | ||
""" | ||
for wcs in self.wcsList: | ||
transform = makeWcsPairTransform(wcs, wcs) | ||
# check that the transform has been simplified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still valid? It looks to me that all that's being tested is round-trippinmg, not simplification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I added such a test
instead of an ast::Mapping and an ast::FrameSet, as per RFC-469. Rename Transform.getFrameSet() to getMapping(). Add an internal ast::FrameDict to SkyWcs, since it was using Transform to store its FrameDict. There are no API changes to SkyWcs. Update and clarify documentation. Update other code and unit tests as needed.
preparatory to fixing a nested namespace definition
to fix a clang compiler warning (nested namespace definitions are a C++17 feature).
No description provided.