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.
This PR contains the following updates:
1.14.1
->1.15.1
Release Notes
scipy/scipy (scipy)
v1.15.1
: SciPy 1.15.1Compare Source
SciPy 1.15.1 Release Notes
SciPy
1.15.1
is a bug-fix release with no new featurescompared to
1.15.0
. Importantly, an issue with theimport of
scipy.optimize
breaking other packageshas been fixed.
Authors
A total of 5 people contributed to this release.
People with a "+" by their names contributed a patch for the first time.
This list of names is automatically generated, and may not be fully complete.
v1.15.0
: SciPy 1.15.0Compare Source
SciPy 1.15.0 Release Notes
SciPy
1.15.0
is the culmination of6
months of hard work. It containsmany new features, numerous bug-fixes, improved test coverage and better
documentation. There have been a number of deprecations and API changes
in this release, which are documented below. All users are encouraged to
upgrade to this release, as there are a large number of bug-fixes and
optimizations. Before upgrading, we recommend that users check that
their own code does not use deprecated SciPy functionality (to do so,
run your code with
python -Wd
and check forDeprecationWarning
s).Our development attention will now shift to bug-fix releases on the
1.15.x branch, and on adding new features on the main branch.
This release requires Python
3.10-3.13
and NumPy1.23.5
or greater.Highlights of this release
Sparse arrays are now fully functional for 1-D and 2-D arrays. We recommend
that all new code use sparse arrays instead of sparse matrices and that
developers start to migrate their existing code from sparse matrix to sparse
array:
migration_to_sparray
. Bothsparse.linalg
andsparse.csgraph
work with either sparse matrix or sparse array and work internally with
sparse array.
Sparse arrays now provide basic support for n-D arrays in the COO format
including
add
,subtract
,reshape
,transpose
,matmul
,dot
,tensordot
and others. More functionality is coming in futurereleases.
Preliminary support for free-threaded Python 3.13.
New probability distribution features in
scipy.stats
can be used to improvethe speed and accuracy of existing continuous distributions and perform new
probability calculations.
Several new features support vectorized calculations with Python Array API
Standard compatible input (see "Array API Standard Support" below):
scipy.differentiate
is a new top-level submodule for accurateestimation of derivatives of black box functions.
scipy.optimize.elementwise
contains new functions for root-finding andminimization of univariate functions.
scipy.integrate
offers new functionscubature
,tanhsinh
, andnsum
for multivariate integration, univariate integration, andunivariate series summation, respectively.
scipy.interpolate.AAA
adds the AAA algorithm for barycentric rationalapproximation of real or complex functions.
scipy.special
adds new functions offering improved Legendre functionimplementations with a more consistent interface.
New features
scipy.differentiate
introductionThe new
scipy.differentiate
sub-package contains functions for accurateestimation of derivatives of black box functions.
scipy.differentiate.derivative
for first-order derivatives ofscalar-in, scalar-out functions.
scipy.differentiate.jacobian
for first-order partial derivatives ofvector-in, vector-out functions.
scipy.differentiate.hessian
for second-order partial derivatives ofvector-in, scalar-out functions.
All functions use high-order finite difference rules with adaptive (real)
step size. To facilitate batch computation, these functions are vectorized
and support several Array API compatible array libraries in addition to NumPy
(see "Array API Standard Support" below).
scipy.integrate
improvementsscipy.integrate.cubature
function supports multidimensionalintegration, and has support for approximating integrals with
one or more sets of infinite limits.
scipy.integrate.tanhsinh
is now exposed for public use, allowingevaluation of a convergent integral using tanh-sinh quadrature.
scipy.integrate.nsum
evaluates finite and infinite series and theirlogarithms.
scipy.integrate.lebedev_rule
computes abscissae and weights forintegration over the surface of a sphere.
QUADPACK
Fortran77 package has been ported to C.scipy.interpolate
improvementsscipy.interpolate.AAA
adds the AAA algorithm for barycentric rationalapproximation of real or complex functions.
scipy.interpolate.FloaterHormannInterpolator
adds barycentric rationalinterpolation.
scipy.interpolate.make_splrep
andscipy.interpolate.make_splprep
implement construction of smoothing splines.The algorithmic content is equivalent to FITPACK (
splrep
andsplprep
functions, and
*UnivariateSpline
classes) and the user API is consistentwith
make_interp_spline
: these functions receive data arrays and returna
scipy.interpolate.BSpline
instance.scipy.interpolate.generate_knots
implements theFITPACK strategy for selecting knots of a smoothing spline given the
smoothness parameter,
s
. The function exposes the internal logic of knotselection that
splrep
and*UnivariateSpline
was using.scipy.linalg
improvementsscipy.linalg.interpolative
Fortran77 code has been ported to Cython.scipy.linalg.solve
supports several new values for theassume_a
argument, enabling faster computation for diagonal, tri-diagonal, banded, and
triangular matrices. Also, when
assume_a
is left unspecified, thefunction now automatically detects and exploits diagonal, tri-diagonal,
and triangular structures.
scipy.linalg
matrix creation functions (scipy.linalg.circulant
,scipy.linalg.companion
,scipy.linalg.convolution_matrix
,scipy.linalg.fiedler
,scipy.linalg.fiedler_companion
, andscipy.linalg.leslie
) now support batchmatrix creation.
scipy.linalg.funm
is faster.scipy.linalg.orthogonal_procrustes
now supports complex input.scipy.linalg.lapack
:?lantr
,?sytrs
,?hetrs
,?trcon
,and
?gtcon
.scipy.linalg.expm
was rewritten in C.scipy.linalg.null_space
now accepts the new argumentsoverwrite_a
,check_finite
, andlapack_driver
.id_dist
Fortran code was rewritten in Cython.scipy.ndimage
improvementsaxes
argumentthat specifies which axes of the input filtering is to be performed on.
These include
correlate
,convolve
,generic_laplace
,laplace
,gaussian_laplace
,derivative2
,generic_gradient_magnitude
,gaussian_gradient_magnitude
andgeneric_filter
.axes
argument that specifies which axes of the input filtering is to be performed
on.
scipy.ndimage.rank_filter
time complexity has improved fromn
tolog(n)
.scipy.optimize
improvements1.4.0
to1.8.0
,bringing accuracy and performance improvements to solvers.
MINPACK
Fortran77 package has been ported to C.L-BFGS-B
Fortran77 package has been ported to C.scipy.optimize.elementwise
namespace includes functionsbracket_root
,find_root
,bracket_minimum
, andfind_minimum
for root-finding and minimization of univariate functions. To facilitate
batch computation, these functions are vectorized and support several
Array API compatible array libraries in addition to NumPy (see
"Array API Standard Support" below). Compared to existing functions (e.g.
scipy.optimize.root_scalar
andscipy.optimize.minimize_scalar
),these functions can offer speedups of over 100x when used with NumPy arrays,
and even greater gains are possible with other Array API Standard compatible
array libraries (e.g. CuPy).
scipy.optimize.differential_evolution
now supports more general use ofworkers
, such as passing a map-like callable.scipy.optimize.nnls
was rewritten in Cython.HessianUpdateStrategy
now supports__matmul__
.scipy.signal
improvementssignal.chirp()
.scipy.signal.lombscargle
has two new arguments,weights
andfloating_mean
, enabling sample weighting and removal of an unknowny-offset independently for each frequency. Additionally, the
normalize
argument includes a new option to return the complex representation of the
amplitude and phase.
scipy.signal.envelope
for computation of the envelope of areal or complex valued signal.
scipy.sparse
improvementsmoving from sparse.matrix to sparse.array in your code/library.
arrays are now fully functional for 1-D and 2D.
for basic arithmetic.
sparse.linalg.is_sptriangular
andsparse.linalg.spbandwidth
mimic the existing dense toolslinalg.is_triangular
andlinalg.bandwidth
.sparse.linalg
andsparse.csgraph
now work with sparse arrays. Becareful that your index arrays are 32-bit. We are working on 64bit support.
ARPACK
library has been upgraded to version3.9.1
.axis
argument forcount_nonzero
.incompatible data types, such as
float16
.min
,max
,argmin
, andargmax
now support computationover nonzero elements only via the new
explicit
argument.get_index_dtype
andsafely_cast_index_arrays
areavailable to facilitate index array casting in
sparse
.scipy.spatial
improvementsRotation.concatenate
now accepts a bareRotation
object, and willreturn a copy of it.
scipy.special
improvementsNew functions offering improved Legendre function implementations with a
more consistent interface. See respective docstrings for more information.
scipy.special.legendre_p
,scipy.special.legendre_p_all
scipy.special.assoc_legendre_p
,scipy.special.assoc_legendre_p_all
scipy.special.sph_harm_y
,scipy.special.sph_harm_y_all
scipy.special.sph_legendre_p
,scipy.special.sph_legendre_p_all
,The factorial functions
special.{factorial,factorial2,factorialk}
nowoffer an extension to the complex domain by passing the kwarg
extend='complex'
. This is opt-in because it changes the values fornegative inputs (which by default return 0), as well as for some integers
(in the case of
factorial2
andfactorialk
; for more details,check the respective docstrings).
scipy.special.zeta
now defines the Riemann zeta function on the complexplane.
scipy.special.softplus
computes the softplus functionThe spherical Bessel functions (
scipy.special.spherical_jn
,scipy.special.spherical_yn
,scipy.special.spherical_in
, andscipy.special.spherical_kn
) now support negative arguments with real dtype.scipy.special.logsumexp
now preserves precision when one element of thesum has magnitude much bigger than the rest.
The accuracy of several functions has been improved:
scipy.special.ncfdtr
,scipy.special.nctdtr
, andscipy.special.gdtrib
have been improved throughout the domain.scipy.special.hyperu
is improved for the case ofb=1
, smallx
,and small
a
.scipy.special.logit
is improved near the argumentp=0.5
.scipy.special.rel_entr
is improved whenx/y
overflows, underflows,or is close to
1
.scipy.special.ndtr
is now more efficient forsqrt(2)/2 < |x| < 1
.scipy.stats
improvementsA new probability distribution infrastructure has been added for the
implementation of univariate, continuous distributions. It has several
speed, accuracy, memory, and interface advantages compared to the
previous infrastructure. See
rv_infrastructure
for a tutorial.scipy.stats.make_distribution
to treat an existing continuousdistribution (e.g.
scipy.stats.norm
) with the new infrastructure.This can improve the speed and accuracy of existing distributions,
especially those with methods not overridden with distribution-specific
formulas.
scipy.stats.Normal
andscipy.stats.Uniform
are pre-defined classesto represent the normal and uniform distributions, respectively.
Their interfaces may be faster and more convenient than those produced by
make_distribution
.scipy.stats.Mixture
can be used to represent mixture distributions.Instances of
scipy.stats.Normal
,scipy.stats.Uniform
, and the classesreturned by
scipy.stats.make_distribution
are supported by several newmathematical transformations.
scipy.stats.truncate
for truncation of the support.scipy.stats.order_statistic
for the order statistics of a given numberof IID random variables.
scipy.stats.abs
,scipy.stats.exp
, andscipy.stats.log
. For example,scipy.stats.abs(Normal())
is distributed according to the folded normaland
scipy.stats.exp(Normal())
is lognormally distributed.The new
scipy.stats.lmoment
calculates sample l-moments and l-momentratios. Notably, these sample estimators are unbiased.
scipy.stats.chatterjeexi
computes the Xi correlation coefficient, whichcan detect nonlinear dependence. The function also performs a hypothesis
test of independence between samples.
scipy.stats.wilcoxon
has improved method resolution logic for the defaultmethod='auto'
. Other values ofmethod
provided by the user are nowrespected in all cases, and the method argument
approx
has beenrenamed to
asymptotic
for consistency with similar functions. (Use ofapprox
is still allowed for backward compatibility.)There are several new probability distributions:
scipy.stats.dpareto_lognorm
represents the double Pareto lognormaldistribution.
scipy.stats.landau
represents the Landau distribution.scipy.stats.normal_inverse_gamma
represents the normal-inverse-gammadistribution.
scipy.stats.poisson_binom
represents the Poisson binomial distribution.Batch calculation with
scipy.stats.alexandergovern
andscipy.stats.combine_pvalues
is faster.scipy.stats.chisquare
added an argumentsum_check
. By default, thefunction raises an error when the sum of expected and obseved frequencies
are not equal; setting
sum_check=False
disables this check tofacilitate hypothesis tests other than Pearson's chi-squared test.
The accuracy of several distribution methods has been improved, including:
scipy.stats.nct
methodpdf
scipy.stats.crystalball
methodsf
scipy.stats.geom
methodrvs
scipy.stats.cauchy
methodslogpdf
,pdf
,ppf
andisf
logcdf
and/orlogsf
methods of distributions that do notoverride the generic implementation of these methods, including
scipy.stats.beta
,scipy.stats.betaprime
,scipy.stats.cauchy
,scipy.stats.chi
,scipy.stats.chi2
,scipy.stats.exponweib
,scipy.stats.gamma
,scipy.stats.gompertz
,scipy.stats.halflogistic
,scipy.stats.hypsecant
,scipy.stats.invgamma
,scipy.stats.laplace
,scipy.stats.levy
,scipy.stats.loggamma
,scipy.stats.maxwell
,scipy.stats.nakagami
, andscipy.stats.t
.scipy.stats.qmc.PoissonDisk
now accepts lower and upper boundsparameters
l_bounds
andu_bounds
.scipy.stats.fisher_exact
now supports two-dimensional tables with shapesother than
(2, 2)
.Preliminary Support for Free-Threaded CPython 3.13
SciPy
1.15
has preliminary support for the free-threaded build of CPython3.13.
This allows SciPy functionality to execute in parallel with Pythonthreads
(see the
threading
stdlib module). This support was enabled by fixing asignificant number of thread-safety issues in both pure Python and
C/C++/Cython/Fortran extension modules. Wheels are provided on PyPI for this
release; NumPy
>=2.1.3
is required at runtime. Note that building for afree-threaded interpreter requires a recent pre-release or nightly for Cython
3.1.0
.Support for free-threaded Python does not mean that SciPy is fully thread-safe.
Please see
scipy_thread_safety
for more details.If you are interested in free-threaded Python, for example because you have a
multiprocessing-based workflow that you are interested in running with Python
threads, we encourage testing and experimentation. If you run into problems
that you suspect are because of SciPy, please open an issue, checking first if
the bug also occurs in the "regular" non-free-threaded CPython
3.13
build.Many threading bugs can also occur in code that releases the GIL; disabling
the GIL only makes it easier to hit threading bugs.
Array API Standard Support
Experimental support for array libraries other than NumPy has been added to
existing sub-packages in recent versions of SciPy. Please consider testing
these features by setting an environment variable
SCIPY_ARRAY_API=1
andproviding PyTorch, JAX, ndonnx, or CuPy arrays as array arguments. Features
with support added for SciPy
1.15.0
include:scipy.differentiate
(new sub-package)scipy.optimize.elementwise
(new namespace)scipy.optimize.rosen
,scipy.optimize.rosen_der
, andscipy.optimize.rosen_hess
scipy.special.logsumexp
scipy.integrate.trapezoid
scipy.integrate.tanhsinh
(newly public function)scipy.integrate.cubature
(new function)scipy.integrate.nsum
(new function)scipy.special.chdtr
,scipy.special.betainc
, andscipy.special.betaincc
scipy.stats.boxcox_llf
scipy.stats.differential_entropy
scipy.stats.zmap
,scipy.stats.zscore
, andscipy.stats.gzscore
scipy.stats.tmean
,scipy.stats.tvar
,scipy.stats.tstd
,scipy.stats.tsem
,scipy.stats.tmin
, andscipy.stats.tmax
scipy.stats.gmean
,scipy.stats.hmean
andscipy.stats.pmean
scipy.stats.combine_pvalues
scipy.stats.ttest_ind
,scipy.stats.ttest_rel
scipy.stats.directional_stats
scipy.ndimage
functions will now delegate tocupyx.scipy.ndimage
,and for other backends will transit via NumPy arrays on the host.
Deprecated features and future changes
scipy.linalg.interpolative.rand
andscipy.linalg.interpolative.seed
have been deprecated and will be removedin SciPy
1.17.0
.scipy.spatial.distance.cosine
andscipy.spatial.distance.correlation
have been deprecated and will raisean error in SciPy
1.17.0
.scipy.spatial.distance.kulczynski1
andscipy.spatial.distance.sokalmichener
were deprecated and will be removedin SciPy
1.17.0
.scipy.stats.find_repeats
is deprecated and will beremoved in SciPy
1.17.0
. Please usenumpy.unique
/numpy.unique_counts
instead.scipy.linalg.kron
is deprecated in favour ofnumpy.kron
.scipy.signal
convolution/correlation functions (
scipy.signal.correlate
,scipy.signal.convolve
andscipy.signal.choose_conv_method
) andfiltering functions (
scipy.signal.lfilter
,scipy.signal.sosfilt
) hasbeen deprecated and will be removed in SciPy
1.17.0
.scipy.stats.linregress
has deprecated one-argument use; the twovariables must be specified as separate arguments.
scipy.stats.trapz
is deprecated in favor ofscipy.stats.trapezoid
.scipy.special.lpn
is deprecated in favor ofscipy.special.legendre_p_all
.scipy.special.lpmn
andscipy.special.clpmn
are deprecated in favor ofscipy.special.assoc_legendre_p_all
.scipy.special.sph_harm
has been deprecated in favor ofscipy.special.sph_harm_y
.r
andc
arrays passed toscipy.linalg.toeplitz
,scipy.linalg.matmul_toeplitz
, orscipy.linalg.solve_toeplitz
will betreated as batches of 1-D coefficients beginning in SciPy
1.17.0
.random_state
andpermutations
arguments ofscipy.stats.ttest_ind
are deprecated. Usemethod
to perform apermutation test, instead.
Expired Deprecations
scipy.signal
have been removed. This includesdaub
,qmf
,cascade
,morlet
,morlet2
,ricker
,and
cwt
. Users should usepywavelets
instead.scipy.signal.cmplx_sort
has been removed.scipy.integrate.quadrature
andscipy.integrate.romberg
have beenremoved in favour of
scipy.integrate.quad
.scipy.stats.rvs_ratio_uniforms
has been removed in favor ofscipy.stats.sampling.RatioUniforms
.scipy.special.factorial
now raises an error for non-integer scalars whenexact=True
.scipy.integrate.cumulative_trapezoid
now raises an error for values ofinitial
other than0
andNone
.scipy.interpolate.Akima1DInterpolator
and
scipy.interpolate.PchipInterpolator
special.btdtr
andspecial.btdtri
have been removed.exact=
kwarg inspecial.factorialk
has changedfrom
True
toFalse
.scipy.misc
submodule have been removed.Backwards incompatible changes
interpolate.BSpline.integrate
output is now always a numpy array.Previously, for 1D splines the output was a python float or a 0D array
depending on the value of the
extrapolate
argument.scipy.stats.wilcoxon
now respects themethod
argument provided by theuser. Previously, even if
method='exact'
was specified, the functionwould resort to
method='approx'
in some cases.scipy.integrate.AccuracyWarning
has been removed as the functions thewarning was emitted from (
scipy.integrate.quadrature
andscipy.integrate.romberg
) have been removed.Other changes
A separate accompanying type stubs package,
scipy-stubs
, will be madeavailable with the
1.15.0
release. Installation instructions areavailable.
scipy.stats.bootstrap
now emits aFutureWarning
if the shapes of theinput arrays do not agree. Broadcast the arrays to the same batch shape
(i.e. for all dimensions except those specified by the
axis
argument)to avoid the warning. Broadcasting will be performed automatically in the
future.
SciPy endorsed SPEC-7,
which proposes a
rng
argument to control pseudorandom number generation(PRNG) in a standard way, replacing legacy arguments like
seed
andrandom_sate
. In many cases, use ofrng
will change the behavior ofthe function unless the argument is already an instance of
numpy.random.Generator
.Effective in SciPy
1.15.0
:rng
argument has been added to the following functions:scipy.cluster.vq.kmeans
,scipy.cluster.vq.kmeans2
,scipy.interpolate.BarycentricInterpolator
,scipy.interpolate.barycentric_interpolate
,scipy.linalg.clarkson_woodruff_transform
,scipy.optimize.basinhopping
,scipy.optimize.differential_evolution
,scipy.optimize.dual_annealing
,scipy.optimize.check_grad
,scipy.optimize.quadratic_assignment
,scipy.sparse.random
,scipy.sparse.random_array
,scipy.sparse.rand
,scipy.sparse.linalg.svds
,scipy.spatial.transform.Rotation.random
,scipy.spatial.distance.directed_hausdorff
,scipy.stats.goodness_of_fit
,scipy.stats.BootstrapMethod
,scipy.stats.PermutationMethod
,scipy.stats.bootstrap
,scipy.stats.permutation_test
,scipy.stats.dunnett
, allscipy.stats.qmc
classes that consume random numbers, andscipy.stats.sobol_indices
.rng
argument will follow the SPEC 7standard behavior: the argument will be normalized with
np.random.default_rng
before being used.will remain unchanged (for now).
It is planned that in
1.17.0
the legacy argument will start emittingwarnings, and that in
1.19.0
the default behavior will change.In all cases, users can avoid future disruption by proactively passing
an instance of
np.random.Generator
by keywordrng
. For details,see SPEC-7.
The SciPy build no longer adds
-std=legacy
for Fortran code,except when using Gfortran. This avoids problems with the new Flang and
AMD Fortran compilers. It may make new build warnings appear for other
compilers - if so, please file an issue.
scipy.signal.sosfreqz
has been renamed toscipy.signal.freqz_sos
.New code should use the new name. The old name is maintained as an alias for
backwards compatibility.
Testing thread-safety improvements related to Python
3.13t
have beenmade in:
scipy.special
,scipy.spatial
,scipy.sparse
,scipy.interpolate
.Authors (commits)
A total of 149 people contributed to this release.
People with a "+" by their names contributed a patch for the first time.
This list of names is automatically generated, and may not be fully complete.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.