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 adaptive ring background estimation #719

Merged
merged 5 commits into from Sep 23, 2016

Conversation

Projects
None yet
2 participants
@adonath
Member

adonath commented Sep 21, 2016

This PR adds a new AdaptiveRingBackgroundEstimator class, that implements the adaptive ring background method.

@adonath adonath added the feature label Sep 21, 2016

@adonath adonath added this to the 0.5 milestone Sep 21, 2016

@cdeil

I've left a bunch of inline comments.

Overall the code looks clean and nice, most comments are suggestions for consideration and it'd also be OK to leave as-is if you prefer.

I didn't review the core algorithm, it would be nice to have a few more asserts that show that the ring enlarges as it should by the algorithm definition (by looking at ring parameters and total pixels as well as pixels outside exclusion in the ring, for two positions (a. where the ring doesn't adapt, b. where it does adaptively enlarge).

Show outdated Hide outdated gammapy/background/ring.py
Show outdated Hide outdated gammapy/background/ring.py
Show outdated Hide outdated gammapy/background/ring.py
Show outdated Hide outdated gammapy/background/ring.py
Show outdated Hide outdated gammapy/background/ring.py
"""
p = self.parameters
scale = image.wcs_pixel_scale()[0]

This comment has been minimized.

@cdeil

cdeil Sep 21, 2016

Member

Maybe pass images to __init__?
Then the pix scale and number of kernels and their parameters would be known and could e.g. be printed in the class __str__.

Really objects like this Estimator are supposed to be instantiated, run and results read off.
Then if you need to run with different parameters or a new set of images, you just make a new one, no big deal.

@cdeil

cdeil Sep 21, 2016

Member

Maybe pass images to __init__?
Then the pix scale and number of kernels and their parameters would be known and could e.g. be printed in the class __str__.

Really objects like this Estimator are supposed to be instantiated, run and results read off.
Then if you need to run with different parameters or a new set of images, you just make a new one, no big deal.

kernels: list of `~astropy.convolution.Kernel`
List of convolution kernels.
parallel : bool
Whether to use multiprocessing.

This comment has been minimized.

@cdeil

cdeil Sep 21, 2016

Member

Add Returns and maybe mention the shape of data and return array?

Also, what about the name?
The main thing this does is to convolve, no? So add "convolve" in?

@cdeil

cdeil Sep 21, 2016

Member

Add Returns and maybe mention the shape of data and return array?

Also, what about the name?
The main thing this does is to convolve, no? So add "convolve" in?

Show outdated Hide outdated gammapy/background/tests/test_ring.py
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Sep 22, 2016

Member

@adonath - I merged #721 just now. Looks like it didn't conflict with your ring PR branch here.

Member

cdeil commented Sep 22, 2016

@adonath - I merged #721 just now. Looks like it didn't conflict with your ring PR branch here.

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Sep 22, 2016

Member

@adonath - Can you please remove or check off the open task list at the top and remove WIP from the title?

Did you want to show adaptive_ring_bkg.png in the docs?
You're copying it over in docs/conf.py, but then you're not showing it.

Member

cdeil commented Sep 22, 2016

@adonath - Can you please remove or check off the open task list at the top and remove WIP from the title?

Did you want to show adaptive_ring_bkg.png in the docs?
You're copying it over in docs/conf.py, but then you're not showing it.

@cdeil cdeil changed the title from WIP: Implement adaptive ring background method to Add adaptive ring background estimation Sep 23, 2016

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Sep 23, 2016

Member

This PR is related to a fail I see in #705 : https://travis-ci.org/gammapy/gammapy/jobs/161942204#L2046

I'm merging this now and will continue a bit with this now.

Member

cdeil commented Sep 23, 2016

This PR is related to a fail I see in #705 : https://travis-ci.org/gammapy/gammapy/jobs/161942204#L2046

I'm merging this now and will continue a bit with this now.

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Sep 23, 2016

Member

@adonath - Thanks!

Member

cdeil commented Sep 23, 2016

@adonath - Thanks!

@cdeil cdeil merged commit 86ea359 into gammapy:master Sep 23, 2016

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment