Skip to content

Properties giving order of types in inputs to NDCube.crop and crop_by_values 2 #868

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DanRyanIrish
Copy link
Member

Inspired by discussions in #866

Re-creation of PR #867 due to messing up git history.

@DanRyanIrish
Copy link
Member Author

@ayshih, @Cadair, thoughts on this one instead

Comment on lines +1464 to +1467
Returns types and order of high-level coordinate objects that must be input to .crop()
Each point given to .crop() must be a tuple of scalar high-level coordinate objects
of these types, in this order. Note, however, that any of these can be replaced
with None if cropping along the axis/axes of that world type in not desired.
Copy link
Member

Choose a reason for hiding this comment

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

First line of the docstring should be <80 char. Then a blank line, then a paragraph. (Same below)

Copy link
Member

Choose a reason for hiding this comment

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

Also put code snippets in double backticks.

@property
def crop_by_values_input_units_order(self):
"""
Returns units of inputs to .crop_by_values() and their required order.
Copy link
Member

Choose a reason for hiding this comment

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

Properties don't return they are.

Suggested change
Returns units of inputs to .crop_by_values() and their required order.
Units of inputs to ``.crop_by_values()`` and their required order.

return tuple(v[0] for v in self.wcs.world_axis_object_classes.values())

@property
def crop_by_values_input_units_order(self):
Copy link
Member

Choose a reason for hiding this comment

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

I'm much less convinced by the need for this property as we can just say "look at cube.wcs.world_axis_units" in the docstring of crop_by_values we don't need this proxy.

@@ -1458,6 +1458,25 @@ def fill_masked(self, fill_value, uncertainty_fill_value=None, unmask=False, fil
self.mask = False
return None

@property
def crop_input_types_order(self):
Copy link
Member

Choose a reason for hiding this comment

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

This really feels like it belongs on the WCS API (as world_classes_order) or something.

@DanRyanIrish
Copy link
Member Author

I have opened a PR to astropy suggesting this property in the WCS API: astropy/astropy#18408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants