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-13189: add FunctorKey for Boxes #306

Merged
merged 3 commits into from Jan 28, 2018
Merged

DM-13189: add FunctorKey for Boxes #306

merged 3 commits into from Jan 28, 2018

Conversation

TallJimbo
Copy link
Member

@TallJimbo TallJimbo commented Jan 9, 2018

This adds FunctorKeys for Box2I and Box2D, which should start us towards recording boxes in tables in a consistent way.

I've also updated three other classes in afw to use the new FunctorKey because they were already using the same convention and hence the change could be done in a backwards-compatible way. Two others (AmpInfoRecord and Chebyshev1Function2d) use a different convention and cannot be converted without changing APIs and/or persistence formats.

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 minor comments.

This did remind me that RFC-209 is still not implemented: I went looking for the text in the dev guide and had to resort to JIRA.

@@ -40,6 +40,11 @@ class PointKey(with_metaclass(TemplateMeta, object)):
PointKey.register((np.float64, 2), aggregates.Point2DKey)


# Because Boxes aren't templates themselves, we don't expose the fact that
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be in a docstring?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so; the potential confusion this comment is trying to avoid is from seeing a change in the pattern established in the rest of the file, and hence I don't think there's much to explain for someone who isn't reading the code.

/**
* A FunctorKey used to get or set a geom::Box2I or Box2D from a (min, max) pair of PointKeys.
*
* the Box2IKey and Box2DKey typedefs should be preferred to using the template name directly.
Copy link
Contributor

Choose a reason for hiding this comment

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

capitalize "The"

*
* @param[in,out] schema Schema to add fields to.
* @param[in] name Name prefix for all fields; suffixes above will be appended to this
* to form the full field names.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please give an example, e.g. "somename_min_x"

template <typename Box>
class BoxKey : public FunctorKey<Box> {
public:

Copy link
Contributor

Choose a reason for hiding this comment

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

Specify default/delete copy/move (RFC-209)?

@@ -112,6 +112,52 @@ def testPointKey(self):
self.doTestPointKey("D", lsst.afw.table.Point2DKey,
lsst.afw.geom.Point2D)

def doTestBoxKey(self, pointFieldType, functorKeyType, valueType):
Copy link
Contributor

Choose a reason for hiding this comment

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

Docstring, please, at least for the args.

minKey = pointFieldType(schema["a_min"])
maxKey = pointFieldType(schema["a_max"])
# we create two equivalent functor keys, using the two different
# constructors
Copy link
Contributor

Choose a reason for hiding this comment

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

don't have to do 80 chars, I don't think...

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, this is just what my editor does when I tell it to wrap (since it treats comments like docs, which do have to by 80 chars, I think). Anyhow, I agree it looks funny here; will fix.

@TallJimbo
Copy link
Member Author

Also, thanks for the reminder on RFC-209; I just had another reminder about that from another angle (DM-9932), and the implementation of the RFC is now in review.

@TallJimbo TallJimbo force-pushed the tickets/DM-13189 branch 2 times, most recently from 4d0cafd to 607a951 Compare January 28, 2018 16:38
@TallJimbo TallJimbo merged commit 2835ff5 into master Jan 28, 2018
@ktlim ktlim deleted the tickets/DM-13189 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