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: stats.kurtosistest: add array API support #20715

Merged
merged 1 commit into from
May 16, 2024

Conversation

mdhaber
Copy link
Contributor

@mdhaber mdhaber commented May 15, 2024

Reference issue

Toward gh-20544

What does this implement/fix?

Adds array API support to scipy.stats.kurtosistest.

Additional information

Again just blindly converting the relevant parts of the mega-test to array API. Will split it up into separate tests as appropriate after converting normaltest.

@github-actions github-actions bot added scipy.stats enhancement A new feature or improvement labels May 15, 2024
@mdhaber mdhaber added the array types Items related to array API support and input array validation (see gh-18286) label May 15, 2024
@@ -1805,6 +1805,9 @@ def kurtosistest(a, axis=0, nan_policy='propagate', alternative='two-sided'):
hypothesis [4]_.

"""
xp = array_namespace(a)
a, axis = _chk_asarray(a, axis, xp=xp)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For NumPy, _axis_nan_policy decorator takes care of raveling for axis=None. It doesn't right now for array API, so bring back _chk_asarray.

Comment on lines +6216 to +6221
x = xp.arange(30.)
x[29] = NaN
with np.errstate(all='ignore'):
res = stats.kurtosistest(x)
xp_assert_equal(res.statistic, NaN)
xp_assert_equal(res.pvalue, NaN)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Brought this up from below.

@mdhaber mdhaber requested a review from j-bowhay May 15, 2024 11:08
@mdhaber mdhaber mentioned this pull request May 15, 2024
74 tasks
Copy link
Member

@tupui tupui left a comment

Choose a reason for hiding this comment

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

LGTM straightforward diff 👍

@tupui tupui merged commit 626bbd1 into scipy:main May 16, 2024
30 of 32 checks passed
@tupui tupui added this to the 1.14.0 milestone May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
array types Items related to array API support and input array validation (see gh-18286) enhancement A new feature or improvement scipy.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants