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 HAWC 2HWC catalog #1108

Merged
merged 4 commits into from Aug 31, 2017

Conversation

Projects
None yet
2 participants
@pdeiml
Contributor

pdeiml commented Aug 24, 2017

I was geared to the existing files for e.g. gamma cat, fermi and hess.
But some things where not clear to me how to transform them to hwc2, e.g. the description of the catalog. There, I added some TODOs.
@cdeil Please have a look at them and tell me what to do at these points. (We can do it via Skype if you want)


EDIT by @cdeil - this is a PR implementing #887

@cdeil cdeil self-requested a review Aug 24, 2017

@cdeil cdeil self-assigned this Aug 24, 2017

@cdeil cdeil added the feature label Aug 24, 2017

@cdeil cdeil added this to the 0.7 milestone Aug 24, 2017

@cdeil

@pdeiml - This is on a good way, welcome to Gammapy and thanks for the contribution!

I left a bunch of inline comments. Please address them and add the spectral and morphology model properties and test for those, and more questions if you have them, then ping me for a second review.

Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/tests/test_hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/tests/test_hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/tests/test_hawc.py Outdated
@pdeiml

This comment has been minimized.

Show comment
Hide comment
@pdeiml

pdeiml Aug 25, 2017

Contributor

There are still some TODOs that you missed.

test_hawc.py: Line 9
hawc.py: Line 50, Line 98 (ok, related to your comment above) and especially line 121 which is the description which is shown by executing 'source_catalogs.info()'

Contributor

pdeiml commented Aug 25, 2017

There are still some TODOs that you missed.

test_hawc.py: Line 9
hawc.py: Line 50, Line 98 (ok, related to your comment above) and especially line 121 which is the description which is shown by executing 'source_catalogs.info()'

Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
@pdeiml

This comment has been minimized.

Show comment
Hide comment
@pdeiml

pdeiml Aug 25, 2017

Contributor

I have no TODOs left, hence - if your agree with descrition etc. - this PR is

RTM

Contributor

pdeiml commented Aug 25, 2017

I have no TODOs left, hence - if your agree with descrition etc. - this PR is

RTM

@cdeil

cdeil approved these changes Aug 25, 2017

@cdeil

The code that's there now looks good.

@pdeiml - A major point of having these classes in Gammapy at all is that they translate the source parameter infos to Gammapy source models. Do you have time to add this via a spectral_model and morphology_model property and corresponding tests (again following other catalogs as example)? (If no, then I would just add it by adding a commit to your PR in the coming days)

Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
@pdeiml

This comment has been minimized.

Show comment
Hide comment
@pdeiml

pdeiml Aug 25, 2017

Contributor

I can add a spectral_model function. That is not difficult.
But how should I handle the fact that there may be two models?
Should I write two spectral_model method which return the first and the second model seperately?
Or one method which returns both spectra as e.g. a list of SpectralModels?

What should be written in the morphology method?
We have only the position as information but nothing further, haven't we?

Contributor

pdeiml commented Aug 25, 2017

I can add a spectral_model function. That is not difficult.
But how should I handle the fact that there may be two models?
Should I write two spectral_model method which return the first and the second model seperately?
Or one method which returns both spectra as e.g. a list of SpectralModels?

What should be written in the morphology method?
We have only the position as information but nothing further, haven't we?

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Aug 25, 2017

Member

For the spectra, I see a few options how to expose it, and don't have a preference on API yet (but might later after using it for a while), choose the one you prefer.

Either a function with a parameter to select, or two separate properties. I guess returnning a length 1 or 2 list with 1 or 2 spectral models is also fine.
It might also be useful to add a bool property has_two_spec (or int n_spec or whatever you like), no?


I thought they measured source extensions. But looking at the paper I see that they didn't really. So forget about the morphology model, the info doesn't exist.

Member

cdeil commented Aug 25, 2017

For the spectra, I see a few options how to expose it, and don't have a preference on API yet (but might later after using it for a while), choose the one you prefer.

Either a function with a parameter to select, or two separate properties. I guess returnning a length 1 or 2 list with 1 or 2 spectral models is also fine.
It might also be useful to add a bool property has_two_spec (or int n_spec or whatever you like), no?


