-
Notifications
You must be signed in to change notification settings - Fork 48
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
ENH: (NEP 18) implement and test np.in1d and np.interp #398
Conversation
actually, going into draft mode for a minute, while I try to squeeze |
did I forget to click the "draft" button ? Anyway, this is ready now |
@implements(np.interp) | ||
def interp(x, xp, fp, *args, **kwargs): | ||
_validate_units_consistency((x, xp)) | ||
ret_units = getattr(fp, "units", 1) |
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.
ret_units = getattr(fp, "units", 1) | |
ret_units = getattr(fp, "units", NULL_UNIT) |
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.
Doesn't really make much difference, the 1
just made me double-take reading this, NULL_UNIT
makes the logic clearer.
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.
I intentionally didn't use get_units
(which is equivalent to your suggestion) because I wanted the output to match fp's type (so a pure ndarray wouldn't leak as a dimensionless unyt_array). I could add a comment to make that intention clearer, or I could just go with your suggestion and change the test too, no strong opinions actually. Your call !
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.
Ah good call please add a comment
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.
done
d927a15
to
11d9039
Compare
As discussed in #289