scipy 1.16.0rc2__cp311-cp311-macosx_12_0_arm64.whl → 1.16.1__cp311-cp311-macosx_12_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scipy/__config__.py +8 -8
- scipy/_cyutility.cpython-311-darwin.so +0 -0
- scipy/_lib/_ccallback_c.cpython-311-darwin.so +0 -0
- scipy/_lib/_test_deprecation_call.cpython-311-darwin.so +0 -0
- scipy/_lib/_util.py +7 -0
- scipy/_lib/messagestream.cpython-311-darwin.so +0 -0
- scipy/cluster/_hierarchy.cpython-311-darwin.so +0 -0
- scipy/cluster/_optimal_leaf_ordering.cpython-311-darwin.so +0 -0
- scipy/cluster/_vq.cpython-311-darwin.so +0 -0
- scipy/conftest.py +25 -0
- scipy/fft/_pocketfft/pypocketfft.cpython-311-darwin.so +0 -0
- scipy/fftpack/convolve.cpython-311-darwin.so +0 -0
- scipy/integrate/_dop.cpython-311-darwin.so +0 -0
- scipy/integrate/_lsoda.cpython-311-darwin.so +0 -0
- scipy/integrate/_odepack.cpython-311-darwin.so +0 -0
- scipy/integrate/_test_odeint_banded.cpython-311-darwin.so +0 -0
- scipy/integrate/_vode.cpython-311-darwin.so +0 -0
- scipy/interpolate/_dfitpack.cpython-311-darwin.so +0 -0
- scipy/interpolate/_dierckx.cpython-311-darwin.so +0 -0
- scipy/interpolate/_interpnd.cpython-311-darwin.so +0 -0
- scipy/interpolate/_ppoly.cpython-311-darwin.so +0 -0
- scipy/interpolate/_rgi_cython.cpython-311-darwin.so +0 -0
- scipy/io/_fast_matrix_market/_fmm_core.cpython-311-darwin.so +0 -0
- scipy/io/_test_fortran.cpython-311-darwin.so +0 -0
- scipy/io/matlab/_mio5_utils.cpython-311-darwin.so +0 -0
- scipy/io/matlab/_mio_utils.cpython-311-darwin.so +0 -0
- scipy/io/matlab/_streams.cpython-311-darwin.so +0 -0
- scipy/io/matlab/tests/test_streams.py +9 -0
- scipy/linalg/_cythonized_array_utils.cpython-311-darwin.so +0 -0
- scipy/linalg/_decomp_interpolative.cpython-311-darwin.so +0 -0
- scipy/linalg/_decomp_lu_cython.cpython-311-darwin.so +0 -0
- scipy/linalg/_decomp_update.cpython-311-darwin.so +0 -0
- scipy/linalg/_fblas.cpython-311-darwin.so +0 -0
- scipy/linalg/_flapack.cpython-311-darwin.so +0 -0
- scipy/linalg/_matfuncs_expm.cpython-311-darwin.so +0 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cpython-311-darwin.so +0 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cpython-311-darwin.so +0 -0
- scipy/linalg/_solve_toeplitz.cpython-311-darwin.so +0 -0
- scipy/linalg/blas.py +35 -24
- scipy/linalg/cython_blas.cpython-311-darwin.so +0 -0
- scipy/linalg/cython_lapack.cpython-311-darwin.so +0 -0
- scipy/linalg/tests/test_matfuncs.py +7 -0
- scipy/ndimage/_cytest.cpython-311-darwin.so +0 -0
- scipy/ndimage/_filters.py +11 -2
- scipy/ndimage/_ni_label.cpython-311-darwin.so +0 -0
- scipy/ndimage/_rank_filter_1d.cpython-311-darwin.so +0 -0
- scipy/ndimage/tests/test_filters.py +52 -0
- scipy/odr/__odrpack.cpython-311-darwin.so +0 -0
- scipy/optimize/_bglu_dense.cpython-311-darwin.so +0 -0
- scipy/optimize/_highspy/_core.cpython-311-darwin.so +0 -0
- scipy/optimize/_highspy/_highs_options.cpython-311-darwin.so +0 -0
- scipy/optimize/_lbfgsb.cpython-311-darwin.so +0 -0
- scipy/optimize/_lbfgsb_py.py +23 -8
- scipy/optimize/_lsq/givens_elimination.cpython-311-darwin.so +0 -0
- scipy/optimize/_lsq/least_squares.py +2 -2
- scipy/optimize/_minimize.py +0 -1
- scipy/optimize/_moduleTNC.cpython-311-darwin.so +0 -0
- scipy/optimize/_pava_pybind.cpython-311-darwin.so +0 -0
- scipy/optimize/_shgo_lib/_complex.py +2 -2
- scipy/optimize/_slsqplib.cpython-311-darwin.so +0 -0
- scipy/optimize/_trlib/_trlib.cpython-311-darwin.so +0 -0
- scipy/optimize/cython_optimize/_zeros.cpython-311-darwin.so +0 -0
- scipy/optimize/tests/test_optimize.py +3 -3
- scipy/signal/_filter_design.py +13 -1
- scipy/signal/_fir_filter_design.py +1 -1
- scipy/signal/_peak_finding_utils.cpython-311-darwin.so +0 -0
- scipy/signal/_polyutils.py +1 -1
- scipy/signal/_sosfilt.cpython-311-darwin.so +0 -0
- scipy/signal/_upfirdn_apply.cpython-311-darwin.so +0 -0
- scipy/signal/tests/test_filter_design.py +19 -0
- scipy/signal/tests/test_fir_filter_design.py +5 -0
- scipy/signal/tests/test_signaltools.py +1 -1
- scipy/sparse/_base.py +4 -1
- scipy/sparse/_csparsetools.cpython-311-darwin.so +0 -0
- scipy/sparse/csgraph/_flow.cpython-311-darwin.so +0 -0
- scipy/sparse/csgraph/_matching.cpython-311-darwin.so +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cpython-311-darwin.so +0 -0
- scipy/sparse/csgraph/_reordering.cpython-311-darwin.so +0 -0
- scipy/sparse/csgraph/_shortest_path.cpython-311-darwin.so +0 -0
- scipy/sparse/csgraph/_tools.cpython-311-darwin.so +0 -0
- scipy/sparse/csgraph/_traversal.cpython-311-darwin.so +0 -0
- scipy/sparse/linalg/_dsolve/_superlu.cpython-311-darwin.so +0 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cpython-311-darwin.so +0 -0
- scipy/sparse/linalg/_propack/_cpropack.cpython-311-darwin.so +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cpython-311-darwin.so +0 -0
- scipy/sparse/linalg/_propack/_spropack.cpython-311-darwin.so +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cpython-311-darwin.so +0 -0
- scipy/sparse/tests/test_base.py +3 -0
- scipy/spatial/_ckdtree.cpython-311-darwin.so +0 -0
- scipy/spatial/_distance_pybind.cpython-311-darwin.so +0 -0
- scipy/spatial/_hausdorff.cpython-311-darwin.so +0 -0
- scipy/spatial/_qhull.cpython-311-darwin.so +0 -0
- scipy/spatial/_voronoi.cpython-311-darwin.so +0 -0
- scipy/spatial/transform/_rigid_transform.cpython-311-darwin.so +0 -0
- scipy/spatial/transform/_rotation.cpython-311-darwin.so +0 -0
- scipy/special/_comb.cpython-311-darwin.so +0 -0
- scipy/special/_ellip_harm_2.cpython-311-darwin.so +0 -0
- scipy/special/_specfun.cpython-311-darwin.so +0 -0
- scipy/special/_test_internal.cpython-311-darwin.so +0 -0
- scipy/special/_ufuncs.cpython-311-darwin.so +0 -0
- scipy/special/_ufuncs_cxx.cpython-311-darwin.so +0 -0
- scipy/special/cython_special.cpython-311-darwin.so +0 -0
- scipy/stats/_ansari_swilk_statistics.cpython-311-darwin.so +0 -0
- scipy/stats/_biasedurn.cpython-311-darwin.so +0 -0
- scipy/stats/_continuous_distns.py +19 -16
- scipy/stats/_distribution_infrastructure.py +20 -0
- scipy/stats/_levy_stable/levyst.cpython-311-darwin.so +0 -0
- scipy/stats/_qmc_cy.cpython-311-darwin.so +0 -0
- scipy/stats/_qmvnt_cy.cpython-311-darwin.so +0 -0
- scipy/stats/_rcont/rcont.cpython-311-darwin.so +0 -0
- scipy/stats/_resampling.py +1 -1
- scipy/stats/_sobol.cpython-311-darwin.so +0 -0
- scipy/stats/_stats.cpython-311-darwin.so +0 -0
- scipy/stats/_stats_py.py +1 -1
- scipy/stats/_unuran/unuran_wrapper.cpython-311-darwin.so +0 -0
- scipy/stats/tests/test_distributions.py +13 -0
- scipy/stats/tests/test_fast_gen_inversion.py +2 -0
- scipy/stats/tests/test_morestats.py +4 -4
- scipy/version.py +2 -2
- {scipy-1.16.0rc2.dist-info → scipy-1.16.1.dist-info}/METADATA +2 -1
- {scipy-1.16.0rc2.dist-info → scipy-1.16.1.dist-info}/RECORD +123 -123
- {scipy-1.16.0rc2.dist-info → scipy-1.16.1.dist-info}/LICENSE.txt +0 -0
- {scipy-1.16.0rc2.dist-info → scipy-1.16.1.dist-info}/WHEEL +0 -0
@@ -1126,7 +1126,7 @@ class TestOptimizeSimple(CheckOptimize):
|
|
1126
1126
|
|
1127
1127
|
def test_minimize_l_bfgs_b(self):
|
1128
1128
|
# Minimize with L-BFGS-B method
|
1129
|
-
opts = {'
|
1129
|
+
opts = {'maxiter': self.maxiter}
|
1130
1130
|
r = optimize.minimize(self.func, self.startparams,
|
1131
1131
|
method='L-BFGS-B', jac=self.grad,
|
1132
1132
|
options=opts)
|
@@ -1156,7 +1156,7 @@ class TestOptimizeSimple(CheckOptimize):
|
|
1156
1156
|
# Check that the `ftol` parameter in l_bfgs_b works as expected
|
1157
1157
|
v0 = None
|
1158
1158
|
for tol in [1e-1, 1e-4, 1e-7, 1e-10]:
|
1159
|
-
opts = {'
|
1159
|
+
opts = {'maxiter': self.maxiter, 'ftol': tol}
|
1160
1160
|
sol = optimize.minimize(self.func, self.startparams,
|
1161
1161
|
method='L-BFGS-B', jac=self.grad,
|
1162
1162
|
options=opts)
|
@@ -1173,7 +1173,7 @@ class TestOptimizeSimple(CheckOptimize):
|
|
1173
1173
|
# check that the maxls is passed down to the Fortran routine
|
1174
1174
|
sol = optimize.minimize(optimize.rosen, np.array([-1.2, 1.0]),
|
1175
1175
|
method='L-BFGS-B', jac=optimize.rosen_der,
|
1176
|
-
options={'
|
1176
|
+
options={'maxls': 1})
|
1177
1177
|
assert not sol.success
|
1178
1178
|
|
1179
1179
|
def test_minimize_l_bfgs_b_maxfun_interruption(self):
|
scipy/signal/_filter_design.py
CHANGED
@@ -60,6 +60,17 @@ def _is_int_type(x):
|
|
60
60
|
return True
|
61
61
|
|
62
62
|
|
63
|
+
def _real_dtype_for_complex(dtyp, *, xp):
|
64
|
+
if xp.isdtype(dtyp, 'real floating'):
|
65
|
+
return dtyp
|
66
|
+
if dtyp == xp.complex64:
|
67
|
+
return xp.float32
|
68
|
+
elif dtyp == xp.complex128:
|
69
|
+
return xp.float64
|
70
|
+
else:
|
71
|
+
raise ValueError(f"Unknown dtype {dtyp}.")
|
72
|
+
|
73
|
+
|
63
74
|
# https://github.com/numpy/numpy/blob/v2.2.0/numpy/_core/function_base.py#L195-L302
|
64
75
|
def _logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, *, xp):
|
65
76
|
if not isinstance(base, float | int) and xp.asarray(base).ndim > 0:
|
@@ -488,6 +499,7 @@ def freqz(b, a=1, worN=512, whole=False, plot=None, fs=2*pi,
|
|
488
499
|
if xp.isdtype(a.dtype, 'integral'):
|
489
500
|
a = xp.astype(a, xp_default_dtype(xp))
|
490
501
|
res_dtype = xp.result_type(b, a)
|
502
|
+
real_dtype = _real_dtype_for_complex(res_dtype, xp=xp)
|
491
503
|
|
492
504
|
b = xpx.atleast_nd(b, ndim=1, xp=xp)
|
493
505
|
a = xpx.atleast_nd(a, ndim=1, xp=xp)
|
@@ -509,7 +521,7 @@ def freqz(b, a=1, worN=512, whole=False, plot=None, fs=2*pi,
|
|
509
521
|
# if include_nyquist is true and whole is false, w should
|
510
522
|
# include end point
|
511
523
|
w = xp.linspace(0, lastpoint, N,
|
512
|
-
endpoint=include_nyquist and not whole, dtype=
|
524
|
+
endpoint=include_nyquist and not whole, dtype=real_dtype)
|
513
525
|
n_fft = N if whole else 2 * (N - 1) if include_nyquist else 2 * N
|
514
526
|
if (xp_size(a) == 1 and (b.ndim == 1 or (b.shape[-1] == 1))
|
515
527
|
and n_fft >= b.shape[0]
|
@@ -834,7 +834,7 @@ def remez(numtaps, bands, desired, *, weight=None, type='bandpass',
|
|
834
834
|
xp = array_namespace(bands, desired, weight)
|
835
835
|
bands = np.asarray(bands)
|
836
836
|
desired = np.asarray(desired)
|
837
|
-
if weight:
|
837
|
+
if weight is not None:
|
838
838
|
weight = np.asarray(weight)
|
839
839
|
|
840
840
|
fs = _validate_fs(fs, allow_none=True)
|
Binary file
|
scipy/signal/_polyutils.py
CHANGED
@@ -117,7 +117,7 @@ def poly(seq_of_zeros, *, xp):
|
|
117
117
|
if xp.isdtype(a.dtype, 'complex floating'):
|
118
118
|
# if complex roots are all complex conjugates, the roots are real.
|
119
119
|
roots = xp.asarray(seq_of_zeros, dtype=xp.complex128)
|
120
|
-
if xp.all(
|
120
|
+
if xp.all(xp.sort(xp.imag(roots)) == xp.sort(xp.imag(xp.conj(roots)))):
|
121
121
|
a = xp.asarray(xp.real(a), copy=True)
|
122
122
|
|
123
123
|
return a
|
Binary file
|
Binary file
|
@@ -382,6 +382,19 @@ class TestTf2Sos:
|
|
382
382
|
sos2 = tf2sos(b, a, analog=analog)
|
383
383
|
assert_array_almost_equal(sos, sos2, decimal=4)
|
384
384
|
|
385
|
+
def test_gh_23221(self):
|
386
|
+
# Tests that this tf2sos call below does not produce ComplexWarnings
|
387
|
+
# This test is specific for scipy==1.16.0: later scipy versions do not produce
|
388
|
+
# the warning.
|
389
|
+
with suppress_warnings():
|
390
|
+
warnings.simplefilter("error")
|
391
|
+
tf2sos([0.21860986786301265, -0.4372197357260253, -0.2186098678630126,
|
392
|
+
0.8744394714520509, -0.21860986786301248, -0.4372197357260253,
|
393
|
+
0.21860986786301265],
|
394
|
+
[1., -4.18323041786553, 6.829924151626914, -5.407777865686045,
|
395
|
+
2.0773105450802336, -0.33482732571537893, 0.0186009178695853 ]
|
396
|
+
)
|
397
|
+
|
385
398
|
|
386
399
|
@skip_xp_backends(
|
387
400
|
cpu_only=True, reason="XXX zpk2sos is numpy-only", exceptions=['cupy']
|
@@ -754,6 +767,12 @@ class TestFreqz:
|
|
754
767
|
xp_assert_equal(w, xp.asarray([0. , 0.1]))
|
755
768
|
xp_assert_equal(h, xp.asarray([1.+0.j, 1.+0.j]))
|
756
769
|
|
770
|
+
def test_gh_23277(self):
|
771
|
+
# backwards compatibility: `w` array must be real, not complex
|
772
|
+
filt = [0.5 + 0.0j, 0.5 + 0.0j]
|
773
|
+
w, _ = freqz(filt, worN=8)
|
774
|
+
assert w.dtype == np.float64
|
775
|
+
|
757
776
|
def test_basic(self, xp):
|
758
777
|
w, h = freqz(xp.asarray([1.0]), worN=8)
|
759
778
|
assert_array_almost_equal(w, xp.pi * xp.arange(8, dtype=w.dtype) / 8.)
|
@@ -546,6 +546,11 @@ class TestRemez:
|
|
546
546
|
with pytest.raises(ValueError, match="Sampling.*single scalar"):
|
547
547
|
remez(11, .1, 1, fs=np.array([10, 20]))
|
548
548
|
|
549
|
+
def test_gh_23266(self, xp):
|
550
|
+
bands = xp.asarray([0.0, 0.2, 0.3, 0.5])
|
551
|
+
desired = xp.asarray([1.0, 0.0])
|
552
|
+
weight = xp.asarray([1.0, 2.0])
|
553
|
+
remez(21, bands, desired, weight=weight)
|
549
554
|
|
550
555
|
|
551
556
|
@skip_xp_backends(cpu_only=True, reason="lstsq")
|
@@ -1295,7 +1295,7 @@ class TestMedFilt:
|
|
1295
1295
|
# us into wrong memory if used (but it does not need to be used)
|
1296
1296
|
dummy = xp.arange(10, dtype=xp.float64)
|
1297
1297
|
a = dummy[5:6]
|
1298
|
-
a.strides
|
1298
|
+
a = np.lib.stride_tricks.as_strided(a, strides=(16,))
|
1299
1299
|
xp_assert_close(signal.medfilt(a, 1), xp.asarray([5.]))
|
1300
1300
|
|
1301
1301
|
@skip_xp_backends(
|
scipy/sparse/_base.py
CHANGED
@@ -494,7 +494,10 @@ class _spbase(SparseABC):
|
|
494
494
|
return self._mul_scalar(other)
|
495
495
|
|
496
496
|
if self.ndim < 3:
|
497
|
-
|
497
|
+
try:
|
498
|
+
return self._multiply_2d_with_broadcasting(other)
|
499
|
+
except AttributeError:
|
500
|
+
return self.tocsr()._multiply_2d_with_broadcasting(other)
|
498
501
|
|
499
502
|
if not (issparse(other) or isdense(other)):
|
500
503
|
# If it's a list or whatever, treat it like an array
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
scipy/sparse/tests/test_base.py
CHANGED
@@ -1624,6 +1624,9 @@ class _TestCommon:
|
|
1624
1624
|
B = array([[0,7,0],[0,-4,0]])
|
1625
1625
|
Asp = self.spcreator(A)
|
1626
1626
|
Bsp = self.spcreator(B)
|
1627
|
+
# check output format
|
1628
|
+
out_fmt = Asp.format if Asp.format in ('csc', 'dia', 'bsr') else 'csr'
|
1629
|
+
assert (Asp.multiply(Bsp)).format == out_fmt
|
1627
1630
|
assert_almost_equal(Asp.multiply(Bsp).toarray(), A*B) # sparse/sparse
|
1628
1631
|
assert_almost_equal(Asp.multiply(B).toarray(), A*B) # sparse/dense
|
1629
1632
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -935,23 +935,26 @@ class beta_gen(rv_continuous):
|
|
935
935
|
log_term = sum_ab*np.log1p(a/b) + np.log(b) - 2*np.log(sum_ab)
|
936
936
|
return t1 + t2 + log_term
|
937
937
|
|
938
|
-
def
|
939
|
-
if v == 1.0:
|
940
|
-
return 1000
|
941
|
-
|
942
|
-
j = np.log10(v)
|
943
|
-
digits = int(j)
|
944
|
-
d = int(v / 10 ** digits) + 2
|
945
|
-
return d*10**(7 + j)
|
946
|
-
|
947
|
-
if a >= 4.96e6 and b >= 4.96e6:
|
948
|
-
return asymptotic_ab_large(a, b)
|
949
|
-
elif a <= 4.9e6 and b - a >= 1e6 and b >= threshold_large(a):
|
950
|
-
return asymptotic_b_large(a, b)
|
951
|
-
elif b <= 4.9e6 and a - b >= 1e6 and a >= threshold_large(b):
|
938
|
+
def asymptotic_a_large(a, b):
|
952
939
|
return asymptotic_b_large(b, a)
|
953
|
-
|
954
|
-
|
940
|
+
|
941
|
+
def threshold_large(v):
|
942
|
+
j = np.floor(np.log10(v))
|
943
|
+
d = np.floor(v / 10 ** j) + 2
|
944
|
+
return xpx.apply_where(v != 1.0, (d, j), lambda d_, j_: d_ * 10**(7 + j_),
|
945
|
+
fill_value=1000)
|
946
|
+
|
947
|
+
threshold_a = threshold_large(a)
|
948
|
+
threshold_b = threshold_large(b)
|
949
|
+
return _lazyselect([(a >= 4.96e6) & (b >= 4.96e6),
|
950
|
+
(a <= 4.9e6) & (b - a >= 1e6) & (b >= threshold_a),
|
951
|
+
(b <= 4.9e6) & (a - b >= 1e6) & (a >= threshold_b),
|
952
|
+
(a < 4.9e6) & (b < 4.9e6)
|
953
|
+
],
|
954
|
+
[asymptotic_ab_large, asymptotic_b_large,
|
955
|
+
asymptotic_a_large, regular],
|
956
|
+
[a, b]
|
957
|
+
)
|
955
958
|
|
956
959
|
|
957
960
|
beta = beta_gen(a=0.0, b=1.0, name='beta')
|
@@ -5100,6 +5100,26 @@ class Mixture(_ProbabilityDistribution):
|
|
5100
5100
|
.. [1] Mixture distribution, *Wikipedia*,
|
5101
5101
|
https://en.wikipedia.org/wiki/Mixture_distribution
|
5102
5102
|
|
5103
|
+
|
5104
|
+
Examples
|
5105
|
+
--------
|
5106
|
+
A mixture of normal distributions:
|
5107
|
+
|
5108
|
+
>>> import numpy as np
|
5109
|
+
>>> from scipy import stats
|
5110
|
+
>>> import matplotlib.pyplot as plt
|
5111
|
+
>>> X1 = stats.Normal(mu=-2, sigma=1)
|
5112
|
+
>>> X2 = stats.Normal(mu=2, sigma=1)
|
5113
|
+
>>> mixture = stats.Mixture([X1, X2], weights=[0.4, 0.6])
|
5114
|
+
>>> print(f'mean: {mixture.mean():.2f}, '
|
5115
|
+
... f'median: {mixture.median():.2f}, '
|
5116
|
+
... f'mode: {mixture.mode():.2f}')
|
5117
|
+
mean: 0.40, median: 1.04, mode: 2.00
|
5118
|
+
>>> x = np.linspace(-10, 10, 300)
|
5119
|
+
>>> plt.plot(x, mixture.pdf(x))
|
5120
|
+
>>> plt.title('PDF of normal distribution mixture')
|
5121
|
+
>>> plt.show()
|
5122
|
+
|
5103
5123
|
"""
|
5104
5124
|
# Todo:
|
5105
5125
|
# Add support for array shapes, weights
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
scipy/stats/_resampling.py
CHANGED
@@ -942,7 +942,7 @@ def monte_carlo_test(data, rvs, statistic, *, vectorized=None,
|
|
942
942
|
for rvs_i, n_observations_i in zip(rvs, n_observations)]
|
943
943
|
null_distribution.append(statistic(*resamples, axis=-1))
|
944
944
|
null_distribution = xp.concat(null_distribution)
|
945
|
-
null_distribution = xp.reshape(null_distribution,
|
945
|
+
null_distribution = xp.reshape(null_distribution, (-1,) + (1,)*observed.ndim)
|
946
946
|
|
947
947
|
# relative tolerance for detecting numerically distinct but
|
948
948
|
# theoretically equal values in the null distribution
|
Binary file
|
Binary file
|
scipy/stats/_stats_py.py
CHANGED
@@ -10975,7 +10975,7 @@ def _xp_mean(x, /, *, axis=None, weights=None, keepdims=False, nan_policy='propa
|
|
10975
10975
|
for i in axes:
|
10976
10976
|
final_shape[i] = 1
|
10977
10977
|
|
10978
|
-
res = xp.reshape(res, final_shape)
|
10978
|
+
res = xp.reshape(res, tuple(final_shape))
|
10979
10979
|
|
10980
10980
|
return res[()] if res.ndim == 0 else res
|
10981
10981
|
|
Binary file
|
@@ -5003,6 +5003,19 @@ class TestBeta:
|
|
5003
5003
|
# return float(entropy)
|
5004
5004
|
assert_allclose(stats.beta(a, b).entropy(), ref, rtol=tol)
|
5005
5005
|
|
5006
|
+
def test_entropy_broadcasting(self):
|
5007
|
+
# gh-23127 reported that the entropy method of the beta
|
5008
|
+
# distribution did not broadcast correctly.
|
5009
|
+
Beta = stats.make_distribution(stats.beta)
|
5010
|
+
a = np.asarray([5e6, 100, 1e9, 10])
|
5011
|
+
b = np.asarray([5e6, 1e9, 100, 20])
|
5012
|
+
res = Beta(a=a, b=b).entropy()
|
5013
|
+
ref = np.asarray([Beta(a=a[0], b=b[0]).entropy(),
|
5014
|
+
Beta(a=a[1], b=b[1]).entropy(),
|
5015
|
+
Beta(a=a[2], b=b[2]).entropy(),
|
5016
|
+
Beta(a=a[3], b=b[3]).entropy()])
|
5017
|
+
assert_allclose(res, ref)
|
5018
|
+
|
5006
5019
|
|
5007
5020
|
class TestBetaPrime:
|
5008
5021
|
# the test values are used in test_cdf_gh_17631 / test_ppf_gh_17631
|
@@ -6,6 +6,7 @@ from numpy.testing import (assert_array_equal, assert_allclose,
|
|
6
6
|
from copy import deepcopy
|
7
7
|
from scipy.stats.sampling import FastGeneratorInversion
|
8
8
|
from scipy import stats
|
9
|
+
from scipy._lib._testutils import IS_MUSL
|
9
10
|
|
10
11
|
|
11
12
|
def test_bad_args():
|
@@ -142,6 +143,7 @@ def test_geninvgauss_uerror():
|
|
142
143
|
|
143
144
|
|
144
145
|
# TODO: add more distributions
|
146
|
+
@pytest.mark.skipif(IS_MUSL, reason="Hits RecursionError, see gh-23172")
|
145
147
|
@pytest.mark.fail_slow(5)
|
146
148
|
@pytest.mark.parametrize(("distname, args"), [("beta", (0.11, 0.11))])
|
147
149
|
def test_error_extreme_params(distname, args):
|
@@ -2053,13 +2053,13 @@ class TestBoxcox_llf:
|
|
2053
2053
|
def test_axis(self, xp):
|
2054
2054
|
data = xp.asarray([[100, 200], [300, 400]])
|
2055
2055
|
llf_axis_0 = stats.boxcox_llf(1, data, axis=0)
|
2056
|
-
llf_0 = xp.
|
2056
|
+
llf_0 = xp.stack([
|
2057
2057
|
stats.boxcox_llf(1, data[:, 0]),
|
2058
2058
|
stats.boxcox_llf(1, data[:, 1]),
|
2059
2059
|
])
|
2060
2060
|
xp_assert_close(llf_axis_0, llf_0)
|
2061
2061
|
llf_axis_1 = stats.boxcox_llf(1, data, axis=1)
|
2062
|
-
llf_1 = xp.
|
2062
|
+
llf_1 = xp.stack([
|
2063
2063
|
stats.boxcox_llf(1, data[0, :]),
|
2064
2064
|
stats.boxcox_llf(1, data[1, :]),
|
2065
2065
|
])
|
@@ -2732,11 +2732,11 @@ class TestCircFuncs:
|
|
2732
2732
|
|
2733
2733
|
res = circfunc(x, high=360, axis=1)
|
2734
2734
|
ref = [circfunc(x[i, :], high=360) for i in range(x.shape[0])]
|
2735
|
-
xp_assert_close(res, xp.
|
2735
|
+
xp_assert_close(res, xp.stack(ref))
|
2736
2736
|
|
2737
2737
|
res = circfunc(x, high=360, axis=0)
|
2738
2738
|
ref = [circfunc(x[:, i], high=360) for i in range(x.shape[1])]
|
2739
|
-
xp_assert_close(res, xp.
|
2739
|
+
xp_assert_close(res, xp.stack(ref))
|
2740
2740
|
|
2741
2741
|
@pytest.mark.parametrize("test_func,expected",
|
2742
2742
|
[(stats.circmean, 0.167690146),
|
scipy/version.py
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
"""
|
3
3
|
Module to expose more detailed version info for the installed `scipy`
|
4
4
|
"""
|
5
|
-
version = "1.16.
|
5
|
+
version = "1.16.1"
|
6
6
|
full_version = version
|
7
7
|
short_version = version.split('.dev')[0]
|
8
|
-
git_revision = "
|
8
|
+
git_revision = "0cf8e9541b1a2457992bf4ec2c0c669da373e497"
|
9
9
|
release = 'dev' not in version and '+' not in version
|
10
10
|
|
11
11
|
if not release:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: scipy
|
3
|
-
Version: 1.16.
|
3
|
+
Version: 1.16.1
|
4
4
|
Summary: Fundamental algorithms for scientific computing in Python
|
5
5
|
Maintainer-Email: SciPy Developers <scipy-dev@python.org>
|
6
6
|
License: Copyright (c) 2001-2002 Enthought, Inc. 2003, SciPy Developers.
|
@@ -948,6 +948,7 @@ Classifier: Programming Language :: Python :: 3
|
|
948
948
|
Classifier: Programming Language :: Python :: 3.11
|
949
949
|
Classifier: Programming Language :: Python :: 3.12
|
950
950
|
Classifier: Programming Language :: Python :: 3.13
|
951
|
+
Classifier: Programming Language :: Python :: 3.14
|
951
952
|
Classifier: Topic :: Software Development :: Libraries
|
952
953
|
Classifier: Topic :: Scientific/Engineering
|
953
954
|
Classifier: Operating System :: Microsoft :: Windows
|