I thought they measured source extensions. But looking at the paper I see that they didn't really. So forget about the morphology model, the info doesn't exist.

Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/tests/test_hawc.py Outdated
@cdeil

See inline comments.

Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/tests/test_hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated

@cdeil cdeil referenced this pull request Aug 25, 2017

Closed

Add 2HWC HAWC source catalog #887

Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
Show outdated Hide outdated gammapy/catalog/hawc.py Outdated
@pdeiml

This comment has been minimized.

Show comment
Hide comment
@pdeiml

pdeiml Aug 25, 2017

Contributor

Should be fine now. By the way: The tests are working without errors.

Contributor

pdeiml commented Aug 25, 2017

Should be fine now. By the way: The tests are working without errors.

@pdeiml

This comment has been minimized.

Show comment
Hide comment
@pdeiml

pdeiml Aug 28, 2017

Contributor

Running pep8 on hawc.py still returns:

gammapy/catalog/hawc.py:78:13: E128 continuation line under-indented for visual indent
gammapy/catalog/hawc.py:87:17: E128 continuation line under-indented for visual indent

which is because of the line break in these two lines.
Is it ok like it is? Avoiding the two errors would lead to a indent of the newline which is very long.

Contributor

pdeiml commented Aug 28, 2017

Running pep8 on hawc.py still returns:

gammapy/catalog/hawc.py:78:13: E128 continuation line under-indented for visual indent
gammapy/catalog/hawc.py:87:17: E128 continuation line under-indented for visual indent

which is because of the line break in these two lines.
Is it ok like it is? Avoiding the two errors would lead to a indent of the newline which is very long.

@pdeiml

This comment has been minimized.

Show comment
Hide comment
@pdeiml

pdeiml Aug 29, 2017

Contributor

@cdeil Please review

Contributor

pdeiml commented Aug 29, 2017

@cdeil Please review

@pdeiml

This comment has been minimized.

Show comment
Hide comment
@pdeiml

pdeiml Aug 30, 2017

Contributor

@cdeil Please review and tell me what the problem of travis CI is. It tells me that SourceCatalogObject2HWC has no getitem? But I don't know why this is needed and all other test_*.py scripts are written analogeously to test_hawc.py.
Thanks.

Contributor

pdeiml commented Aug 30, 2017

@cdeil Please review and tell me what the problem of travis CI is. It tells me that SourceCatalogObject2HWC has no getitem? But I don't know why this is needed and all other test_*.py scripts are written analogeously to test_hawc.py.
Thanks.

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Aug 30, 2017

Member

@pdeiml - I did some changes in 2ea3dc3 and pushed the commit to this PR.

I still want to improve the spectral parameter printout to avoid the code duplication and improve the tests, but I have to go now. Will finish this and merge tomorrow.

Member

cdeil commented Aug 30, 2017

@pdeiml - I did some changes in 2ea3dc3 and pushed the commit to this PR.

I still want to improve the spectral parameter printout to avoid the code duplication and improve the tests, but I have to go now. Will finish this and merge tomorrow.

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Aug 31, 2017

Member

Some more fixes and improvements in 99161ff . Merging now.

@pdeiml - Thank you for making your first contribution to Gammapy; it's a very nice addition!

Member

cdeil commented Aug 31, 2017

Some more fixes and improvements in 99161ff . Merging now.

@pdeiml - Thank you for making your first contribution to Gammapy; it's a very nice addition!

@cdeil cdeil merged commit 52e46a4 into gammapy:master Aug 31, 2017

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@cdeil cdeil changed the title from Add HAWC 2FHL catalog to Add HAWC 2HWC catalog Aug 31, 2017

@pdeiml pdeiml deleted the pdeiml:add_hawc_2fhl_catalog branch Aug 31, 2017

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Aug 31, 2017

Member

Docs for this are now online: http://docs.gammapy.org/en/latest/api/gammapy.catalog.SourceCatalog2HWC.html

@pdeiml - I've added you to the Gammapy contributor list: 34f2e93 (will appear in the docs after the next docs build)

Member

cdeil commented Aug 31, 2017

Docs for this are now online: http://docs.gammapy.org/en/latest/api/gammapy.catalog.SourceCatalog2HWC.html

@pdeiml - I've added you to the Gammapy contributor list: 34f2e93 (will appear in the docs after the next docs build)

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