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 multi-scale TS image computation #234

Merged
merged 3 commits into from Feb 5, 2015

Conversation

Projects
None yet
3 participants
@adonath
Member

adonath commented Jan 24, 2015

I now there is still a bit of work to be done here (put the script in a main function etc., change to back astropy.nddata.utils.extract_array, docs missing...), however I think its ready for a first review.

Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
if scale > 0:
from astropy.convolution import convolve
sigma = scale / (BINSZ * factor)
if morphology == 'Gaussian2D':

This comment has been minimized.

@cdeil

cdeil Jan 24, 2015

Member

Always end such if -elif ... with an else and throw a ValueError.
If you don't the user will mistype the string and then your function will fail in weird hard-to-understand ways later.

@cdeil

cdeil Jan 24, 2015

Member

Always end such if -elif ... with an else and throw a ValueError.
If you don't the user will mistype the string and then your function will fail in weird hard-to-understand ways later.

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 dev/ts_image.py Outdated
Show outdated Hide outdated dev/ts_image.py Outdated
Show outdated Hide outdated dev/ts_image.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jan 24, 2015

Member

I've left some stylistic comments inline.

You need to fix the tests:
https://travis-ci.org/gammapy/gammapy/jobs/48174547#L2459

Once that passes and these little things are fixed it's up to you when you want to merge.
I'm working on spectra and gammapy.data classes, so no rush from my side.

It would be nice if you moved the script to gammapy/scripts and put it in functions so that it's re-usable and shows up in the docs ....

Member

cdeil commented Jan 24, 2015

I've left some stylistic comments inline.

You need to fix the tests:
https://travis-ci.org/gammapy/gammapy/jobs/48174547#L2459

Once that passes and these little things are fixed it's up to you when you want to merge.
I'm working on spectra and gammapy.data classes, so no rush from my side.

It would be nice if you moved the script to gammapy/scripts and put it in functions so that it's re-usable and shows up in the docs ....

Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
Show outdated Hide outdated dev/ts_image.py Outdated
Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
index = np.where(ts[:, :, i] == ts_max)
scale_max[index] = scale
niter_max[index] = niter[:, :, i][index]
amplitude_max[index] = amplitude[:, :, i][index]

This comment has been minimized.

@cdeil

cdeil Jan 30, 2015

Member

Add empty line.

@cdeil

cdeil Jan 30, 2015

Member

Add empty line.

for name, order in zip(['ts', 'amplitude', 'niter'], [1, 1, 0]):
ts_results[name] = upsample_2N(ts_results[name], factor,
order=order, shape=shape)
multiscale_result.append(ts_results)

This comment has been minimized.

@cdeil

cdeil Jan 30, 2015

Member

Add empty line.

@cdeil

cdeil Jan 30, 2015

Member

Add empty line.

if niter > MAX_NITER:
logging.warning('Exceeded maximum number of function evaluations!')
return np.nan, amplitude, niter
raise ValueError('Invalid fitting method.')

This comment has been minimized.

@cdeil

cdeil Jan 30, 2015

Member

Add empty line.

@cdeil

cdeil Jan 30, 2015

Member

Add empty line.

Show outdated Hide outdated gammapy/detect/test_statistics.py Outdated
Show outdated Hide outdated gammapy/image/utils.py Outdated
Show outdated Hide outdated gammapy/scripts/ts_image.py Outdated
Show outdated Hide outdated gammapy/scripts/ts_image.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jan 30, 2015

Member

I've left some cosmetic inline comments ... this looks good to me know, but tests should be added and if possible the peak finder from photutils should be used.

Feel free to merge this yourself next week!

Member

cdeil commented Jan 30, 2015

I've left some cosmetic inline comments ... this looks good to me know, but tests should be added and if possible the peak finder from photutils should be used.

Feel free to merge this yourself next week!

adonath added a commit that referenced this pull request Feb 5, 2015

@adonath adonath merged commit 67c0bad into gammapy:master Feb 5, 2015

1 check passed

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

@cdeil cdeil referenced this pull request Feb 5, 2015

Closed

Further TS map improvements #223

6 of 10 tasks complete

@cdeil cdeil changed the title from Multiscale ts image computation to Add multi-scale TS image computation Apr 8, 2015

@cdeil cdeil added the feature label Apr 8, 2015

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

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