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

Implement TS map computation in Cython #252

Merged
merged 2 commits into from Apr 13, 2015

Conversation

Projects
None yet
3 participants
@adonath
Member

adonath commented Apr 6, 2015

This implements cash and model functions for TS computation in cython. Additionally it adresses a few minor issues (storing the sign of the TS values correctly, computing sqrt(TS)).

Also removes overlap.py.

Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
Show outdated Hide outdated gammapy/detect/_test_statistics.pyx Outdated
Show outdated Hide outdated gammapy/detect/_test_statistics.pyx Outdated
Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
Show outdated Hide outdated gammapy/scripts/ts_image.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Apr 6, 2015

Member

@adonath – Thanks!

I know you've done benchmarking on this and using Cython is warranted here?
Can you include whatever script or notebook you have in https://github.com/gammapy/gammapy-benchmarks (maybe in a new notebooks folder) and link to it from here?
Or maybe it's even possible to write an asv benchmark for this that would work before / after this change and would show a drop in execution time with this PR? That would be a nice graph to have for future discussions where to use Cython in Gammapy.

Member

cdeil commented Apr 6, 2015

@adonath – Thanks!

I know you've done benchmarking on this and using Cython is warranted here?
Can you include whatever script or notebook you have in https://github.com/gammapy/gammapy-benchmarks (maybe in a new notebooks folder) and link to it from here?
Or maybe it's even possible to write an asv benchmark for this that would work before / after this change and would show a drop in execution time with this PR? That would be a nice graph to have for future discussions where to use Cython in Gammapy.

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Apr 7, 2015

Member

FYI: I just now wrote up the Gammapy policy for C / Cython / Numba:
https://gammapy.readthedocs.org/en/latest/development/index.html#when-to-use-c-or-cython-or-numba-for-speed

@adonath – OK?

Member

cdeil commented Apr 7, 2015

FYI: I just now wrote up the Gammapy policy for C / Cython / Numba:
https://gammapy.readthedocs.org/en/latest/development/index.html#when-to-use-c-or-cython-or-numba-for-speed

@adonath – OK?

@cdeil cdeil changed the title from Added Cython cash and model function and minor fixes to Implement TS map computation in Cython Apr 8, 2015

@cdeil cdeil added the feature label Apr 8, 2015

@cdeil cdeil added this to the 0.2 milestone Apr 8, 2015

@adonath

This comment has been minimized.

Show comment
Hide comment
@adonath

adonath Apr 13, 2015

Member

Maybe it would make sense to define a naming convention for cython functions? E.g. they should be private i.e. start with _ and then end with _cython (That's what I adopted for the TS functions...)

Member

adonath commented Apr 13, 2015

Maybe it would make sense to define a naming convention for cython functions? E.g. they should be private i.e. start with _ and then end with _cython (That's what I adopted for the TS functions...)

Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Apr 13, 2015

Member

I think the example notebook doesn't work any more:
https://gist.github.com/cdeil/f5217525788215fd7824
Can you try and if needed adapt to these changes?

Member

cdeil commented Apr 13, 2015

I think the example notebook doesn't work any more:
https://gist.github.com/cdeil/f5217525788215fd7824
Can you try and if needed adapt to these changes?

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Apr 13, 2015

Member

Please also try out and update the example here:
https://gammapy.readthedocs.org/en/latest/detect/index.html#command-line-tool

$ gammapy-ts-image all.fits.gz --threshold 0 --scale 0
usage: gammapy-ts-image [-h] [--psf PSF] [--morphology MORPHOLOGY]
                        [--width WIDTH] [--scales SCALES [SCALES ...]]
                        [--downsample DOWNSAMPLE] [--residual] [--model MODEL]
                        [--threshold THRESHOLD] [--overwrite]
                        input_file output_file
gammapy-ts-image: error: the following arguments are required: output_file
Member

cdeil commented Apr 13, 2015

Please also try out and update the example here:
https://gammapy.readthedocs.org/en/latest/detect/index.html#command-line-tool

$ gammapy-ts-image all.fits.gz --threshold 0 --scale 0
usage: gammapy-ts-image [-h] [--psf PSF] [--morphology MORPHOLOGY]
                        [--width WIDTH] [--scales SCALES [SCALES ...]]
                        [--downsample DOWNSAMPLE] [--residual] [--model MODEL]
                        [--threshold THRESHOLD] [--overwrite]
                        input_file output_file
gammapy-ts-image: error: the following arguments are required: output_file

@cdeil cdeil referenced this pull request Apr 13, 2015

Closed

Further TS map improvements #223

6 of 10 tasks complete
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Apr 13, 2015

Member

@adonath Something unrelated I noticed while preparing the Gammapy 0.2 release.

This external link is broken:
http://home.strw.leidenuniv.nl/~oberg/Pulsars/Verbunt_Heise_NeutronStars.pdf
https://github.com/gammapy/gammapy/search?utf8=%E2%9C%93&q=verbunt

Could you please remove it or, if something equivalent exists, change the reference?

Member

cdeil commented Apr 13, 2015

@adonath Something unrelated I noticed while preparing the Gammapy 0.2 release.

This external link is broken:
http://home.strw.leidenuniv.nl/~oberg/Pulsars/Verbunt_Heise_NeutronStars.pdf
https://github.com/gammapy/gammapy/search?utf8=%E2%9C%93&q=verbunt

Could you please remove it or, if something equivalent exists, change the reference?

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Apr 13, 2015

Coverage Status

Coverage increased (+1.32%) to 46.65% when pulling 295b04c on adonath:ts_map_performance_improvement into d89ced4 on gammapy:master.

coveralls commented Apr 13, 2015

Coverage Status

Coverage increased (+1.32%) to 46.65% when pulling 295b04c on adonath:ts_map_performance_improvement into d89ced4 on gammapy:master.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Apr 13, 2015

Coverage Status

Coverage increased (+1.32%) to 46.65% when pulling c4f90fb on adonath:ts_map_performance_improvement into d89ced4 on gammapy:master.

coveralls commented Apr 13, 2015

Coverage Status

Coverage increased (+1.32%) to 46.65% when pulling c4f90fb on adonath:ts_map_performance_improvement into d89ced4 on gammapy:master.

cdeil added a commit that referenced this pull request Apr 13, 2015

@cdeil cdeil merged commit 4d063c0 into gammapy:master Apr 13, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Apr 13, 2015

Member

Thanks!

Member

cdeil commented Apr 13, 2015

Thanks!

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