-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Adding __pow__ to NDCube #678
Conversation
why are user warnings not triggered on tests? |
new_cube = ndcube_2d_ln_lt_uncert ** power | ||
check_arithmetic_value_and_units(new_cube, cube_quantity**power) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need tests for when for the following cases:
self.uncertainty is None
self.unit is None
These can probably be done in the same test.
Co-authored-by: DanRyanIrish <[email protected]>
Co-authored-by: DanRyanIrish <[email protected]>
Co-authored-by: DanRyanIrish <[email protected]>
Co-authored-by: DanRyanIrish <[email protected]>
ndcube/tests/test_ndcube.py
Outdated
@@ -1124,6 +1124,30 @@ def test_cube_arithmetic_multiply_notimplementederror(ndcube_2d_ln_lt_units): | |||
_ = ndcube_2d_ln_lt_units * ndcube_2d_ln_lt_units | |||
|
|||
|
|||
@pytest.mark.filterwarnings('ignore::RuntimeWarning') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to use np.errstate
rather than this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed
try: | ||
new_uncertainty = new_uncertainty.propagate(np.power, self, self.data ** value, correlation=1) | ||
except ValueError as e: | ||
if "unsupported operation" in e.args[0]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is gross, we should open an issue on astropy to raise different error classes for different errors.
Co-authored-by: Stuart Mumford <[email protected]>
Co-authored-by: Stuart Mumford <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shipit.mp4 |
Fixes #575
This add
__pow__
to NDCube