Improve reflected background region finder #1616
Merged
Conversation
@registerrier - Thanks! One suggestion inline above. Another one would be to improve http://docs.gammapy.org/dev/background/reflected.html a little bit by using this option, and adding links in the text at the top of that page to Finally, it's hard to review this PR locally, because there's fails concerning |
gammapy/background/reflected.py
Outdated
@@ -190,6 +197,9 @@ def find_regions(self): | |||
curr_angle = curr_angle + self.angle_increment | |||
|
|||
log.debug('Found {} reflected regions'.format(len(reflected_regions))) | |||
if self.max_region_number is not None: |
cdeil
Aug 1, 2018
Member
Isn't it easier to move this check up into the while loop, and break
if the max is reached?
Should be one line less, and a bit faster, no?
Isn't it easier to move this check up into the while loop, and break
if the max is reached?
Should be one line less, and a bit faster, no?
9a56776
to
1a1530c
…ified check for max_region
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
this PR proposes a solution to issue #1449 by adding an optional parameter to take only the first
max_region_number
regions that come out of the algorithm.The PR also corrects a bug that could allow the user to create an infinite loop by passing an
increment_angle
equal to 0.