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

Fixed TS map boundary handling #332

Merged
merged 1 commit into from Aug 25, 2015

Conversation

Projects
None yet
2 participants
@adonath
Member

adonath commented Aug 19, 2015

This fixes the boundary behaviour of the TS map computation. I guess there's not much to review here. I will wait for the Travis-builds and then do the merge.

@cdeil cdeil added the bug label Aug 19, 2015

@cdeil cdeil added this to the 0.4 milestone Aug 19, 2015

Show outdated Hide outdated gammapy/scripts/ts_image.py Outdated
Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
# in some maps there are pixels, which have exposure, but zero
# background, which doesn't make sense and causes the TS computation
# to fail, this is a temporary fix
mask_ = np.logical_and(background == 0, exposure > 0)

This comment has been minimized.

@cdeil

cdeil Aug 19, 2015

Member

I think this is equivalent and a bit more readable?

bad_pixels = (background == 0) && (exposure > 0)
@cdeil

cdeil Aug 19, 2015

Member

I think this is equivalent and a bit more readable?

bad_pixels = (background == 0) && (exposure > 0)

This comment has been minimized.

@adonath

adonath Aug 20, 2015

Member

Does the && operator even exists in Python? I don't think so... I just checked and it throws a SyntaxError in Python 2.7. In principle one could use the bitwise & operator because both arrays are boolean, but I think it's better to have the explicit np.logical_and, which corresponds to the element-wise Python and.

@adonath

adonath Aug 20, 2015

Member

Does the && operator even exists in Python? I don't think so... I just checked and it throws a SyntaxError in Python 2.7. In principle one could use the bitwise & operator because both arrays are boolean, but I think it's better to have the explicit np.logical_and, which corresponds to the element-wise Python and.

This comment has been minimized.

@cdeil

cdeil Aug 20, 2015

Member

I meant & where I typed &&.
If you think np.logical_and is better than &, sure, OK.

@cdeil

cdeil Aug 20, 2015

Member

I meant & where I typed &&.
If you think np.logical_and is better than &, sure, OK.

Show outdated Hide outdated CHANGES.rst Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Aug 19, 2015

Member

I left a few minor comments inline. Travis-ci passed, so this is almost ready to go.

Member

cdeil commented Aug 19, 2015

I left a few minor comments inline. Travis-ci passed, so this is almost ready to go.

adonath added a commit that referenced this pull request Aug 25, 2015

@adonath adonath merged commit 6da03ed into gammapy:master Aug 25, 2015

1 check passed

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