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 mean PSF computation #549

Merged
merged 28 commits into from Jun 13, 2016

Conversation

Projects
None yet
2 participants
@JouvinLea
Contributor

JouvinLea commented Jun 4, 2016

I implemented this in gammapy one month ago but I wanted to test it on some picture before to present my idea!!This is computation of the mean of the psf for a set of runs in order to be able to do some morphology fit!
I think there is a lot to change to make it easier to use it but we will discuss this next week.

See you on Monday,
Lea

@cdeil cdeil added the feature label Jun 6, 2016

@cdeil cdeil added this to the 0.5 milestone Jun 6, 2016

@cdeil cdeil self-assigned this Jun 6, 2016

@cdeil cdeil modified the milestones: PyGamma1, 0.5 Jun 6, 2016

@JouvinLea

This comment has been minimized.

Show comment
Hide comment
@JouvinLea

JouvinLea Jun 7, 2016

Contributor

@cdeil
I changed a little the computation of the mean psf I think this is a lot more nicer now and it uses the EnergyDependantTablePSF and PSFTable!
See you tomorow

Contributor

JouvinLea commented Jun 7, 2016

@cdeil
I changed a little the computation of the mean psf I think this is a lot more nicer now and it uses the EnergyDependantTablePSF and PSFTable!
See you tomorow

Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated

@cdeil cdeil changed the title from Image pipe meanpsf to Add mean PSF computation Jun 8, 2016

Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated
Show outdated Hide outdated examples/test_curve.py Outdated
Show outdated Hide outdated gammapy/data/data_store.py Outdated
Show outdated Hide outdated gammapy/data/data_store.py Outdated
Show outdated Hide outdated gammapy/data/data_store.py Outdated
Show outdated Hide outdated gammapy/data/data_store.py Outdated
Show outdated Hide outdated gammapy/data/data_store.py Outdated
Show outdated Hide outdated gammapy/data/tests/test_observation.py Outdated
Show outdated Hide outdated gammapy/data/data_store.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jun 9, 2016

Member

This is the test I would have written:

First test:

psf_mean = ObservationList.make_psf(two runs)
psf1 = Observation.make_psf(run number 1)
psf2 = Observation.make_psf(run number 2)
# Assert value at some offset / energy and some containment radius
# Should all be similar
Member

cdeil commented Jun 9, 2016

This is the test I would have written:

First test:

psf_mean = ObservationList.make_psf(two runs)
psf1 = Observation.make_psf(run number 1)
psf2 = Observation.make_psf(run number 2)
# Assert value at some offset / energy and some containment radius
# Should all be similar
Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated
Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated

@cdeil cdeil modified the milestones: PyGamma1, 0.5 Jun 11, 2016

Lea Jouvin
Lea Jouvin
@JouvinLea

This comment has been minimized.

Show comment
Hide comment
@JouvinLea

JouvinLea Jun 12, 2016

Contributor

@cdeil
The passed Travis, so can we merge?
Cheers Lea

Contributor

JouvinLea commented Jun 12, 2016

@cdeil
The passed Travis, so can we merge?
Cheers Lea

Lea Jouvin
Show outdated Hide outdated gammapy/data/data_store.py Outdated
Show outdated Hide outdated gammapy/data/data_store.py Outdated
Show outdated Hide outdated gammapy/data/data_store.py Outdated
Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated
Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jun 13, 2016

Member

@JouvinLea - Thanks for the update. Tests now passed on travis-ci. I've left some more inline comments.

My main suggestion here would be to add one more test that call the make_psf for a single observation, to make sure that the handling of user-supplied energy and offset as well as the default values work (it's not clear to me from reading the code that this is the case).
I.e. ideally compute the psf 4 times with:

  • energy=None, theta=None
  • energy=something, theta=None
  • energy=None, theta=something
  • energy=something, theta=something
    and assert on the shape and one pixel value of the returned psf data members (i.e. the energy, theta, psf_value and exposure there).

This is a good example how you can parametrize a test, so that you don't have to write a lot of boilerplate code:

@pytest.mark.parametrize("pars,results",[

@JouvinLea - If you don't want to add this, let me know, I can also do it.

Member

cdeil commented Jun 13, 2016

@JouvinLea - Thanks for the update. Tests now passed on travis-ci. I've left some more inline comments.

My main suggestion here would be to add one more test that call the make_psf for a single observation, to make sure that the handling of user-supplied energy and offset as well as the default values work (it's not clear to me from reading the code that this is the case).
I.e. ideally compute the psf 4 times with:

  • energy=None, theta=None
  • energy=something, theta=None
  • energy=None, theta=something
  • energy=something, theta=something
    and assert on the shape and one pixel value of the returned psf data members (i.e. the energy, theta, psf_value and exposure there).

This is a good example how you can parametrize a test, so that you don't have to write a lot of boilerplate code:

@pytest.mark.parametrize("pars,results",[

@JouvinLea - If you don't want to add this, let me know, I can also do it.

Lea Jouvin added some commits Jun 13, 2016

Lea Jouvin
Lea Jouvin
Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated
Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated
Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated
Lea Jouvin
Show outdated Hide outdated gammapy/data/tests/test_data_store.py Outdated
Lea Jouvin
Show outdated Hide outdated gammapy/scripts/image_pipe.py Outdated
Lea Jouvin
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jun 13, 2016

Member

Test fails on travis-ci are unrelated.

This looks good to me ... merging this now.

Thanks!

Member

cdeil commented Jun 13, 2016

Test fails on travis-ci are unrelated.

This looks good to me ... merging this now.

Thanks!

@cdeil cdeil merged commit 3df2a01 into gammapy:master Jun 13, 2016

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jun 13, 2016

Member

I've added a changelog entry and done some minor code cleanup in 88d01dd .

One thing I changed was to rename "source_position" to "position" ... sometimes one wants to compute the PSF for any kind of position, there doesn't have to be a source present, and just "position" is shorter.

Member

cdeil commented Jun 13, 2016

I've added a changelog entry and done some minor code cleanup in 88d01dd .

One thing I changed was to rename "source_position" to "position" ... sometimes one wants to compute the PSF for any kind of position, there doesn't have to be a source present, and just "position" is shorter.

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