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: add dtype arg to stats.mstats.gmean and stats.mstats.hmean #3302

Closed
wants to merge 1 commit into from

Conversation

andreas-h
Copy link
Contributor

fixes #3196

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 26db2b7 on andreas-h:gh3196 into 1f9f36d on scipy:master.

@@ -58,6 +58,11 @@ def test_1D(self):
desired1 = mstats.gmean(a,axis=-1)
assert_almost_equal(actual, desired1, decimal=14)

actualdt = mstats.gmean(a, dtype=np.float128)
desireddt = np.power(1*2*3,1./3.).astype(np.float128)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add some underscores? actual_dt and desider_dt is more readable. also in the test for hmean.

Copy link
Member

Choose a reason for hiding this comment

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

and some spaces in the power call for PEP8 compat

@rgommers
Copy link
Member

Actually, stats.gmean and stats.hmean support masked arrays. So probably the implementations in mstats_basic.py can simply be deleted and the stats version added to the mstats namespace. Tests could be kept though.

@andreas-h
Copy link
Contributor Author

So I import them in mstats, keep the tests. Shall I also keep them in
the autosummary of mstats?

@rgommers
Copy link
Member

Not needed I think, it's only kept in that namespace for backwards compat.

…gmean and hmean

TST: test correct dtype handling in masked_array case in scipy.stats.gmean and hmean

fixes scipy#3196
@andreas-h
Copy link
Contributor Author

Done.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling ffbf26e on andreas-h:gh3196 into 0da153e on scipy:master.

@rgommers rgommers added this to the 0.14.0 milestone Feb 24, 2014
rgommers added a commit that referenced this pull request Feb 24, 2014
@rgommers
Copy link
Member

OK merged in a8abcfb. I fixed two issues: use assert_ instead of assert and use float96 instead of float128 (the latter isn't present in numpy 1.5.1).

@rgommers rgommers closed this Feb 24, 2014
@rgommers
Copy link
Member

Thanks Andreas.

@andreas-h andreas-h deleted the gh3196 branch February 24, 2014 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scipy.stats.mstats.gmean does not actually take dtype
5 participants