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-13886: Simplify Transform to contain a Mapping instead of a FrameSet #340

Merged
merged 3 commits into from Apr 3, 2018

Conversation

r-owen
Copy link
Contributor

@r-owen r-owen commented Apr 3, 2018

No description provided.

Copy link
Contributor

@parejkoj parejkoj left a 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.

@@ -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;
Copy link
Contributor

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.

* @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.
Copy link
Contributor

Choose a reason for hiding this comment

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

where it is possible...

* 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.
Copy link
Contributor

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?

@@ -857,17 +858,10 @@ def checkTransformFromFrameSet(self, fromName, toName):

self.checkPersistence(transform)

frameSetCopy = transform.getFrameSet()
transformCopy = TransformClass(frameSetCopy)
mappingFromFrameSet = transform.getMapping()
Copy link
Contributor

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?

Copy link
Contributor Author

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";
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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).
@r-owen r-owen merged commit 3391cb6 into master Apr 3, 2018
@ktlim ktlim deleted the tickets/DM-13886 branch August 25, 2018 06:44
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