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 EffectiveAreaTable exporter to EffectiveAreaTable2D #276

Merged
merged 4 commits into from Jul 15, 2015

Conversation

Projects
None yet
3 participants
@joleroi
Contributor

joleroi commented Jun 2, 2015

TODO:

  • add test
  • add example

I dont know why the entire EffArea2D class seems to be "new" probably I messed something up with git

@joleroi joleroi changed the title from Pha export to PHA export Jun 2, 2015

@joleroi joleroi changed the title from PHA export to WIP: PHA export Jun 2, 2015

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jun 2, 2015

Coverage Status

Coverage remained the same at 43.12% when pulling bda2c1e on kingj90:pha_export into 0883871 on gammapy:master.

coveralls commented Jun 2, 2015

Coverage Status

Coverage remained the same at 43.12% when pulling bda2c1e on kingj90:pha_export into 0883871 on gammapy:master.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jun 2, 2015

Coverage Status

Coverage decreased (-0.06%) to 43.06% when pulling 5345cd2 on kingj90:pha_export into 0883871 on gammapy:master.

coveralls commented Jun 2, 2015

Coverage Status

Coverage decreased (-0.06%) to 43.06% when pulling 5345cd2 on kingj90:pha_export into 0883871 on gammapy:master.

@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi

joleroi Jun 2, 2015

Contributor

the test doesn't really test much, just writes to disk. Don't know what to test in order to verify that everything is ok

Contributor

joleroi commented Jun 2, 2015

the test doesn't really test much, just writes to disk. Don't know what to test in order to verify that everything is ok

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jun 2, 2015

Coverage Status

Coverage increased (+0.04%) to 43.17% when pulling 51b29cb on kingj90:pha_export into 0883871 on gammapy:master.

coveralls commented Jun 2, 2015

Coverage Status

Coverage increased (+0.04%) to 43.17% when pulling 51b29cb on kingj90:pha_export into 0883871 on gammapy:master.

Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jun 10, 2015

Member

Thanks for finishing this up. I've left some more inline comments. 😄

When you addressed those, please change the issue title to something like "Implement EffectiveAreaTable2D.to_effective_area_table" and add an entry to the changelog

Then this is ready to be merged.

Member

cdeil commented Jun 10, 2015

Thanks for finishing this up. I've left some more inline comments. 😄

When you addressed those, please change the issue title to something like "Implement EffectiveAreaTable2D.to_effective_area_table" and add an entry to the changelog

Then this is ready to be merged.

@cdeil cdeil added the feature label Jun 10, 2015

@cdeil cdeil added this to the 0.3 milestone Jun 10, 2015

@joleroi joleroi changed the title from WIP: PHA export to Implement EffectiveAreaTable2D.to_effective_area_table Jun 16, 2015

@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi

joleroi Jun 17, 2015

Contributor

Is this something I should resolve? If so, how :) ?

Contributor

joleroi commented Jun 17, 2015

Is this something I should resolve? If so, how :) ?

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jun 17, 2015

Member

@kingj90 - Yes, I'd prefer you resolve the merge conflict yourself. One advantage is less work for me, another is that travis-ci will re-run the tests.

You have to rebase on master. How to do it a bit depends on how you work with the upstream master branch locally, i.e. what exactly your git workflow is.

The recommended procedure for Astropy is here

I use this:

git checkout master
git status # should be clean
git pull # get latest version from upstream
git checkout mybranch
git rebase master --interactive
# resolve conflict
git push -f kingj90 mybranch

You might want to make a copy of your gammapy folder before ... it's not unheard of that people git in a pickle on their first few rebases. :-)

Member

cdeil commented Jun 17, 2015

@kingj90 - Yes, I'd prefer you resolve the merge conflict yourself. One advantage is less work for me, another is that travis-ci will re-run the tests.

You have to rebase on master. How to do it a bit depends on how you work with the upstream master branch locally, i.e. what exactly your git workflow is.

The recommended procedure for Astropy is here

I use this:

git checkout master
git status # should be clean
git pull # get latest version from upstream
git checkout mybranch
git rebase master --interactive
# resolve conflict
git push -f kingj90 mybranch

You might want to make a copy of your gammapy folder before ... it's not unheard of that people git in a pickle on their first few rebases. :-)

@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi

joleroi Jun 24, 2015

Contributor

anything else to do here?

Contributor

joleroi commented Jun 24, 2015

anything else to do here?

Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
Show outdated Hide outdated gammapy/irf/effective_area_table.py Outdated
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jun 24, 2015

Member

Almost ready to be merged ... left one last round of inline comments.

Member

cdeil commented Jun 24, 2015

Almost ready to be merged ... left one last round of inline comments.

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jul 15, 2015

Member

@kingj90 – I think you addressed my last comment in 4357848 on Jun 24.
Github doesn't send notifications when new commits are made, so I didn't notice.
You have to leave a comment saying "OK to merge" or something ...

By now, there's a merge conflict, so you have to rebase on master so that travis-ci runs the tests again and so that the green merge button appears for me to click.

Member

cdeil commented Jul 15, 2015

@kingj90 – I think you addressed my last comment in 4357848 on Jun 24.
Github doesn't send notifications when new commits are made, so I didn't notice.
You have to leave a comment saying "OK to merge" or something ...

By now, there's a merge conflict, so you have to rebase on master so that travis-ci runs the tests again and so that the green merge button appears for me to click.

@joleroi

This comment has been minimized.

Show comment
Hide comment
@joleroi

joleroi Jul 15, 2015

Contributor

OK to merge ;)

Contributor

joleroi commented Jul 15, 2015

OK to merge ;)

@cdeil cdeil changed the title from Implement EffectiveAreaTable2D.to_effective_area_table to Add EffectiveAreaTable exporter to EffectiveAreaTable2D Jul 15, 2015

cdeil added a commit that referenced this pull request Jul 15, 2015

Merge pull request #276 from kingj90/pha_export
Add EffectiveAreaTable exporter to EffectiveAreaTable2D

@cdeil cdeil merged commit 650707d into gammapy:master Jul 15, 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 Jul 15, 2015

Member

Thanks!

Member

cdeil commented Jul 15, 2015

Thanks!

@joleroi joleroi deleted the joleroi:pha_export branch Jul 15, 2015

>>> aeff2D = EffectiveAreaTable2D.from_fits(load_aeff2D_fits_table())
>>> offset = Angle(0.43, 'degree')
>>> nbins = 50
>>> energy = energy_bounds_equal_log_spacing(Quantity((1,10), 'TeV', nbins)

This comment has been minimized.

@cdeil

cdeil Jul 16, 2015

Member

I just tried this example locally.
There's a missing closing parens on this line.

If I add it, I get this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-55b7c69c7675> in <module>()
      8 offset = Angle(0.43, 'degree')
      9 nbins = 50
---> 10 energy = energy_bounds_equal_log_spacing(Quantity((1,10), 'TeV', nbins))
     11 energ_lo = energy[:-1]
     12 energ_hi = energy[1:]

/Users/deil/Library/Python/3.4/lib/python/site-packages/astropy-1.1.dev12994-py3.4-macosx-10.10-x86_64.egg/astropy/units/quantity.py in __new__(cls, value, unit, dtype, copy, order, subok, ndmin)
    247 
    248         value = np.array(value, dtype=dtype, copy=copy, order=order,
--> 249                          subok=False, ndmin=ndmin)
    250 
    251         # check that array contains numbers or long int objects

TypeError: data type not understood

@kingj90 – Can you fix this example as a separate commit in your next PR?

Also: code examples that don't show output don't have to have the >>> on every line, you can remove that.

@cdeil

cdeil Jul 16, 2015

Member

I just tried this example locally.
There's a missing closing parens on this line.

If I add it, I get this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-55b7c69c7675> in <module>()
      8 offset = Angle(0.43, 'degree')
      9 nbins = 50
---> 10 energy = energy_bounds_equal_log_spacing(Quantity((1,10), 'TeV', nbins))
     11 energ_lo = energy[:-1]
     12 energ_hi = energy[1:]

/Users/deil/Library/Python/3.4/lib/python/site-packages/astropy-1.1.dev12994-py3.4-macosx-10.10-x86_64.egg/astropy/units/quantity.py in __new__(cls, value, unit, dtype, copy, order, subok, ndmin)
    247 
    248         value = np.array(value, dtype=dtype, copy=copy, order=order,
--> 249                          subok=False, ndmin=ndmin)
    250 
    251         # check that array contains numbers or long int objects

TypeError: data type not understood

@kingj90 – Can you fix this example as a separate commit in your next PR?

Also: code examples that don't show output don't have to have the >>> on every line, you can remove that.

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