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 EventList.select_map_mask() method #2049

Merged
merged 5 commits into from Feb 28, 2019

Conversation

@registerrier
Copy link
Contributor

@registerrier registerrier commented Feb 26, 2019

This PR introduces a selection on EventListBase based on Map defined masks.

This will allow more detailed selections in particular regarding reflected region.

@registerrier registerrier requested a review from adonath Feb 26, 2019
@registerrier registerrier self-assigned this Feb 26, 2019
@registerrier registerrier added this to the 0.11 milestone Feb 26, 2019
Copy link
Member

@adonath adonath left a comment

Thanks @registerrier! I've left a few in-line comments...


return MapCoord.create(coord, coordsys="CEL")

def select_from_map_mask(self, mask):
Copy link
Member

@adonath adonath Feb 27, 2019

Maybe rename to select_map_mask, to be consistent with other select_... methods?

Copy link
Contributor Author

@registerrier registerrier Feb 27, 2019

Done

----------
mask : `~gammapy.maps.Map`
the mask to be used
Returns
Copy link
Member

@adonath adonath Feb 27, 2019

There is an empty line missing...

Copy link
Contributor Author

@registerrier registerrier Feb 27, 2019

Done

Copy link
Contributor Author

@registerrier registerrier Feb 27, 2019

Done

----------
geom : `~gammapy.maps.MapGeom`
the geom used to define the MapCoord
Returns
Copy link
Member

@adonath adonath Feb 27, 2019

Missing empty line...

except KeyError:
raise KeyError("Column not found in event list: {!r}".format(axis.name))

return MapCoord.create(coord, coordsys="CEL")
Copy link
Member

@adonath adonath Feb 27, 2019

I'd prefer to just return a dict of {"skycoord": self.radec, "energy": energy, "...": ..., } to avoid the MapCoord import. The dict can be passed to .get_by_coord() as well.

@registerrier registerrier requested a review from adonath Feb 27, 2019
Copy link
Member

@adonath adonath left a comment

Thanks @registerrier, I have no further comments.

@registerrier registerrier merged commit 1110efd into gammapy:master Feb 28, 2019
8 checks passed
@adonath adonath changed the title Add an EventList selection based on Map Add EventList.select_map_mask() method Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants