Skip to content
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 is_pointlike property on irfs #3404

Merged
merged 7 commits into from
Jul 1, 2021

Conversation

registerrier
Copy link
Contributor

Description

This pull request adds a IRF.is_pointlike property to be able to check whether an IRF is pointlike or not.

Dear reviewer

@registerrier registerrier added this to the 1.0 milestone Jun 29, 2021
@codecov
Copy link

codecov bot commented Jun 29, 2021

Codecov Report

Merging #3404 (c0b1e42) into master (2410598) will increase coverage by 0.00%.
The diff coverage is 95.77%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3404   +/-   ##
=======================================
  Coverage   93.55%   93.56%           
=======================================
  Files         147      147           
  Lines       18512    18539   +27     
=======================================
+ Hits        17319    17346   +27     
  Misses       1193     1193           
Impacted Files Coverage Δ
gammapy/utils/scripts.py 95.45% <ø> (ø)
gammapy/makers/safe.py 87.00% <72.22%> (ø)
gammapy/maps/hpxnd.py 93.00% <75.00%> (ø)
gammapy/maps/wcs.py 96.81% <89.47%> (+0.02%) ⬆️
gammapy/estimators/ts_map.py 96.87% <92.00%> (-0.31%) ⬇️
gammapy/analysis/core.py 96.42% <92.30%> (ø)
gammapy/modeling/fit.py 96.33% <94.11%> (+0.41%) ⬆️
gammapy/maps/maps.py 97.29% <97.29%> (ø)
gammapy/datasets/map.py 93.62% <100.00%> (-0.02%) ⬇️
gammapy/estimators/asmooth_map.py 93.33% <100.00%> (ø)
... and 54 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 079c6e9...c0b1e42. Read the comment docs.

Copy link
Member

@adonath adonath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @registerrier, the is a useful addition. I have left some inline comments..

gammapy/irf/tests/test_effective_area.py Outdated Show resolved Hide resolved
gammapy/irf/tests/test_energy_dispersion.py Outdated Show resolved Hide resolved
gammapy/makers/spectrum.py Outdated Show resolved Hide resolved
axes = MapAxes(axes)
axes.assert_names(self.required_axes)
self._axes = axes
self.data = data
self.unit = unit
self.meta = meta or {}
self._is_pointlike = is_pointlike
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe treat the is_pointlike info as part of the meta data? I guess the motivation for the separate argument is to stay independent of the serialisation format (which is good!), however we can introduce arbitrary internal meta data and corresponding keywords as we like. The advantage is that the meta data can be easier copied over to the reduced data as well and we keep the option for a unified data structure of IRF and Map in future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could possibly add a table in the docs with "allowed" meta keywords for IRFs and a corresponding description. Like:

Keyword Description Type
is_pointlike Whether IRF is pointlike bool
safe_energy_range Recommend safe energy range tuple

adonath
adonath previously approved these changes Jul 1, 2021
Copy link
Member

@adonath adonath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @registerrier, I left two more minor comments. After those have been addressed, CI should turn green...

@@ -23,6 +23,12 @@ def observations_hess_dl3():
obs_ids = [23523, 23526]
return datastore.get_observations(obs_ids)

@pytest.fixture
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add missing requires_data()...

gammapy/makers/utils.py Outdated Show resolved Hide resolved
@adonath adonath changed the title Add a is_pointlike property on irfs Add is_pointlike property on irfs Jul 1, 2021
Copy link
Member

@adonath adonath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @registerrier! No further comments from my side...

@adonath adonath merged commit 8352774 into gammapy:master Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants