-
Notifications
You must be signed in to change notification settings - Fork 12
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
Complete cosmo_array
numpy support and add cosmo_quantity
#219
Draft
kyleaoman
wants to merge
30
commits into
master
Choose a base branch
from
cosmo_quantity
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kyleaoman
changed the title
Implement a
Complete Dec 15, 2024
cosmo_quantity
analogous to unyt_quantity
cosmo_array
numpy support and add cosmo_quantity
@JBorrow just want to put this on your radar as it's basically implemented and working now (modulo notes in the post above). Gonna mostly leave it be over the xmas break, but hoping to wrap it up in January. Anyway just don't want to spring a colossal PR on you without warning - if you have any input or requests to make things go smoothly with it at this stage let me know? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unyt has a
unyt_quantity
for scalars with units attached (a subclass ofunyt_array
). It makes sense to have an analoguecosmo_quantity
subclass ofcosmo_array
, mainly so that various numpy functions don't silently cast tounyt_quantity
. While I'm at it am also reviewing testing of numpy function return types and cleaning up helper functions as needed.Closes #102
So far I have new tests implemented, and the new
cosmo_quantity
class implemented. As collateral to all of this I'm implementing wrapping all of the numpy functions supported by unyt. Those are now all wrapped. I'd previously wrapped all of the numpy ufuncs so most of the logic existed already, just repackaged existing helper functions and created a couple of new ones, and now cribbed off of the unyt wrappers to make sure I don't miss any edge cases (unless they missed any!).After a bit of tidying up and a couple of squashed bugs in unyt the test suite now passes (with the not-yet-released unyt version with my patches applied, they say hopefully released by the end of the year). Will need to pin dependencies to unyt >=3.0.4, and probably numpy >=2.0, too.
Left to do:
"ca_cfs"
logic by usingcosmo_factor(None, None)
instead. That's a big job, though.to_comoving
might be better asconvert_to_comoving
(in-place).objects.py
to_array_functions.py
.take
strips units with scalar index input yt-project/unyt#549 and get it merged, then implement a wrapper fornp.take
.