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 MapDataset.from_geoms #2470

Merged
merged 3 commits into from Oct 17, 2019
Merged

Add MapDataset.from_geoms #2470

merged 3 commits into from Oct 17, 2019

Conversation

@AtreyeeS
Copy link
Member

AtreyeeS commented Oct 17, 2019

This PR adds a MapDataset.from_geoms to clean up the API

@AtreyeeS AtreyeeS requested a review from adonath Oct 17, 2019
@AtreyeeS AtreyeeS self-assigned this Oct 17, 2019
@AtreyeeS AtreyeeS added the cleanup label Oct 17, 2019
@AtreyeeS AtreyeeS added this to To do in gammapy.maps via automation Oct 17, 2019
@AtreyeeS AtreyeeS added this to the 0.15 milestone Oct 17, 2019
@cdeil cdeil changed the title Add `MapDataset.from_geoms` Add MapDataset.from_geoms Oct 17, 2019
Copy link
Member

adonath left a comment

Thanks @AtreyeeS, I've left a few inline comments. Once those are addressed we can merge.

Parameters
--------------
geom: geometry for the counts and background maps

This comment has been minimized.

Copy link
@adonath

adonath Oct 17, 2019

Member

Please add the argument type:

Parameters
----------
geom: `Geom`
    Geometry for the counts and background maps.
geom_exposure : `Geom`
    ...
cls,
geom,
geom_exposure,
geom_irf,

This comment has been minimized.

Copy link
@adonath

adonath Oct 17, 2019

Member

I think the current assumption is, that the geom_irf is aligned with geom_psf and geom_edisp (because it's only needed for stacking). So you can basically create it internally from geom_exposure, like so:

e_true_axis = geom_edisp.get_axis_by_name("energy")
geom_exposure_edisp = geom_edisp.to_image().to_cube([e_true_axis]) 

And the same for geom_psf. Also note that the spatial binning for geom_psf and geom_edisp might be different in the most general case.

Once you create geom_irf internally, it can be removed as an argument.

the reference time to use in GTI definition
name : str
Name of the dataset.

This comment has been minimized.

Copy link
@adonath

adonath Oct 17, 2019

Member

Please add Returns section here...

gammapy.maps automation moved this from To do to In progress Oct 17, 2019
AtreyeeS added 2 commits Oct 17, 2019
Copy link
Member

adonath left a comment

Thanks @AtreyeeS! Looks good to me now...

@adonath adonath merged commit 3c6eb5c into gammapy:master Oct 17, 2019
9 checks passed
9 checks passed
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
Scrutinizer Analysis: 2 updated code elements – Tests: passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
gammapy.gammapy Build #20191017.20 succeeded
Details
gammapy.gammapy (DevDocs) DevDocs succeeded
Details
gammapy.gammapy (Lint) Lint succeeded
Details
gammapy.gammapy (Test Python36) Test Python36 succeeded
Details
gammapy.gammapy (Test Windows36) Test Windows36 succeeded
Details
gammapy.gammapy (Test Windows37) Test Windows37 succeeded
Details
gammapy.maps automation moved this from In progress to Done Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
gammapy.maps
  
Done
2 participants
You can’t perform that action at this time.