-
Notifications
You must be signed in to change notification settings - Fork 12
gh-770: Default to numpy for redshift_grid and fixed_zbins if no xp is provided #771
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for looking into this! How about we create a |
Sounds like a great idea |
28e2f5d to
5aeec79
Compare
5aeec79 to
604c498
Compare
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}", |
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.
Will this work every time?
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.
¯\_(ツ)_/¯
Would you rather leave out the calling function name?
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.
Maybe? When we call import_numpy elsewhere, the CompatibleBackendNotFoundError doesn't say where the backend is missing
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 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.
| # check num input | ||
|
|
||
| num = 5 | ||
| with pytest.warns( |
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.
These aren't relevant any more, see test failures
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