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

ENH: (NEP 18) test 7 new functions, impl 2 #309

Merged
merged 3 commits into from
Oct 21, 2022

Conversation

neutrinoceros
Copy link
Member

No description provided.

@neutrinoceros neutrinoceros changed the title ENH: (NEP 18) test 6 new functions, impl 2 ENH: (NEP 18) test 7 new functions, impl 2 Oct 19, 2022
def get_units(arrays):
units = []
for sub in arrays:
if isinstance(sub, np.ndarray):
Copy link
Member Author

Choose a reason for hiding this comment

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

this check is not as general as it should, we need to capture all non-nested arraylike objects here, which is a bit tricky

Copy link
Member Author

Choose a reason for hiding this comment

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

actually I'll take that back. np.ndarray instances are the only objects for which we know that we can grab a single unit without iterating over each elements.
This implementation will probably be dramatically slow when nested lists of quantities are passed but hey, I guess users shouldn't be doing that at scale and expect the very best of performances, so all in all this seems reasonable to me

@neutrinoceros neutrinoceros marked this pull request as ready for review October 19, 2022 20:22
@ngoldbaum ngoldbaum merged commit 28652d9 into yt-project:main Oct 21, 2022
@neutrinoceros neutrinoceros deleted the nep18_4 branch October 21, 2022 16:00
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