gh-770: Default to numpy for redshift_grid and fixed_zbins if no xp is provided#771
Merged
paddyroddy merged 11 commits intomainfrom Nov 18, 2025
Merged
gh-770: Default to numpy for redshift_grid and fixed_zbins if no xp is provided#771paddyroddy merged 11 commits intomainfrom
paddyroddy merged 11 commits intomainfrom
Conversation
Collaborator
|
Thanks for looking into this! How about we create a |
Contributor
Author
Sounds like a great idea |
28e2f5d to
5aeec79
Compare
5aeec79 to
604c498
Compare
paddyroddy
reviewed
Nov 13, 2025
paddyroddy
reviewed
Nov 13, 2025
glass/_array_api_utils.py
Outdated
| def default_xp() -> ModuleType: | ||
| """Returns the library backend we default to if none is specified by the user.""" | ||
| warnings.warn( | ||
| f"No array library has been provided for call to {inspect.stack()[1].function}", |
Contributor
Author
There was a problem hiding this comment.
¯\_(ツ)_/¯
Would you rather leave out the calling function name?
Member
There was a problem hiding this comment.
Maybe? When we call import_numpy elsewhere, the CompatibleBackendNotFoundError doesn't say where the backend is missing
Collaborator
There was a problem hiding this comment.
I think it's fine for users to use GLASS as a CPU code so I wouldn't warn on default_xp(), at least for the time being.
paddyroddy
reviewed
Nov 17, 2025
paddyroddy
approved these changes
Nov 18, 2025
ntessore
approved these changes
Nov 18, 2025
This file contains hidden or 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
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.
Description
Removed requirement for xp to be passed into redshift_grid and fixed_zbins. Now the default library used will be numpy.
Fixes: #770
Changelog entry
Fixed: redshift_grid and fixed_zbins no longer rely on xp being passed. Now defaults to numpy.
Checks