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

Some improvements to BoundingBox #92

Merged
merged 5 commits into from
Dec 15, 2016
Merged

Some improvements to BoundingBox #92

merged 5 commits into from
Dec 15, 2016

Conversation

larrybradley
Copy link
Member

These are mostly API doc changes. I also added an example for as_patch().

Copy link
Member

@cdeil cdeil left a comment

Choose a reason for hiding this comment

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

Left one minor inline comment.

Otherwise looks good to me.

@astrofrog - Do you have time to review or should we just merge?

@@ -153,14 +164,31 @@ def extent(self):

def as_patch(self, **kwargs):
"""
Return a Matplotlib patch that represents the bounding box.
Return a `matplotlib.patches.Patch` that represents the bounding
box.
Copy link
Member

Choose a reason for hiding this comment

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

Link to the more explicit matplotlib.patches.Rectangle here instead of matplotlib.patches.Patch?
Put this info in a Returns section?

Copy link
Member Author

Choose a reason for hiding this comment

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

@cdeil Thanks! Yes and yes. Done.

@cdeil cdeil added this to the 0.2 milestone Dec 14, 2016
Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Just a small comment/question, otherwise looks good to me

>>> bbox.extent # matplotlib order: (x, y)
(0.5, 9.5, 1.5, 19.5)
>>> print(bbox.as_patch())
Rectangle(0.5,1.5;9x18)
"""

def __init__(self, ixmin, ixmax, iymin, iymax):
if ixmin > ixmax:
Copy link
Member

Choose a reason for hiding this comment

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

Should ixmin be strictly less than ixmax since the upper limit is exclusive? (that is, the smallest possible box is if ixmax == ixmin + 1.

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 think you are essentially asking if we should allow ixmin == ixmax. I left that possibility, but of course it is a BoundingBox of size 0 (along such axis). If we don't want that, then I need to change this line to if ixmin >= ixmax (and the corresponding test for y).

Copy link
Member

Choose a reason for hiding this comment

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

I don't see any pros / cons at the moment to allowing the size 0 case of ixmin == ixmax.
So I'm merging this now.

@astrofrog and all - feel free to make follow-up PRs proposing changes to this check any time.

@cdeil cdeil merged commit a80abf8 into astropy:master Dec 15, 2016
@cdeil
Copy link
Member

cdeil commented Dec 15, 2016

Thanks, @larrybradley !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants