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 __repr__ methods to Maps and related classes #1435

Merged
merged 4 commits into from Jun 21, 2018

Conversation

@adonath
Copy link
Member

@adonath adonath commented Jun 20, 2018

This PR adds __repr__ methods to the Maps, MapsGeom and MapAxis classes.

@adonath adonath self-assigned this Jun 20, 2018
@adonath adonath added the feature label Jun 20, 2018
Copy link
Member

@cdeil cdeil left a comment

@adonath - Thanks! Good to have you back for Gammapy!!!

Please add label and milestone, and a test that executes each repr once. IMO no need to assert the full output, but just to make sure it runs is important and the assert could be just on e few characters.

If you want feedback on content it'd be nice to have it visible somewhere (e.g. in docs RST output or pasted to Github issue), but I would suggest to just put that in, and if someone has suggestions they can open a new PR.

@@ -1731,6 +1731,23 @@ def solid_angle(self):
import healpy as hp
return Quantity(hp.nside2pixarea(self.nside), 'sr')

def __repr__(self):
"""String representation of the MapAxis object"""

This comment has been minimized.

@cdeil

cdeil Jun 20, 2018
Member

Suggest to remove all the docstrings on the __repr__ methods.
It's just something Python coders have to know, and users won't see them anyways.
I'd prefer not to add them 100x in Gammapy.
Also: you currently have copy & paste errors, you always say "MapAxis".

@adonath adonath added this to the 0.8 milestone Jun 20, 2018
@adonath adonath force-pushed the adonath:add_maps_repr branch from fe3d974 to b6b60ab Jun 20, 2018
@adonath adonath force-pushed the adonath:add_maps_repr branch from b6b60ab to 758149b Jun 21, 2018
@adonath adonath merged commit 34df292 into gammapy:master Jun 21, 2018
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@adonath adonath deleted the adonath:add_maps_repr branch Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants