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

Add annulus region #128

Merged
merged 3 commits into from
May 10, 2017
Merged

Add annulus region #128

merged 3 commits into from
May 10, 2017

Conversation

joleroi
Copy link
Contributor

@joleroi joleroi commented May 9, 2017

This PR replaces #28

The annulus is now implemented as a compound region of two circles. There is not much functionality, since there is not much functionality in compound regions.

@joleroi joleroi self-assigned this May 9, 2017
@joleroi joleroi requested a review from keflavich May 9, 2017 09:10
@bsipocz
Copy link
Member

bsipocz commented May 9, 2017

The only fail is with numpy 1.7, that we have already dropped.

c1 = CirclePixelRegion(pixcoord, 2)
c2 = CirclePixelRegion(pixcoord, 4)

union = c1 | c2
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there anything we can assert here? isinstance(CompoundRegion), say?

The outer radius of the annulus
"""

def __init__(self, center, inner_radius, outer_radius, meta=None, visual=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

A ds9 annulus can have an arbitrary number of rings. I think an in/out annulus, as you've implemented, belongs here, but we also need something to handle the n-annuli case

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 don't really understand the use case for this, what does contains e.g. imply for 5 annuli. Couldn't we return a DS9 n-annulus as a list of n in/out annuli?

Copy link
Member

Choose a reason for hiding this comment

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

I think there's just some DS9 regions (like text or n-annulus) that are special and don't fit in with regions like circle and polygon that can be used for analysis.
Maybe we have to find a sane way to categorize / handle that?

It's true that contains doesn't make much sense for n-annulus. DS9 has special high-performance code to generate integer-labeled masks for regions in single pixel-pass in C (see e.g. https://github.com/ericmandel/regions) and e.g. the X-ray people use it to do radial profiles in the DS9 GUI.

IMO we shouldn't let DS9 influence the design of this regions package too much.
Not sure what this means concretely for this class and others.
Maybe you can discuss / figure it out in Leiden?

from ..shapes import CirclePixelRegion, CircleSkyRegion


class AnnulusPixelRegion(CompoundPixelRegion):
Copy link
Member

Choose a reason for hiding this comment

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

This should be called CircleAnnulusPixelRegion because an annulus can have any shape, e.g. we define elliptical and rectangular annulus apertures in photutils.


class AnnulusPixelRegion(CompoundPixelRegion):
"""
An annulus in pixel coordinates.
Copy link
Member

Choose a reason for hiding this comment

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

"An annulus" -> "A circular annulus"

return self.region2.bounding_box()


class AnnulusSkyRegion(CompoundSkyRegion):
Copy link
Member

Choose a reason for hiding this comment

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

CircleAnnulusSkyRegion


class AnnulusSkyRegion(CompoundSkyRegion):
"""
An annulus in sky coordinates.
Copy link
Member

Choose a reason for hiding this comment

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

"A circular annulus..."

@joleroi joleroi mentioned this pull request May 9, 2017
@joleroi
Copy link
Contributor Author

joleroi commented May 10, 2017

@larrybradley I adressed your comment, ok to merge?

@larrybradley
Copy link
Member

@joleroi Yes, thanks.

@joleroi joleroi merged commit 5223fad into astropy:master May 10, 2017
@joleroi joleroi deleted the annulus_compound branch May 10, 2017 14:18
@cdeil cdeil mentioned this pull request Jun 12, 2019
@cdeil cdeil modified the milestones: 0.2, 0.3 Jun 17, 2019
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.

None yet

5 participants