SciPy library main repository
Note: SciPy 1.9.0
is not released yet!
SciPy 1.9.0
is the culmination of 6 months of hard work. It contains
many 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 for DeprecationWarning
s).
Our development attention will now shift to bug-fix releases on the
1.9.x branch, and on adding new features on the main branch.
This release requires Python 3.8-3.11
and NumPy 1.18.5
or greater.
For running on PyPy, PyPy3 6.0+
is required.
meson
, substantially improving
our build performance, and providing better build-time configuration and
cross-compilation support,scipy.optimize.milp
, new function for mixed-integer linear
programming,scipy.stats.fit
for fitting discrete and continuous distributions
to data,scipy.interpolate.RegularGridInterpolator
,scipy.optimize.direct
.scipy.interpolate
improvementsRBFInterpolator
evaluation with high dimensional
interpolants.scipy.interpolate.RegularGridInterpolator
and its tutorial.scipy.interpolate.RegularGridInterpolator
and scipy.interpolate.interpn
now accept descending ordered points.RegularGridInterpolator
now handles length-1 grid axes.BivariateSpline
subclasses have a new method partial_derivative
which constructs a new spline object representing a derivative of an
original spline. This mirrors the corresponding functionality for univariate
splines, splder
and BSpline.derivative
, and can substantially speed
up repeated evaluation of derivatives.scipy.linalg
improvementsscipy.linalg.expm
now accepts nD arrays. Its speed is also improved.3.7.1
.scipy.fft
improvementsuarray
multimethods for scipy.fft.fht
and scipy.fft.ifht
to allow provision of third party backend implementations such as those
recently added to CuPy.scipy.optimize
improvementsA new global optimizer, scipy.optimize.direct
(DIviding RECTangles algorithm)
was added. For problems with inexpensive function evaluations, like the ones
in the SciPy benchmark suite, direct
is competitive with the best other
solvers in SciPy (dual_annealing
and differential_evolution
) in terms
of execution time. See
gh-14300 <https://github.com/scipy/scipy/pull/14300>
__ for more details.
Add a full_output
parameter to scipy.optimize.curve_fit
to output
additional solution information.
Add a integrality
parameter to scipy.optimize.differential_evolution
,
enabling integer constraints on parameters.
Add a vectorized
parameter to call a vectorized objective function only
once per iteration. This can improve minimization speed by reducing
interpreter overhead from the multiple objective function calls.
The default method of scipy.optimize.linprog
is now 'highs'
.
Added scipy.optimize.milp
, new function for mixed-integer linear
programming.
Added Newton-TFQMR method to newton_krylov
.
Added support for the Bounds
class in shgo
and dual_annealing
for
a more uniform API across scipy.optimize
.
Added the vectorized
keyword to differential_evolution
.
approx_fprime
now works with vector-valued functions.
scipy.signal
improvementsscipy.signal.windows.kaiser_bessel_derived
was
added to compute the Kaiser-Bessel derived window.hilbert
operations are now faster as a result of more
consistent dtype
handling.scipy.sparse
improvementscopy
parameter to scipy.sparce.csgraph.laplacian
. Using inplace
computation with copy=False
reduces the memory footprint.dtype
parameter to scipy.sparce.csgraph.laplacian
for type casting.symmetrized
parameter to scipy.sparce.csgraph.laplacian
to produce
symmetric Laplacian for directed graphs.form
parameter to scipy.sparce.csgraph.laplacian
taking one of the
three values: array
, or function
, or lo
determining the format of
the output Laplacian:
array
is a numpy array (backward compatible default);function
is a pointer to a lambda-function evaluating the
Laplacian-vector or Laplacian-matrix product;lo
results in the format of the LinearOperator
.scipy.sparse.linalg
improvementslobpcg
performance improvements for small input cases.scipy.spatial
improvementsorder
parameter to scipy.spatial.transform.Rotation.from_quat
and scipy.spatial.transform.Rotation.as_quat
to specify quaternion format.scipy.stats
improvementsscipy.stats.monte_carlo_test
performs one-sample Monte Carlo hypothesis
tests to assess whether a sample was drawn from a given distribution. Besides
reproducing the results of hypothesis tests like scipy.stats.ks_1samp
,
scipy.stats.normaltest
, and scipy.stats.cramervonmises
without small sample
size limitations, it makes it possible to perform similar tests using arbitrary
statistics and distributions.
Several scipy.stats
functions support new axis
(integer or tuple of
integers) and nan_policy
('raise', 'omit', or 'propagate'), and
keepdims
arguments.
These functions also support masked arrays as inputs, even if they do not have
a scipy.stats.mstats
counterpart. Edge cases for multidimensional arrays,
such as when axis-slices have no unmasked elements or entire inputs are of
size zero, are handled consistently.
Add a weight
parameter to scipy.stats.hmean
.
Several improvements have been made to scipy.stats.levy_stable
. Substantial
improvement has been made for numerical evaluation of the pdf and cdf,
resolving #12658 and
#14944. The improvement is
particularly dramatic for stability parameter alpha
close to or equal to 1
and for alpha
below but approaching its maximum value of 2. The alternative
fast Fourier transform based method for pdf calculation has also been updated
to use the approach of Wang and Zhang from their 2008 conference paper
Simpson’s rule based FFT method to compute densities of stable distribution,
making this method more competitive with the default method. In addition,
users now have the option to change the parametrization of the Levy Stable
distribution to Nolan's "S0" parametrization which is used internally by
SciPy's pdf and cdf implementations. The "S0" parametrization is described in
Nolan's paper Numerical calculation of stable densities and distribution
functions upon which SciPy's
implementation is based. "S0" has the advantage that delta
and gamma
are proper location and scale parameters. With delta
and gamma
fixed,
the location and scale of the resulting distribution remain unchanged as
alpha
and beta
change. This is not the case for the default "S1"
parametrization. Finally, more options have been exposed to allow users to
trade off between runtime and accuracy for both the default and FFT methods of
pdf and cdf calculation. More information can be found in the documentation
here (to be linked).
Added scipy.stats.fit
for fitting discrete and continuous distributions to
data.
The methods "pearson"
and "tippet"
from scipy.stats.combine_pvalues
have been fixed to return the correct p-values, resolving
#15373. In addition, the
documentation for scipy.stats.combine_pvalues
has been expanded and improved.
Unlike other reduction functions, stats.mode
didn't consume the axis
being operated on and failed for negative axis inputs. Both the bugs have been
fixed. Note that stats.mode
will now consume the input axis and return an
ndarray with the axis
dimension removed.
Replaced implementation of scipy.stats.ncf
with the implementation from
Boost for improved reliability.
Add a bits
parameter to scipy.stats.qmc.Sobol
. It allows to use from 0
to 64 bits to compute the sequence. Default is None
which corresponds to
30 for backward compatibility. Using a higher value allow to sample more
points. Note: bits
does not affect the output dtype.
Add a integers
method to scipy.stats.qmc.QMCEngine
. It allows sampling
integers using any QMC sampler.
Improved the fit speed and accuracy of stats.pareto
.
Added qrvs
method to NumericalInversePolynomial
to match the
situation for NumericalInverseHermite
.
Faster random variate generation for gennorm
and nakagami
.
lloyd_centroidal_voronoi_tessellation
has been added to allow improved
sample distributions via iterative application of Voronoi diagrams and
centering operations
Add scipy.stats.qmc.PoissonDisk
to sample using the Poisson disk sampling
method. It guarantees that samples are separated from each other by a
given radius
.
Add scipy.stats.pmean
to calculate the weighted power mean also called
generalized mean.
n
of several distributions,
use of the distribution moment
method with keyword argument n
is
deprecated. Keyword n
is replaced with keyword order
.interval
method with keyword arguments
alpha
is deprecated. Keyword alpha
is replaced with keyword
confidence
.'simplex'
, 'revised simplex'
, and 'interior-point'
methods
of scipy.optimize.linprog
are deprecated. Methods highs
, highs-ds
,
or highs-ipm
should be used in new code.stats.mode
.
pandas.DataFrame.mode
can be used instead.spatial.distance.kulsinski
has been deprecated in favor
of spatial.distance.kulczynski1
.maxiter
keyword of the truncated Newton (TNC) algorithm has been
deprecated in favour of maxfun
.vertices
keyword of Delauney.qhull
now raises a
DeprecationWarning, after having been deprecated in documentation only
for a long time.extradoc
keyword of rv_continuous
, rv_discrete
and
rv_sample
now raises a DeprecationWarning, after having been deprecated in
documentation only for a long time.There is an ongoing effort to follow through on long-standing deprecations. The following previously deprecated features are affected:
radius=None
to scipy.spatial.SphericalVoronoi
now raises an
error (not adding radius
defaults to 1, as before).ndim > 1
._rvs
method of statistical distributions now requires a size
parameter.fillvalue
that cannot be cast to the output type in
scipy.signal.convolve2d
now raises an error.scipy.spatial.distance
now enforces that the input vectors are
one-dimensional.stats.itemfreq
.stats.median_absolute_deviation
.n_jobs
keyword argument and use of k=None
from
kdtree.query
.right
keyword from interpolate.PPoly.extend
.debug
keyword from scipy.linalg.solve_*
._ppform
scipy.interpolate
.matvec
and matmat
.mlab
truncation mode from cluster.dendrogram
.cluster.vq.py_vq2
.ftol
and xtol
from
optimize.minimize(method='Nelder-Mead')
.signal.windows.hanning
.gegv
functions from linalg
; this raises the minimally
required LAPACK version to 3.7.1.spatial.distance.matching
.scipy.random
for numpy.random
.scipy.misc
(docformat
,
inherit_docstring_from
, extend_notes_in_docstring
,
replace_notes_in_docstring
, indentcount_lines
, filldoc
,
unindent_dict
, unindent_string
).linalg.pinv2
.scipy.stats
functions now convert np.matrix
to np.ndarray
s
before the calculation is performed. In this case, the output will be a scalar
or np.ndarray
of appropriate shape rather than a 2D np.matrix
.
Similarly, while masked elements of masked arrays are still ignored, the
output will be a scalar or np.ndarray
rather than a masked array with
mask=False
.scipy.optimize.linprog
is now 'highs'
, not
'interior-point'
(which is now deprecated), so callback functions and
some options are no longer supported with the default method. With the
default method, the x
attribute of the returned OptimizeResult
is
now None
(instead of a non-optimal array) when an optimal solution
cannot be found (e.g. infeasible problem).scipy.stats.combine_pvalues
, the sign of the test statistic returned
for the method "pearson"
has been flipped so that higher values of the
statistic now correspond to lower p-values, making the statistic more
consistent with those of the other methods and with the majority of the
literature.scipy.linalg.expm
due to historical reasons was using the sparse
implementation and thus was accepting sparse arrays. Now it only works with
nDarrays. For sparse usage, scipy.sparse.linalg.expm
needs to be used
explicitly.scipy.stats.circvar
has reverted to the one that is
standard in the literature; note that this is not the same as the square of
scipy.stats.circstd
.QMCEngine
in MultinomialQMC
and
MultivariateNormalQMC
. It removes the methods fast_forward
and reset
.MultinomialQMC
now require the number of trials with n_trials
.
Hence, MultinomialQMC.random
output has now the correct shape (n, pvals)
.F_onewayConstantInputWarning
,
F_onewayBadInputSizesWarning
, PearsonRConstantInputWarning
,
PearsonRNearConstantInputWarning
, SpearmanRConstantInputWarning
, and
BootstrapDegenerateDistributionWarning
) have been replaced with more
general warnings.A draft developer CLI is available for SciPy, leveraging the doit
,
click
and rich-click
tools. For more details, see
gh-15959.
The SciPy contributor guide has been reorganized and updated (see #15947 for details).
QUADPACK Fortran routines in scipy.integrate
, which power
scipy.integrate.quad
, have been marked as recursive
. This should fix rare
issues in multivariate integration (nquad
and friends) and obviate the need
for compiler-specific compile flags (/recursive
for ifort etc). Please file
an issue if this change turns out problematic for you. This is also true for
FITPACK
routines in scipy.interpolate
, which power splrep
,
splev
etc., and *UnivariateSpline
and *BivariateSpline
classes.
the USE_PROPACK
environment variable has been renamed to
SCIPY_USE_PROPACK
; setting to a non-zero value will enable
the usage of the PROPACK
library as before
Building SciPy on windows with MSVC now requires at least the vc142 toolset (available in Visual Studio 2019 and higher).
Before this release, all subpackages of SciPy (cluster
, fft
, ndimage
,
etc.) had to be explicitly imported. Now, these subpackages are lazily loaded
as soon as they are accessed, so that the following is possible (if desired
for interactive use, it's not actually recommended for code,
see :ref:scipy-api
):
import scipy as sp; sp.fft.dct([1, 2, 3])
. Advantages include: making it
easier to navigate SciPy in interactive terminals, reducing subpackage import
conflicts (which before required
import networkx.linalg as nla; import scipy.linalg as sla
),
and avoiding repeatedly having to update imports during teaching &
experimentation. Also see
the related community specification document.
This is the first release that ships with Meson as
the build system. When installing with pip
or pypa/build
, Meson will be
used (invoked via the meson-python
build hook). This change brings
significant benefits - most importantly much faster build times, but also
better support for cross-compilation and cleaner build logs.
Note:
This release still ships with support for numpy.distutils
-based builds
as well. Those can be invoked through the setup.py
command-line
interface (e.g., python setup.py install
). It is planned to remove
numpy.distutils
support before the 1.10.0 release.
When building from source, a number of things have changed compared to building
with numpy.distutils
:
meson
, ninja
, and pkg-config
.
setuptools
and wheel
are no longer needed.pkg-config
instead of hardcoded
paths or a site.cfg
file.blas-lapack-selection
for
details.The two CLIs that can be used to build wheels are pip
and build
. In
addition, the SciPy repo contains a python dev.py
CLI for any kind of
development task (see its --help
for details). For a comparison between old
(distutils
) and new (meson
) build commands, see :ref:meson-faq
.
For more information on the introduction of Meson support in SciPy, see
gh-13615 <https://github.com/scipy/scipy/issues/13615>
__ and
this blog post <https://labs.quansight.org/blog/2021/07/moving-scipy-to-meson/>
__.
A total of 155 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.
Note: SciPy 1.9.0
is not released yet!
SciPy 1.9.0
is the culmination of 6 months of hard work. It contains
many 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 for DeprecationWarning
s).
Our development attention will now shift to bug-fix releases on the
1.9.x branch, and on adding new features on the main branch.
This release requires Python 3.8+
and NumPy 1.18.5
or greater.
For running on PyPy, PyPy3 6.0+
is required.
meson
, substantially reducing
our source build timesscipy.optimize.milp
, new function for mixed-integer linear
programming.scipy.stats.fit
for fitting discrete and continuous distributions
to data.scipy.interpolate.RegularGridInterpolator
.scipy.optimize.direct
scipy.interpolate
improvementsRBFInterpolator
evaluation with high dimensional
interpolants.scipy.interpolate.RegularGridInterpolator
and its tutorial.scipy.interpolate.RegularGridInterpolator
and scipy.interpolate.interpn
now accept descending ordered points.RegularGridInterpolator
now handles length-1 grid axes.BivariateSpline
subclasses have a new method partial_derivative
which constructs a new spline object representing a derivative of an
original spline. This mirrors the corresponding functionality for univariate
splines, splder
and BSpline.derivative
, and can substantially speed
up repeated evaluation of derivatives.scipy.linalg
improvementsscipy.linalg.expm
now accepts nD arrays. Its speed is also improved.3.7.1
.scipy.fft
improvementsuarray
multimethods for scipy.fft.fht
and scipy.fft.ifht
to allow provision of third party backend implementations such as those
recently added to CuPy.scipy.optimize
improvementsA new global optimizer, scipy.optimize.direct
(DIviding RECTangles algorithm)
was added. For problems with inexpensive function evaluations, like the ones
in the SciPy benchmark suite, direct
is competitive with the best other
solvers in SciPy (dual_annealing
and differential_evolution
) in terms
of execution time. See
gh-14300 <https://github.com/scipy/scipy/pull/14300>
__ for more details.
Add a full_output
parameter to scipy.optimize.curve_fit
to output
additional solution information.
Add a integrality
parameter to scipy.optimize.differential_evolution
,
enabling integer constraints on parameters.
Add a vectorized
parameter to call a vectorized objective function only
once per iteration. This can improve minimization speed by reducing
interpreter overhead from the multiple objective function calls.
The default method of scipy.optimize.linprog
is now 'highs'
.
Added scipy.optimize.milp
, new function for mixed-integer linear
programming.
Added Newton-TFQMR method to newton_krylov
.
Added support for the Bounds
class in shgo
and dual_annealing
for
a more uniform API across scipy.optimize
.
Added the vectorized
keyword to differential_evolution
.
approx_fprime
now works with vector-valued functions.
scipy.signal
improvementsscipy.signal.windows.kaiser_bessel_derived
was
added to compute the Kaiser-Bessel derived window.hilbert
operations are now faster as a result of more
consistent dtype
handling.scipy.sparse
improvementscopy
parameter to scipy.sparce.csgraph.laplacian
. Using inplace
computation with copy=False
reduces the memory footprint.dtype
parameter to scipy.sparce.csgraph.laplacian
for type casting.symmetrized
parameter to scipy.sparce.csgraph.laplacian
to produce
symmetric Laplacian for directed graphs.form
parameter to scipy.sparce.csgraph.laplacian
taking one of the
three values: array
, or function
, or lo
determining the format of
the output Laplacian:
array
is a numpy array (backward compatible default);function
is a pointer to a lambda-function evaluating the
Laplacian-vector or Laplacian-matrix product;lo
results in the format of the LinearOperator
.scipy.sparse.linalg
improvementslobpcg
performance improvements for small input cases.scipy.spatial
improvementsorder
parameter to scipy.spatial.transform.Rotation.from_quat
and scipy.spatial.transform.Rotation.as_quat
to specify quaternion format.scipy.stats
improvementsscipy.stats.monte_carlo_test
performs one-sample Monte Carlo hypothesis
tests to assess whether a sample was drawn from a given distribution. Besides
reproducing the results of hypothesis tests like scipy.stats.ks_1samp
,
scipy.stats.normaltest
, and scipy.stats.cramervonmises
without small sample
size limitations, it makes it possible to perform similar tests using arbitrary
statistics and distributions.
Several scipy.stats
functions support new axis
(integer or tuple of
integers) and nan_policy
('raise', 'omit', or 'propagate'), and
keepdims
arguments.
These functions also support masked arrays as inputs, even if they do not have
a scipy.stats.mstats
counterpart. Edge cases for multidimensional arrays,
such as when axis-slices have no unmasked elements or entire inputs are of
size zero, are handled consistently.
Add a weight
parameter to scipy.stats.hmean
.
Several improvements have been made to scipy.stats.levy_stable
. Substantial
improvement has been made for numerical evaluation of the pdf and cdf,
resolving #12658 and
#14944. The improvement is
particularly dramatic for stability parameter alpha
close to or equal to 1
and for alpha
below but approaching its maximum value of 2. The alternative
fast Fourier transform based method for pdf calculation has also been updated
to use the approach of Wang and Zhang from their 2008 conference paper
Simpson’s rule based FFT method to compute densities of stable distribution,
making this method more competitive with the default method. In addition,
users now have the option to change the parametrization of the Levy Stable
distribution to Nolan's "S0" parametrization which is used internally by
SciPy's pdf and cdf implementations. The "S0" parametrization is described in
Nolan's paper Numerical calculation of stable densities and distribution
functions upon which SciPy's
implementation is based. "S0" has the advantage that delta
and gamma
are proper location and scale parameters. With delta
and gamma
fixed,
the location and scale of the resulting distribution remain unchanged as
alpha
and beta
change. This is not the case for the default "S1"
parametrization. Finally, more options have been exposed to allow users to
trade off between runtime and accuracy for both the default and FFT methods of
pdf and cdf calculation. More information can be found in the documentation
here (to be linked).
Added scipy.stats.fit
for fitting discrete and continuous distributions to
data.
The methods "pearson"
and "tippet"
from scipy.stats.combine_pvalues
have been fixed to return the correct p-values, resolving
#15373. In addition, the
documentation for scipy.stats.combine_pvalues
has been expanded and improved.
Unlike other reduction functions, stats.mode
didn't consume the axis
being operated on and failed for negative axis inputs. Both the bugs have been
fixed. Note that stats.mode
will now consume the input axis and return an
ndarray with the axis
dimension removed.
Replaced implementation of scipy.stats.ncf
with the implementation from
Boost for improved reliability.
Add a bits
parameter to scipy.stats.qmc.Sobol
. It allows to use from 0
to 64 bits to compute the sequence. Default is None
which corresponds to
30 for backward compatibility. Using a higher value allow to sample more
points. Note: bits
does not affect the output dtype.
Add a integers
method to scipy.stats.qmc.QMCEngine
. It allows sampling
integers using any QMC sampler.
Improved the fit speed and accuracy of stats.pareto
.
Added qrvs
method to NumericalInversePolynomial
to match the
situation for NumericalInverseHermite
.
Faster random variate generation for gennorm
and nakagami
.
lloyd_centroidal_voronoi_tessellation
has been added to allow improved
sample distributions via iterative application of Voronoi diagrams and
centering operations
Add scipy.stats.qmc.PoissonDisk
to sample using the Poisson disk sampling
method. It guarantees that samples are separated from each other by a
given radius
.
Add scipy.stats.pmean
to calculate the weighted power mean also called
generalized mean.
n
of several distributions,
use of the distribution moment
method with keyword argument n
is
deprecated. Keyword n
is replaced with keyword order
.interval
method with keyword arguments
alpha
is deprecated. Keyword alpha
is replaced with keyword
confidence
.'simplex'
, 'revised simplex'
, and 'interior-point'
methods
of scipy.optimize.linprog
are deprecated. Methods highs
, highs-ds
,
or highs-ipm
should be used in new code.stats.mode
.
pandas.DataFrame.mode
can be used instead.spatial.distance.kulsinski
has been deprecated in favor
of spatial.distance.kulczynski1
.maxiter
keyword of the truncated Newton (TNC) algorithm has been
deprecated in favour of maxfun
.vertices
keyword of Delauney.qhull
now raises a
DeprecationWarning, after having been deprecated in documentation only
for a long time.extradoc
keyword of rv_continuous
, rv_discrete
and
rv_sample
now raises a DeprecationWarning, after having been deprecated in
documentation only for a long time.There is an ongoing effort to follow through on long-standing deprecations. The following previously deprecated features are affected:
radius=None
to scipy.spatial.SphericalVoronoi
now raises an
error (not adding radius
defaults to 1, as before).ndim > 1
._rvs
method of statistical distributions now requires a size
parameter.fillvalue
that cannot be cast to the output type in
scipy.signal.convolve2d
now raises an error.scipy.spatial.distance
now enforces that the input vectors are
one-dimensional.stats.itemfreq
.stats.median_absolute_deviation
.n_jobs
keyword argument and use of k=None
from
kdtree.query
.right
keyword from interpolate.PPoly.extend
.debug
keyword from scipy.linalg.solve_*
._ppform
scipy.interpolate
.matvec
and matmat
.mlab
truncation mode from cluster.dendrogram
.cluster.vq.py_vq2
.ftol
and xtol
from
optimize.minimize(method='Nelder-Mead')
.signal.windows.hanning
.gegv
functions from linalg
; this raises the minimally
required LAPACK version to 3.7.1.spatial.distance.matching
.scipy.random
for numpy.random
.scipy.misc
(docformat
,
inherit_docstring_from
, extend_notes_in_docstring
,
replace_notes_in_docstring
, indentcount_lines
, filldoc
,
unindent_dict
, unindent_string
).linalg.pinv2
.scipy.stats
functions now convert np.matrix
to np.ndarray
s
before the calculation is performed. In this case, the output will be a scalar
or np.ndarray
of appropriate shape rather than a 2D np.matrix
.
Similarly, while masked elements of masked arrays are still ignored, the
output will be a scalar or np.ndarray
rather than a masked array with
mask=False
.scipy.optimize.linprog
is now 'highs'
, not
'interior-point'
(which is now deprecated), so callback functions and
some options are no longer supported with the default method. With the
default method, the x
attribute of the returned OptimizeResult
is
now None
(instead of a non-optimal array) when an optimal solution
cannot be found (e.g. infeasible problem).scipy.stats.combine_pvalues
, the sign of the test statistic returned
for the method "pearson"
has been flipped so that higher values of the
statistic now correspond to lower p-values, making the statistic more
consistent with those of the other methods and with the majority of the
literature.scipy.linalg.expm
due to historical reasons was using the sparse
implementation and thus was accepting sparse arrays. Now it only works with
nDarrays. For sparse usage, scipy.sparse.linalg.expm
needs to be used
explicitly.scipy.stats.circvar
has reverted to the one that is
standard in the literature; note that this is not the same as the square of
scipy.stats.circstd
.QMCEngine
in MultinomialQMC
and
MultivariateNormalQMC
. It removes the methods fast_forward
and reset
.MultinomialQMC
now require the number of trials with n_trials
.
Hence, MultinomialQMC.random
output has now the correct shape (n, pvals)
.F_onewayConstantInputWarning
,
F_onewayBadInputSizesWarning
, PearsonRConstantInputWarning
,
PearsonRNearConstantInputWarning
, SpearmanRConstantInputWarning
, and
BootstrapDegenerateDistributionWarning
) have been replaced with more
general warnings.A draft developer CLI is available for SciPy, leveraging the doit
,
click
and rich-click
tools. For more details, see
gh-15959.
The SciPy contributor guide has been reorganized and updated (see #15947 for details).
QUADPACK Fortran routines in scipy.integrate
, which power
scipy.integrate.quad
, have been marked as recursive
. This should fix rare
issues in multivariate integration (nquad
and friends) and obviate the need
for compiler-specific compile flags (/recursive
for ifort etc). Please file
an issue if this change turns out problematic for you. This is also true for
FITPACK
routines in scipy.interpolate
, which power splrep
,
splev
etc., and *UnivariateSpline
and *BivariateSpline
classes.
the USE_PROPACK
environment variable has been renamed to
SCIPY_USE_PROPACK
; setting to a non-zero value will enable
the usage of the PROPACK
library as before
Before this release, all subpackages of SciPy (cluster
, fft
, ndimage
,
etc.) had to be explicitly imported. Now, these subpackages are lazily loaded
as soon as they are accessed, so that the following is possible (if desired
for interactive use, it's not actually recommended for code,
see :ref:scipy-api
):
import scipy as sp; sp.fft.dct([1, 2, 3])
. Advantages include: making it
easier to navigate SciPy in interactive terminals, reducing subpackage import
conflicts (which before required
import networkx.linalg as nla; import scipy.linalg as sla
),
and avoiding repeatedly having to update imports during teaching &
experimentation. Also see
the related community specification document.
This is the first release that ships with Meson as
the build system. When installing with pip
or pypa/build
, Meson will be
used (invoked via the meson-python
build hook). This change brings
significant benefits - most importantly much faster build times, but also
better support for cross-compilation and cleaner build logs.
Note:
This release still ships with support for numpy.distutils
-based builds
as well. Those can be invoked through the setup.py
command-line
interface (e.g., python setup.py install
). It is planned to remove
numpy.distutils
support before the 1.10.0 release.
When building from source, a number of things have changed compared to building
with numpy.distutils
:
meson
, ninja
, and pkg-config
.
setuptools
and wheel
are no longer needed.pkg-config
instead of hardcoded
paths or a site.cfg
file.blas-lapack-selection
for
details.The two CLIs that can be used to build wheels are pip
and build
. In
addition, the SciPy repo contains a python dev.py
CLI for any kind of
development task (see its --help
for details). For a comparison between old
(distutils
) and new (meson
) build commands, see :ref:meson-faq
.
For more information on the introduction of Meson support in SciPy, see
gh-13615 <https://github.com/scipy/scipy/issues/13615>
__ and
this blog post <https://labs.quansight.org/blog/2021/07/moving-scipy-to-meson/>
__.
A total of 155 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.
Note: SciPy 1.9.0
is not released yet!
SciPy 1.9.0
is the culmination of 6 months of hard work. It contains
many 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 for DeprecationWarning
s).
Our development attention will now shift to bug-fix releases on the
1.9.x branch, and on adding new features on the main branch.
This release requires Python 3.8+
and NumPy 1.18.5
or greater.
For running on PyPy, PyPy3 6.0+
is required.
meson
, substantially reducing
our source build timesscipy.optimize.milp
, new function for mixed-integer linear
programming.scipy.stats.fit
for fitting discrete and continuous distributions
to data.scipy.interpolate.RegularGridInterpolator
.scipy.optimize.direct
scipy.interpolate
improvementsRBFInterpolator
evaluation with high dimensional
interpolants.scipy.interpolate.RegularGridInterpolator
and its tutorial.scipy.interpolate.RegularGridInterpolator
and scipy.interpolate.interpn
now accept descending ordered points.RegularGridInterpolator
now handles length-1 grid axes.BivariateSpline
subclasses have a new method partial_derivative
which constructs a new spline object representing a derivative of an
original spline. This mirrors the corresponding functionality for univariate
splines, splder
and BSpline.derivative
, and can substantially speed
up repeated evaluation of derivatives.scipy.linalg
improvementsscipy.linalg.expm
now accepts nD arrays. Its speed is also improved.3.7.1
.scipy.fft
improvementsuarray
multimethods for scipy.fft.fht
and scipy.fft.ifht
to allow provision of third party backend implementations such as those
recently added to CuPy.scipy.optimize
improvementsA new global optimizer, scipy.optimize.direct
(DIviding RECTangles algorithm)
was added. For problems with inexpensive function evaluations, like the ones
in the SciPy benchmark suite, direct
is competitive with the best other
solvers in SciPy (dual_annealing
and differential_evolution
) in terms
of execution time. See
gh-14300 <https://github.com/scipy/scipy/pull/14300>
__ for more details.
Add a full_output
parameter to scipy.optimize.curve_fit
to output
additional solution information.
Add a integrality
parameter to scipy.optimize.differential_evolution
,
enabling integer constraints on parameters.
Add a vectorized
parameter to call a vectorized objective function only
once per iteration. This can improve minimization speed by reducing
interpreter overhead from the multiple objective function calls.
The default method of scipy.optimize.linprog
is now 'highs'
.
Added scipy.optimize.milp
, new function for mixed-integer linear
programming.
Added Newton-TFQMR method to newton_krylov
.
Added support for the Bounds
class in shgo
and dual_annealing
for
a more uniform API across scipy.optimize
.
Added the vectorized
keyword to differential_evolution
.
approx_fprime
now works with vector-valued functions.
scipy.signal
improvementsscipy.signal.windows.kaiser_bessel_derived
was
added to compute the Kaiser-Bessel derived window.hilbert
operations are now faster as a result of more
consistent dtype
handling.scipy.sparse
improvementscopy
parameter to scipy.sparce.csgraph.laplacian
. Using inplace
computation with copy=False
reduces the memory footprint.dtype
parameter to scipy.sparce.csgraph.laplacian
for type casting.symmetrized
parameter to scipy.sparce.csgraph.laplacian
to produce
symmetric Laplacian for directed graphs.form
parameter to scipy.sparce.csgraph.laplacian
taking one of the
three values: array
, or function
, or lo
determining the format of
the output Laplacian:
array
is a numpy array (backward compatible default);function
is a pointer to a lambda-function evaluating the
Laplacian-vector or Laplacian-matrix product;lo
results in the format of the LinearOperator
.scipy.sparse.linalg
improvementslobpcg
performance improvements for small input cases.scipy.spatial
improvementsorder
parameter to scipy.spatial.transform.Rotation.from_quat
and scipy.spatial.transform.Rotation.as_quat
to specify quaternion format.scipy.stats
improvementsscipy.stats.monte_carlo_test
performs one-sample Monte Carlo hypothesis
tests to assess whether a sample was drawn from a given distribution. Besides
reproducing the results of hypothesis tests like scipy.stats.ks_1samp
,
scipy.stats.normaltest
, and scipy.stats.cramervonmises
without small sample
size limitations, it makes it possible to perform similar tests using arbitrary
statistics and distributions.
Several scipy.stats
functions support new axis
(integer or tuple of
integers) and nan_policy
('raise', 'omit', or 'propagate'), and
keepdims
arguments.
These functions also support masked arrays as inputs, even if they do not have
a scipy.stats.mstats
counterpart. Edge cases for multidimensional arrays,
such as when axis-slices have no unmasked elements or entire inputs are of
size zero, are handled consistently.
Add a weight
parameter to scipy.stats.hmean
.
Several improvements have been made to scipy.stats.levy_stable
. Substantial
improvement has been made for numerical evaluation of the pdf and cdf,
resolving #12658 and
#14944. The improvement is
particularly dramatic for stability parameter alpha
close to or equal to 1
and for alpha
below but approaching its maximum value of 2. The alternative
fast Fourier transform based method for pdf calculation has also been updated
to use the approach of Wang and Zhang from their 2008 conference paper
Simpson’s rule based FFT method to compute densities of stable distribution,
making this method more competitive with the default method. In addition,
users now have the option to change the parametrization of the Levy Stable
distribution to Nolan's "S0" parametrization which is used internally by
SciPy's pdf and cdf implementations. The "S0" parametrization is described in
Nolan's paper Numerical calculation of stable densities and distribution
functions upon which SciPy's
implementation is based. "S0" has the advantage that delta
and gamma
are proper location and scale parameters. With delta
and gamma
fixed,
the location and scale of the resulting distribution remain unchanged as
alpha
and beta
change. This is not the case for the default "S1"
parametrization. Finally, more options have been exposed to allow users to
trade off between runtime and accuracy for both the default and FFT methods of
pdf and cdf calculation. More information can be found in the documentation
here (to be linked).
Added scipy.stats.fit
for fitting discrete and continuous distributions to
data.
The methods "pearson"
and "tippet"
from scipy.stats.combine_pvalues
have been fixed to return the correct p-values, resolving
#15373. In addition, the
documentation for scipy.stats.combine_pvalues
has been expanded and improved.
Unlike other reduction functions, stats.mode
didn't consume the axis
being operated on and failed for negative axis inputs. Both the bugs have been
fixed. Note that stats.mode
will now consume the input axis and return an
ndarray with the axis
dimension removed.
Replaced implementation of scipy.stats.ncf
with the implementation from
Boost for improved reliability.
Add a bits
parameter to scipy.stats.qmc.Sobol
. It allows to use from 0
to 64 bits to compute the sequence. Default is None
which corresponds to
30 for backward compatibility. Using a higher value allow to sample more
points. Note: bits
does not affect the output dtype.
Add a integers
method to scipy.stats.qmc.QMCEngine
. It allows sampling
integers using any QMC sampler.
Improved the fit speed and accuracy of stats.pareto
.
Added qrvs
method to NumericalInversePolynomial
to match the
situation for NumericalInverseHermite
.
Faster random variate generation for gennorm
and nakagami
.
lloyd_centroidal_voronoi_tessellation
has been added to allow improved
sample distributions via iterative application of Voronoi diagrams and
centering operations
Add scipy.stats.qmc.PoissonDisk
to sample using the Poisson disk sampling
method. It guarantees that samples are separated from each other by a
given radius
.
Add scipy.stats.pmean
to calculate the weighted power mean also called
generalized mean.
n
of several distributions,
use of the distribution moment
method with keyword argument n
is
deprecated. Keyword n
is replaced with keyword order
.interval
method with keyword arguments
alpha
is deprecated. Keyword alpha
is replaced with keyword
confidence
.'simplex'
, 'revised simplex'
, and 'interior-point'
methods
of scipy.optimize.linprog
are deprecated. Methods highs
, highs-ds
,
or highs-ipm
should be used in new code.stats.mode
.
pandas.DataFrame.mode
can be used instead.spatial.distance.kulsinski
has been deprecated in favor
of spatial.distance.kulczynski1
.maxiter
keyword of the truncated Newton (TNC) algorithm has been
deprecated in favour of maxfun
.vertices
keyword of Delauney.qhull
now raises a
DeprecationWarning, after having been deprecated in documentation only
for a long time.extradoc
keyword of rv_continuous
, rv_discrete
and
rv_sample
now raises a DeprecationWarning, after having been deprecated in
documentation only for a long time.There is an ongoing effort to follow through on long-standing deprecations. The following previously deprecated features are affected:
radius=None
to scipy.spatial.SphericalVoronoi
now raises an
error (not adding radius
defaults to 1, as before).ndim > 1
._rvs
method of statistical distributions now requires a size
parameter.fillvalue
that cannot be cast to the output type in
scipy.signal.convolve2d
now raises an error.scipy.spatial.distance
now enforces that the input vectors are
one-dimensional.stats.itemfreq
.stats.median_absolute_deviation
.n_jobs
keyword argument and use of k=None
from
kdtree.query
.right
keyword from interpolate.PPoly.extend
.debug
keyword from scipy.linalg.solve_*
._ppform
scipy.interpolate
.matvec
and matmat
.mlab
truncation mode from cluster.dendrogram
.cluster.vq.py_vq2
.ftol
and xtol
from
optimize.minimize(method='Nelder-Mead')
.signal.windows.hanning
.gegv
functions from linalg
; this raises the minimally
required LAPACK version to 3.7.1.spatial.distance.matching
.scipy.random
for numpy.random
.scipy.misc
(docformat
,
inherit_docstring_from
, extend_notes_in_docstring
,
replace_notes_in_docstring
, indentcount_lines
, filldoc
,
unindent_dict
, unindent_string
).linalg.pinv2
.scipy.stats
functions now convert np.matrix
to np.ndarray
s
before the calculation is performed. In this case, the output will be a scalar
or np.ndarray
of appropriate shape rather than a 2D np.matrix
.
Similarly, while masked elements of masked arrays are still ignored, the
output will be a scalar or np.ndarray
rather than a masked array with
mask=False
.scipy.optimize.linprog
is now 'highs'
, not
'interior-point'
(which is now deprecated), so callback functions and some
options are no longer supported with the default method.scipy.stats.combine_pvalues
, the sign of the test statistic returned
for the method "pearson"
has been flipped so that higher values of the
statistic now correspond to lower p-values, making the statistic more
consistent with those of the other methods and with the majority of the
literature.scipy.linalg.expm
due to historical reasons was using the sparse
implementation and thus was accepting sparse arrays. Now it only works with
nDarrays. For sparse usage, scipy.sparse.linalg.expm
needs to be used
explicitly.scipy.stats.circvar
has reverted to the one that is
standard in the literature; note that this is not the same as the square of
scipy.stats.circstd
.QMCEngine
in MultinomialQMC
and
MultivariateNormalQMC
. It removes the methods fast_forward
and reset
.MultinomialQMC
now require the number of trials with n_trials
.
Hence, MultinomialQMC.random
output has now the correct shape (n, pvals)
.F_onewayConstantInputWarning
,
F_onewayBadInputSizesWarning
, PearsonRConstantInputWarning
,
PearsonRNearConstantInputWarning
, SpearmanRConstantInputWarning
, and
BootstrapDegenerateDistributionWarning
) have been replaced with more
general warnings.A draft developer CLI is available for SciPy, leveraging the doit
,
click
and rich-click
tools. For more details, see
gh-15959.
The SciPy contributor guide has been reorganized and updated (see #15947 for details).
QUADPACK Fortran routines in scipy.integrate
, which power
scipy.integrate.quad
, have been marked as recursive
. This should fix rare
issues in multivariate integration (nquad
and friends) and obviate the need
for compiler-specific compile flags (/recursive
for ifort etc). Please file
an issue if this change turns out problematic for you. This is also true for
FITPACK
routines in scipy.interpolate
, which power splrep
,
splev
etc., and *UnivariateSpline
and *BivariateSpline
classes.
the USE_PROPACK
environment variable has been renamed to
SCIPY_USE_PROPACK
; setting to a non-zero value will enable
the usage of the PROPACK
library as before
Before this release, all subpackages of SciPy (cluster
, fft
, ndimage
,
etc.) had to be explicitly imported. Now, these subpackages are lazily loaded
as soon as they are accessed, so that the following is possible (if desired
for interactive use, it's not actually recommended for code,
see :ref:scipy-api
):
import scipy as sp; sp.fft.dct([1, 2, 3])
. Advantages include: making it
easier to navigate SciPy in interactive terminals, reducing subpackage import
conflicts (which before required
import networkx.linalg as nla; import scipy.linalg as sla
),
and avoiding repeatedly having to update imports during teaching &
experimentation. Also see
the related community specification document.
This is the first release that ships with Meson as
the build system. When installing with pip
or pypa/build
, Meson will be
used (invoked via the meson-python
build hook). This change brings
significant benefits - most importantly much faster build times, but also
better support for cross-compilation and cleaner build logs.
Note:
This release still ships with support for numpy.distutils
-based builds
as well. Those can be invoked through the setup.py
command-line
interface (e.g., python setup.py install
). It is planned to remove
numpy.distutils
support before the 1.10.0 release.
When building from source, a number of things have changed compared to building
with numpy.distutils
:
meson
, ninja
, and pkg-config
.
setuptools
and wheel
are no longer needed.pkg-config
instead of hardcoded
paths or a site.cfg
file.blas-lapack-selection
for
details.The two CLIs that can be used to build wheels are pip
and build
. In
addition, the SciPy repo contains a python dev.py
CLI for any kind of
development task (see its --help
for details). For a comparison between old
(distutils
) and new (meson
) build commands, see :ref:meson-faq
.
For more information on the introduction of Meson support in SciPy, see
gh-13615 <https://github.com/scipy/scipy/issues/13615>
__ and
this blog post <https://labs.quansight.org/blog/2021/07/moving-scipy-to-meson/>
__.
A total of 153 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.
SciPy 1.8.1
is a bug-fix release with no new features
compared to 1.8.0
. Notably, usage of Pythran has been
restored for Windows builds/binaries.
A total of 17 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.
SciPy 1.8.0
is the culmination of 6
months of hard work. It contains
many 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 for DeprecationWarning
s).
Our development attention will now shift to bug-fix releases on the
1.8.x branch, and on adding new features on the master branch.
This release requires Python 3.8+
and NumPy 1.17.3
or greater.
For running on PyPy, PyPy3 6.0+
is required.
scipy.sparse.svds
with solver='PROPACK'
. It is currently
default-off due to potential issues on Windows that we aim to
resolve in the next release, but can be optionally enabled at runtime for
friendly testing with an environment variable setting of USE_PROPACK=1
.scipy.stats.sampling
submodule that leverages the UNU.RAN
C
library to sample from arbitrary univariate non-uniform continuous and
discrete distributionsscipy.fft
improvementsAdded an orthogonalize=None
parameter to the real transforms in scipy.fft
which controls whether the modified definition of DCT/DST is used without
changing the overall scaling.
scipy.fft
backend registration is now smoother, operating with a single
registration call and no longer requiring a context manager.
scipy.integrate
improvementsscipy.integrate.quad_vec
introduces a new optional keyword-only argument,
args
. args
takes in a tuple of extra arguments if any (default is
args=()
), which is then internally used to pass into the callable function
(needing these extra arguments) which we wish to integrate.
scipy.interpolate
improvementsscipy.interpolate.BSpline
has a new method, design_matrix
, which
constructs a design matrix of b-splines in the sparse CSR format.
A new method from_cubic
in BSpline
class allows to convert a
CubicSpline
object to BSpline
object.
scipy.linalg
improvementsscipy.linalg
gained three new public array structure investigation functions.
scipy.linalg.bandwidth
returns information about the bandedness of an array
and can be used to test for triangular structure discovery, while
scipy.linalg.issymmetric
and scipy.linalg.ishermitian
test the array for
exact and approximate symmetric/Hermitian structure.
scipy.optimize
improvementsscipy.optimize.check_grad
introduces two new optional keyword only arguments,
direction
and seed
. direction
can take values, 'all'
(default),
in which case all the one hot direction vectors will be used for verifying
the input analytical gradient function and 'random'
, in which case a
random direction vector will be used for the same purpose. seed
(default is None
) can be used for reproducing the return value of
check_grad
function. It will be used only when direction='random'
.
The scipy.optimize.minimize
TNC
method has been rewritten to use Cython
bindings. This also fixes an issue with the callback altering the state of the
optimization.
Added optional parameters target_accept_rate
and stepwise_factor
for
adapative step size adjustment in basinhopping
.
The epsilon
argument to approx_fprime
is now optional so that it may
have a default value consistent with most other functions in scipy.optimize
.
scipy.signal
improvementsAdd analog
argument, default False
, to zpk2sos
, and add new pairing
option 'minimal'
to construct analog and minimal discrete SOS arrays.
tf2sos
uses zpk2sos; add analog
argument here as well, and pass it on
to zpk2sos
.
savgol_coeffs
and savgol_filter
now work for even window lengths.
Added the Chirp Z-transform and Zoom FFT available as scipy.signal.CZT
and
scipy.signal.ZoomFFT
.
scipy.sparse
improvementsAn array API has been added for early testing and feedback; this
work is ongoing, and users should expect minor API refinements over
the next few releases. Please refer to the scipy.sparse
docstring for more information.
maximum_flow
introduces optional keyword only argument, method
which accepts either, 'edmonds-karp'
(Edmonds Karp algorithm) or
'dinic'
(Dinic's algorithm). Moreover, 'dinic'
is used as default
value for method
which means that Dinic's algorithm is used for computing
maximum flow unless specified. See, the comparison between the supported
algorithms in
this comment <https://github.com/scipy/scipy/pull/14358#issue-684212523>
_.
Parameters atol
, btol
now default to 1e-6 in
scipy.sparse.linalg.lsmr
to match with default values in
scipy.sparse.linalg.lsqr
.
Add the Transpose-Free Quasi-Minimal Residual algorithm (TFQMR) for general
nonsingular non-Hermitian linear systems in scipy.sparse.linalg.tfqmr
.
The sparse SVD library PROPACK is now vendored with SciPy, and an interface is
exposed via scipy.sparse.svds
with solver='PROPACK'
. For some problems,
this may be faster and/or more accurate than the default, ARPACK. PROPACK
functionality is currently opt-in--you must specify USE_PROPACK=1
at
runtime to use it due to potential issues on Windows
that we aim to resolve in the next release.
sparse.linalg
iterative solvers now have a nonzero initial guess option,
which may be specified as x0 = 'Mb'
.
The trace
method has been added for sparse matrices.
scipy.spatial
improvementsscipy.spatial.transform.Rotation
now supports item assignment and has a new
concatenate
method.
Add scipy.spatial.distance.kulczynski1
in favour of
scipy.spatial.distance.kulsinski
which will be deprecated in the next
release.
scipy.spatial.distance.minkowski
now also supports 0<p<1
.
scipy.special
improvementsThe new function scipy.special.log_expit
computes the logarithm of the
logistic sigmoid function. The function is formulated to provide accurate
results for large positive and negative inputs, so it avoids the problems
that would occur in the naive implementation log(expit(x))
.
A suite of five new functions for elliptic integrals:
scipy.special.ellipr{c,d,f,g,j}
. These are the
Carlson symmetric elliptic integrals <https://dlmf.nist.gov/19.16>
_, which
have computational advantages over the classical Legendre integrals. Previous
versions included some elliptic integrals from the Cephes library
(scipy.special.ellip{k,km1,kinc,e,einc}
) but was missing the integral of
third kind (Legendre's Pi), which can be evaluated using the new Carlson
functions. The new Carlson elliptic integral functions can be evaluated in the
complex plane, whereas the Cephes library's functions are only defined for
real inputs.
Several defects in scipy.special.hyp2f1
have been corrected. Approximately
correct values are now returned for z
near exp(+-i*pi/3)
, fixing
#8054 <https://github.com/scipy/scipy/issues/8054>
. Evaluation for such z
is now calculated through a series derived by
López and Temme (2013) <https://arxiv.org/abs/1306.2046>
that converges in
these regions. In addition, degenerate cases with one or more of a
, b
,
and/or c
a non-positive integer are now handled in a manner consistent with
mpmath's hyp2f1 implementation <https://mpmath.org/doc/current/functions/hypergeometric.html>
,
which fixes #7340 <https://github.com/scipy/scipy/issues/7340>
. These fixes
were made as part of an effort to rewrite the Fortran 77 implementation of
hyp2f1 in Cython piece by piece. This rewriting is now roughly 50% complete.
scipy.stats
improvementsscipy.stats.qmc.LatinHypercube
introduces two new optional keyword-only
arguments, optimization
and strength
. optimization
is either
None
or random-cd
. In the latter, random permutations are performed to
improve the centered discrepancy. strength
is either 1 or 2. 1 corresponds
to the classical LHS while 2 has better sub-projection properties. This
construction is referred to as an orthogonal array based LHS of strength 2.
In both cases, the output is still a LHS.
scipy.stats.qmc.Halton
is faster as the underlying Van der Corput sequence
was ported to Cython.
The alternative
parameter was added to the kendalltau
and somersd
functions to allow one-sided hypothesis testing. Similarly, the masked
versions of skewtest
, kurtosistest
, ttest_1samp
, ttest_ind
,
and ttest_rel
now also have an alternative
parameter.
Add scipy.stats.gzscore
to calculate the geometrical z score.
Random variate generators to sample from arbitrary univariate non-uniform
continuous and discrete distributions have been added to the new
scipy.stats.sampling
submodule. Implementations of a C library
UNU.RAN <http://statmath.wu.ac.at/software/unuran/>
_ are used for
performance. The generators added are:
The binned_statistic
set of functions now have improved performance for
the std
, min
, max
, and median
statistic calculations.
somersd
and _tau_b
now have faster Pythran-based implementations.
Some general efficiency improvements to handling of nan
values in
several stats
functions.
Added the Tukey-Kramer test as scipy.stats.tukey_hsd
.
Improved performance of scipy.stats.argus
rvs
method.
Added the parameter keepdims
to scipy.stats.variation
and prevent the
undesirable return of a masked array from the function in some cases.
permutation_test
performs an exact or randomized permutation test of a
given statistic on provided data.
SciPy has always documented what its public API consisted of in
:ref:its API reference docs <scipy-api>
,
however there never was a clear split between public and
private namespaces in the code base. In this release, all namespaces that were
private but happened to miss underscores in their names have been deprecated.
These include (as examples, there are many more):
scipy.signal.spline
scipy.ndimage.filters
scipy.ndimage.fourier
scipy.ndimage.measurements
scipy.ndimage.morphology
scipy.ndimage.interpolation
scipy.sparse.linalg.solve
scipy.sparse.linalg.eigen
scipy.sparse.linalg.isolve
All functions and other objects in these namespaces that were meant to be
public are accessible from their respective public namespace (e.g.
scipy.signal
). The design principle is that any public object must be
accessible from a single namespace only; there are a few exceptions, mostly for
historical reasons (e.g., stats
and stats.distributions
overlap).
For other libraries aiming to provide a SciPy-compatible API, it is now
unambiguous what namespace structure to follow. See
gh-14360 <https://github.com/scipy/scipy/issues/14360>
_ for more details.
NumericalInverseHermite
has been deprecated from scipy.stats
and moved
to the scipy.stats.sampling
submodule. It now uses the C implementation of
the UNU.RAN library so the result of methods like ppf
may vary slightly.
Parameter tol
has been deprecated and renamed to u_resolution
. The
parameter max_intervals
has also been deprecated and will be removed in a
future release of SciPy.
here <https://docs.scipy.org/doc/scipy/reference/dev/toolchain.html>
_.scipy.stats.binned_statistic
with the builtin
'std'
metric is now nan
, for consistency with np.std
.scipy.spatial.distance.wminkowski
has been removed. To achieve
the same results as before, please use the minkowski
distance function
with the (optional) w=
keyword-argument for the given weight.Some Fortran 77 code was modernized to be compatible with NAG's nagfor Fortran
compiler (see, e.g., PR 13229 <https://github.com/scipy/scipy/pull/13229>
_).
threadpoolctl
may now be used by our test suite to substantially improve
the efficiency of parallel test suite runs.
A total of 139 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.
Note: SciPy 1.8.0
is not released yet!
SciPy 1.8.0
is the culmination of 6
months of hard work. It contains
many 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 for DeprecationWarning
s).
Our development attention will now shift to bug-fix releases on the
1.8.x branch, and on adding new features on the master branch.
This release requires Python 3.8+
and NumPy 1.17.3
or greater.
For running on PyPy, PyPy3 6.0+
is required.
scipy.sparse.svds
with solver='PROPACK'
. It is currently
default-off due to potential issues on Windows that we aim to
resolve in the next release, but can be optionally enabled at runtime for
friendly testing with an environment variable setting of USE_PROPACK=1
.scipy.stats.sampling
submodule that leverages the UNU.RAN
C
library to sample from arbitrary univariate non-uniform continuous and
discrete distributionsscipy.fft
improvementsAdded an orthogonalize=None
parameter to the real transforms in scipy.fft
which controls whether the modified definition of DCT/DST is used without
changing the overall scaling.
scipy.fft
backend registration is now smoother, operating with a single
registration call and no longer requiring a context manager.
scipy.integrate
improvementsscipy.integrate.quad_vec
introduces a new optional keyword-only argument,
args
. args
takes in a tuple of extra arguments if any (default is
args=()
), which is then internally used to pass into the callable function
(needing these extra arguments) which we wish to integrate.
scipy.interpolate
improvementsscipy.interpolate.BSpline
has a new method, design_matrix
, which
constructs a design matrix of b-splines in the sparse CSR format.
A new method from_cubic
in BSpline
class allows to convert a
CubicSpline
object to BSpline
object.
scipy.linalg
improvementsscipy.linalg
gained three new public array structure investigation functions.
scipy.linalg.bandwidth
returns information about the bandedness of an array
and can be used to test for triangular structure discovery, while
scipy.linalg.issymmetric
and scipy.linalg.ishermitian
test the array for
exact and approximate symmetric/Hermitian structure.
scipy.optimize
improvementsscipy.optimize.check_grad
introduces two new optional keyword only arguments,
direction
and seed
. direction
can take values, 'all'
(default),
in which case all the one hot direction vectors will be used for verifying
the input analytical gradient function and 'random'
, in which case a
random direction vector will be used for the same purpose. seed
(default is None
) can be used for reproducing the return value of
check_grad
function. It will be used only when direction='random'
.
The scipy.optimize.minimize
TNC
method has been rewritten to use Cython
bindings. This also fixes an issue with the callback altering the state of the
optimization.
Added optional parameters target_accept_rate
and stepwise_factor
for
adapative step size adjustment in basinhopping
.
The epsilon
argument to approx_fprime
is now optional so that it may
have a default value consistent with most other functions in scipy.optimize
.
scipy.signal
improvementsAdd analog
argument, default False
, to zpk2sos
, and add new pairing
option 'minimal'
to construct analog and minimal discrete SOS arrays.
tf2sos
uses zpk2sos; add analog
argument here as well, and pass it on
to zpk2sos
.
savgol_coeffs
and savgol_filter
now work for even window lengths.
Added the Chirp Z-transform and Zoom FFT available as scipy.signal.CZT
and
scipy.signal.ZoomFFT
.
scipy.sparse
improvementsAn array API has been added for early testing and feedback; this
work is ongoing, and users should expect minor API refinements over
the next few releases. Please refer to the scipy.sparse
docstring for more information.
maximum_flow
introduces optional keyword only argument, method
which accepts either, 'edmonds-karp'
(Edmonds Karp algorithm) or
'dinic'
(Dinic's algorithm). Moreover, 'dinic'
is used as default
value for method
which means that Dinic's algorithm is used for computing
maximum flow unless specified. See, the comparison between the supported
algorithms in
this comment <https://github.com/scipy/scipy/pull/14358#issue-684212523>
_.
Parameters atol
, btol
now default to 1e-6 in
scipy.sparse.linalg.lsmr
to match with default values in
scipy.sparse.linalg.lsqr
.
Add the Transpose-Free Quasi-Minimal Residual algorithm (TFQMR) for general
nonsingular non-Hermitian linear systems in scipy.sparse.linalg.tfqmr
.
The sparse SVD library PROPACK is now vendored with SciPy, and an interface is
exposed via scipy.sparse.svds
with solver='PROPACK'
. For some problems,
this may be faster and/or more accurate than the default, ARPACK. PROPACK
functionality is currently opt-in--you must specify USE_PROPACK=1
at
runtime to use it due to potential issues on Windows
that we aim to resolve in the next release.
sparse.linalg
iterative solvers now have a nonzero initial guess option,
which may be specified as x0 = 'Mb'
.
The trace
method has been added for sparse matrices.
scipy.spatial
improvementsscipy.spatial.transform.Rotation
now supports item assignment and has a new
concatenate
method.
Add scipy.spatial.distance.kulczynski1
in favour of
scipy.spatial.distance.kulsinski
which will be deprecated in the next
release.
scipy.spatial.distance.minkowski
now also supports 0<p<1
.
scipy.special
improvementsThe new function scipy.special.log_expit
computes the logarithm of the
logistic sigmoid function. The function is formulated to provide accurate
results for large positive and negative inputs, so it avoids the problems
that would occur in the naive implementation log(expit(x))
.
A suite of five new functions for elliptic integrals:
scipy.special.ellipr{c,d,f,g,j}
. These are the
Carlson symmetric elliptic integrals <https://dlmf.nist.gov/19.16>
_, which
have computational advantages over the classical Legendre integrals. Previous
versions included some elliptic integrals from the Cephes library
(scipy.special.ellip{k,km1,kinc,e,einc}
) but was missing the integral of
third kind (Legendre's Pi), which can be evaluated using the new Carlson
functions. The new Carlson elliptic integral functions can be evaluated in the
complex plane, whereas the Cephes library's functions are only defined for
real inputs.
Several defects in scipy.special.hyp2f1
have been corrected. Approximately
correct values are now returned for z
near exp(+-i*pi/3)
, fixing
#8054 <https://github.com/scipy/scipy/issues/8054>
. Evaluation for such z
is now calculated through a series derived by
López and Temme (2013) <https://arxiv.org/abs/1306.2046>
that converges in
these regions. In addition, degenerate cases with one or more of a
, b
,
and/or c
a non-positive integer are now handled in a manner consistent with
mpmath's hyp2f1 implementation <https://mpmath.org/doc/current/functions/hypergeometric.html>
,
which fixes #7340 <https://github.com/scipy/scipy/issues/7340>
. These fixes
were made as part of an effort to rewrite the Fortran 77 implementation of
hyp2f1 in Cython piece by piece. This rewriting is now roughly 50% complete.
scipy.stats
improvementsscipy.stats.qmc.LatinHypercube
introduces two new optional keyword-only
arguments, optimization
and strength
. optimization
is either
None
or random-cd
. In the latter, random permutations are performed to
improve the centered discrepancy. strength
is either 1 or 2. 1 corresponds
to the classical LHS while 2 has better sub-projection properties. This
construction is referred to as an orthogonal array based LHS of strength 2.
In both cases, the output is still a LHS.
scipy.stats.qmc.Halton
is faster as the underlying Van der Corput sequence
was ported to Cython.
The alternative
parameter was added to the kendalltau
and somersd
functions to allow one-sided hypothesis testing. Similarly, the masked
versions of skewtest
, kurtosistest
, ttest_1samp
, ttest_ind
,
and ttest_rel
now also have an alternative
parameter.
Add scipy.stats.gzscore
to calculate the geometrical z score.
Random variate generators to sample from arbitrary univariate non-uniform
continuous and discrete distributions have been added to the new
scipy.stats.sampling
submodule. Implementations of a C library
UNU.RAN <http://statmath.wu.ac.at/software/unuran/>
_ are used for
performance. The generators added are:
The binned_statistic
set of functions now have improved performance for
the std
, min
, max
, and median
statistic calculations.
somersd
and _tau_b
now have faster Pythran-based implementations.
Some general efficiency improvements to handling of nan
values in
several stats
functions.
Added the Tukey-Kramer test as scipy.stats.tukey_hsd
.
Improved performance of scipy.stats.argus
rvs
method.
Added the parameter keepdims
to scipy.stats.variation
and prevent the
undesirable return of a masked array from the function in some cases.
permutation_test
performs an exact or randomized permutation test of a
given statistic on provided data.
SciPy has always documented what its public API consisted of in
:ref:its API reference docs <scipy-api>
,
however there never was a clear split between public and
private namespaces in the code base. In this release, all namespaces that were
private but happened to miss underscores in their names have been deprecated.
These include (as examples, there are many more):
scipy.signal.spline
scipy.ndimage.filters
scipy.ndimage.fourier
scipy.ndimage.measurements
scipy.ndimage.morphology
scipy.ndimage.interpolation
scipy.sparse.linalg.solve
scipy.sparse.linalg.eigen
scipy.sparse.linalg.isolve
All functions and other objects in these namespaces that were meant to be
public are accessible from their respective public namespace (e.g.
scipy.signal
). The design principle is that any public object must be
accessible from a single namespace only; there are a few exceptions, mostly for
historical reasons (e.g., stats
and stats.distributions
overlap).
For other libraries aiming to provide a SciPy-compatible API, it is now
unambiguous what namespace structure to follow. See
gh-14360 <https://github.com/scipy/scipy/issues/14360>
_ for more details.
NumericalInverseHermite
has been deprecated from scipy.stats
and moved
to the scipy.stats.sampling
submodule. It now uses the C implementation of
the UNU.RAN library so the result of methods like ppf
may vary slightly.
Parameter tol
has been deprecated and renamed to u_resolution
. The
parameter max_intervals
has also been deprecated and will be removed in a
future release of SciPy.
here <https://docs.scipy.org/doc/scipy/reference/dev/toolchain.html>
_.scipy.stats.binned_statistic
with the builtin
'std'
metric is now nan
, for consistency with np.std
.scipy.spatial.distance.wminkowski
has been removed. To achieve
the same results as before, please use the minkowski
distance function
with the (optional) w=
keyword-argument for the given weight.Some Fortran 77 code was modernized to be compatible with NAG's nagfor Fortran
compiler (see, e.g., PR 13229 <https://github.com/scipy/scipy/pull/13229>
_).
threadpoolctl
may now be used by our test suite to substantially improve
the efficiency of parallel test suite runs.
A total of 139 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.
Note: SciPy 1.8.0
is not released yet!
SciPy 1.8.0
is the culmination of 6
months of hard work. It contains
many 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 for DeprecationWarning
s).
Our development attention will now shift to bug-fix releases on the
1.8.x branch, and on adding new features on the master branch.
This release requires Python 3.8
+ and NumPy 1.17.3
or greater.
For running on PyPy, PyPy3 6.0
+ is required.
scipy.sparse.svds
with solver='PROPACK'
. It is currently
default-off due to potential issues on Windows that we aim to
resolve in the next release, but can be optionally enabled at runtime for
friendly testing with an environment variable setting of USE_PROPACK=1
.scipy.stats.sampling
submodule that leverages the UNU.RAN
C
library to sample from arbitrary univariate non-uniform continuous and
discrete distributionsscipy.fft
improvementsAdded an orthogonalize=None
parameter to the real transforms in scipy.fft
which controls whether the modified definition of DCT/DST is used without
changing the overall scaling.
scipy.fft
backend registration is now smoother, operating with a single
registration call and no longer requiring a context manager.
scipy.integrate
improvementsscipy.integrate.quad_vec
introduces a new optional keyword-only argument,
args
. args
takes in a tuple of extra arguments if any (default is
args=()
), which is then internally used to pass into the callable function
(needing these extra arguments) which we wish to integrate.
scipy.interpolate
improvementsscipy.interpolate.BSpline
has a new method, design_matrix
, which
constructs a design matrix of b-splines in the sparse CSR format.
A new method from_cubic
in BSpline
class allows to convert a
CubicSpline
object to BSpline
object.
scipy.linalg
improvementsscipy.linalg
gained three new public array structure investigation functions.
scipy.linalg.bandwidth
returns information about the bandedness of an array
and can be used to test for triangular structure discovery, while
scipy.linalg.issymmetric
and scipy.linalg.ishermitian
test the array for
exact and approximate symmetric/Hermitian structure.
scipy.optimize
improvementsscipy.optimize.check_grad
introduces two new optional keyword only arguments,
direction
and seed
. direction
can take values, 'all'
(default),
in which case all the one hot direction vectors will be used for verifying
the input analytical gradient function and 'random'
, in which case a
random direction vector will be used for the same purpose. seed
(default is None
) can be used for reproducing the return value of
check_grad
function. It will be used only when direction='random'
.
The scipy.optimize.minimize
TNC
method has been rewritten to use Cython
bindings. This also fixes an issue with the callback altering the state of the
optimization.
Added optional parameters target_accept_rate
and stepwise_factor
for
adapative step size adjustment in basinhopping
.
The epsilon
argument to approx_fprime
is now optional so that it may
have a default value consistent with most other functions in scipy.optimize
.
scipy.signal
improvementsAdd analog
argument, default False
, to zpk2sos
, and add new pairing
option 'minimal'
to construct analog and minimal discrete SOS arrays.
tf2sos
uses zpk2sos; add analog
argument here as well, and pass it on
to zpk2sos
.
savgol_coeffs
and savgol_filter
now work for even window lengths.
Added the Chirp Z-transform and Zoom FFT available as scipy.signal.CZT
and
scipy.signal.ZoomFFT
.
scipy.sparse
improvementsAn array API has been added for early testing and feedback; this
work is ongoing, and users should expect minor API refinements over
the next few releases. Please refer to the scipy.sparse
docstring for more information.
maximum_flow
introduces optional keyword only argument, method
which accepts either, 'edmonds-karp'
(Edmonds Karp algorithm) or
'dinic'
(Dinic's algorithm). Moreover, 'dinic'
is used as default
value for method
which means that Dinic's algorithm is used for computing
maximum flow unless specified. See, the comparison between the supported
algorithms in this comment.
Parameters atol
, btol
now default to 1e-6 in
scipy.sparse.linalg.lsmr
to match with default values in
scipy.sparse.linalg.lsqr
.
Add the Transpose-Free Quasi-Minimal Residual algorithm (TFQMR) for general
nonsingular non-Hermitian linear systems in scipy.sparse.linalg.tfqmr
.
The sparse SVD library PROPACK is now vendored with SciPy, and an interface is
exposed via scipy.sparse.svds
with solver='PROPACK'
. For some problems,
this may be faster and/or more accurate than the default, ARPACK. PROPACK
functionality is currently opt-in--you must specify USE_PROPACK=1
at
runtime to use it due to potential issues on Windows
that we aim to resolve in the next release.
sparse.linalg
iterative solvers now have a nonzero initial guess option,
which may be specified as x0 = 'Mb'
.
The trace
method has been added for sparse matrices.
scipy.spatial
improvementsscipy.spatial.transform.Rotation
now supports item assignment and has a new
concatenate
method.
Add scipy.spatial.distance.kulczynski1
in favour of
scipy.spatial.distance.kulsinski
which will be deprecated in the next
release.
scipy.spatial.distance.minkowski
now also supports 0<p<1
.
scipy.special
improvementsThe new function scipy.special.log_expit
computes the logarithm of the
logistic sigmoid function. The function is formulated to provide accurate
results for large positive and negative inputs, so it avoids the problems
that would occur in the naive implementation log(expit(x))
.
A suite of five new functions for elliptic integrals:
scipy.special.ellipr{c,d,f,g,j}
. These are the
Carlson symmetric elliptic integrals <https://dlmf.nist.gov/19.16>
_, which
have computational advantages over the classical Legendre integrals. Previous
versions included some elliptic integrals from the Cephes library
(scipy.special.ellip{k,km1,kinc,e,einc}
) but was missing the integral of
third kind (Legendre's Pi), which can be evaluated using the new Carlson
functions. The new Carlson elliptic integral functions can be evaluated in the
complex plane, whereas the Cephes library's functions are only defined for
real inputs.
Several defects in scipy.special.hyp2f1
have been corrected. Approximately
correct values are now returned for z
near exp(+-i*pi/3)
, fixing
#8054 <https://github.com/scipy/scipy/issues/8054>
. Evaluation for such z
is now calculated through a series derived by
López and Temme (2013) <https://arxiv.org/abs/1306.2046>
that converges in
these regions. In addition, degenerate cases with one or more of a
, b
,
and/or c
a non-positive integer are now handled in a manner consistent with
mpmath's hyp2f1 implementation <https://mpmath.org/doc/current/functions/hypergeometric.html>
,
which fixes #7340 <https://github.com/scipy/scipy/issues/7340>
. These fixes
were made as part of an effort to rewrite the Fortran 77 implementation of
hyp2f1 in Cython piece by piece. This rewriting is now roughly 50% complete.
scipy.stats
improvementsscipy.stats.qmc.LatinHypercube
introduces two new optional keyword-only
arguments, optimization
and strength
. optimization
is either
None
or random-cd
. In the latter, random permutations are performed to
improve the centered discrepancy. strength
is either 1 or 2. 1 corresponds
to the classical LHS while 2 has better sub-projection properties. This
construction is referred to as an orthogonal array based LHS of strength 2.
In both cases, the output is still a LHS.
scipy.stats.qmc.Halton
is faster as the underlying Van der Corput sequence
was ported to Cython.
The alternative
parameter was added to the kendalltau
and somersd
functions to allow one-sided hypothesis testing. Similarly, the masked
versions of skewtest
, kurtosistest
, ttest_1samp
, ttest_ind
,
and ttest_rel
now also have an alternative
parameter.
Add scipy.stats.gzscore
to calculate the geometrical z score.
Random variate generators to sample from arbitrary univariate non-uniform
continuous and discrete distributions have been added to the new
scipy.stats.sampling
submodule. Implementations of a C library
UNU.RAN <http://statmath.wu.ac.at/software/unuran/>
_ are used for
performance. The generators added are:
The binned_statistic
set of functions now have improved performance for
the std
, min
, max
, and median
statistic calculations.
somersd
and _tau_b
now have faster Pythran-based implementations.
Some general efficiency improvements to handling of nan
values in
several stats
functions.
Added the Tukey-Kramer test as scipy.stats.tukey_hsd
.
Improved performance of scipy.stats.argus
rvs
method.
Added the parameter keepdims
to scipy.stats.variation
and prevent the
undesirable return of a masked array from the function in some cases.
permutation_test
performs an exact or randomized permutation test of a
given statistic on provided data.
SciPy has always documented what its public API consisted of in
:ref:its API reference docs <scipy-api>
,
however there never was a clear split between public and
private namespaces in the code base. In this release, all namespaces that were
private but happened to miss underscores in their names have been deprecated.
These include (as examples, there are many more):
scipy.signal.spline
scipy.ndimage.filters
scipy.ndimage.fourier
scipy.ndimage.measurements
scipy.ndimage.morphology
scipy.ndimage.interpolation
scipy.sparse.linalg.solve
scipy.sparse.linalg.eigen
scipy.sparse.linalg.isolve
All functions and other objects in these namespaces that were meant to be
public are accessible from their respective public namespace (e.g.
scipy.signal
). The design principle is that any public object must be
accessible from a single namespace only; there are a few exceptions, mostly for
historical reasons (e.g., stats
and stats.distributions
overlap).
For other libraries aiming to provide a SciPy-compatible API, it is now
unambiguous what namespace structure to follow. See
gh-14360 <https://github.com/scipy/scipy/issues/14360>
_ for more details.
NumericalInverseHermite
has been deprecated from scipy.stats
and moved
to the scipy.stats.sampling
submodule. It now uses the C implementation of
the UNU.RAN library so the result of methods like ppf
may vary slightly.
Parameter tol
has been deprecated and renamed to u_resolution
. The
parameter max_intervals
has also been deprecated and will be removed in a
future release of SciPy.
here <https://docs.scipy.org/doc/scipy/reference/dev/toolchain.html>
_.scipy.stats.binned_statistic
with the builtin
'std'
metric is now nan
, for consistency with np.std
.scipy.spatial.distance.wminkowski
has been removed. To achieve
the same results as before, please use the minkowski
distance function
with the (optional) w=
keyword-argument for the given weight.Some Fortran 77 code was modernized to be compatible with NAG's nagfor Fortran
compiler (see, e.g., PR 13229 <https://github.com/scipy/scipy/pull/13229>
_).
threadpoolctl
may now be used by our test suite to substantially improve
the efficiency of parallel test suite runs.
A total of 139 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.
Note: SciPy 1.8.0
is not released yet!
SciPy 1.8.0
is the culmination of 6
months of hard work. It contains
many 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 for DeprecationWarning
s).
Our development attention will now shift to bug-fix releases on the
1.8.x branch, and on adding new features on the master branch.
This release requires Python 3.8
+ and NumPy 1.17.3
or greater.
For running on PyPy, PyPy3 6.0
+ is required.
scipy.sparse.svds
with solver='PROPACK'
.scipy.stats.sampling
submodule that leverages the UNU.RAN
C
library to sample from arbitrary univariate non-uniform continuous and
discrete distributionsscipy.fft
improvementsAdded an orthogonalize=None
parameter to the real transforms in scipy.fft
which controls whether the modified definition of DCT/DST is used without
changing the overall scaling.
scipy.fft
backend registration is now smoother, operating with a single
registration call and no longer requiring a context manager.
scipy.integrate
improvementsscipy.integrate.quad_vec
introduces a new optional keyword-only argument,
args
. args
takes in a tuple of extra arguments if any (default is
args=()
), which is then internally used to pass into the callable function
(needing these extra arguments) which we wish to integrate.
scipy.interpolate
improvementsscipy.interpolate.BSpline
has a new method, design_matrix
, which
constructs a design matrix of b-splines in the sparse CSR format.
A new method from_cubic
in BSpline
class allows to convert a
CubicSpline
object to BSpline
object.
scipy.linalg
improvementsscipy.linalg
gained three new public array structure investigation functions.
scipy.linalg.bandwidth
returns information about the bandedness of an array
and can be used to test for triangular structure discovery, while
scipy.linalg.issymmetric
and scipy.linalg.ishermitian
test the array for
exact and approximate symmetric/Hermitian structure.
scipy.optimize
improvementsscipy.optimize.check_grad
introduces two new optional keyword only arguments,
direction
and seed
. direction
can take values, 'all'
(default),
in which case all the one hot direction vectors will be used for verifying
the input analytical gradient function and 'random'
, in which case a
random direction vector will be used for the same purpose. seed
(default is None
) can be used for reproducing the return value of
check_grad
function. It will be used only when direction='random'
.
The scipy.optimize.minimize
TNC
method has been rewritten to use Cython
bindings. This also fixes an issue with the callback altering the state of the
optimization.
Added optional parameters target_accept_rate
and stepwise_factor
for
adapative step size adjustment in basinhopping
.
The epsilon
argument to approx_fprime
is now optional so that it may
have a default value consistent with most other functions in scipy.optimize
.
scipy.signal
improvementsAdd analog
argument, default False
, to zpk2sos
, and add new pairing
option 'minimal'
to construct analog and minimal discrete SOS arrays.
tf2sos
uses zpk2sos; add analog
argument here as well, and pass it on
to zpk2sos
.
savgol_coeffs
and savgol_filter
now work for even window lengths.
Added the Chirp Z-transform and Zoom FFT available as scipy.signal.CZT
and
scipy.signal.ZoomFFT
.
scipy.sparse
improvementsAn array API has been added for early testing and feedback; this
work is ongoing, and users should expect minor API refinements over
the next few releases. Please refer to the scipy.sparse
docstring for more information.
maximum_flow
introduces optional keyword only argument, method
which accepts either, 'edmonds-karp'
(Edmonds Karp algorithm) or
'dinic'
(Dinic's algorithm). Moreover, 'dinic'
is used as default
value for method
which means that Dinic's algorithm is used for computing
maximum flow unless specified. See, the comparison between the supported
algorithms in
this comment <https://github.com/scipy/scipy/pull/14358#issue-684212523>
_.
Parameters atol
, btol
now default to 1e-6 in
scipy.sparse.linalg.lsmr
to match with default values in
scipy.sparse.linalg.lsqr
.
Add the Transpose-Free Quasi-Minimal Residual algorithm (TFQMR) for general
nonsingular non-Hermitian linear systems in scipy.sparse.linalg.tfqmr
.
The sparse SVD library PROPACK is now vendored with SciPy, and an interface is
exposed via scipy.sparse.svds
with solver='PROPACK'
. For some problems,
this may be faster and/or more accurate than the default, ARPACK.
sparse.linalg
iterative solvers now have a nonzero initial guess option,
which may be specified as x0 = 'Mb'
.
The trace
method has been added for sparse matrices.
scipy.spatial
improvementsscipy.spatial.transform.Rotation
now supports item assignment and has a new
concatenate
method.
Add scipy.spatial.distance.kulczynski1
in favour of
scipy.spatial.distance.kulsinski
which will be deprecated in the next
release.
scipy.spatial.distance.minkowski
now also supports 0<p<1
.
scipy.special
improvementsThe new function scipy.special.log_expit
computes the logarithm of the
logistic sigmoid function. The function is formulated to provide accurate
results for large positive and negative inputs, so it avoids the problems
that would occur in the naive implementation log(expit(x))
.
A suite of five new functions for elliptic integrals:
scipy.special.ellipr{c,d,f,g,j}
. These are the
Carlson symmetric elliptic integrals <https://dlmf.nist.gov/19.16>
_, which
have computational advantages over the classical Legendre integrals. Previous
versions included some elliptic integrals from the Cephes library
(scipy.special.ellip{k,km1,kinc,e,einc}
) but was missing the integral of
third kind (Legendre's Pi), which can be evaluated using the new Carlson
functions. The new Carlson elliptic integral functions can be evaluated in the
complex plane, whereas the Cephes library's functions are only defined for
real inputs.
Several defects in scipy.special.hyp2f1
have been corrected. Approximately
correct values are now returned for z
near exp(+-i*pi/3)
, fixing
#8054 <https://github.com/scipy/scipy/issues/8054>
. Evaluation for such z
is now calculated through a series derived by
López and Temme (2013) <https://arxiv.org/abs/1306.2046>
that converges in
these regions. In addition, degenerate cases with one or more of a
, b
,
and/or c
a non-positive integer are now handled in a manner consistent with
mpmath's hyp2f1 implementation <https://mpmath.org/doc/current/functions/hypergeometric.html>
,
which fixes #7340 <https://github.com/scipy/scipy/issues/7340>
. These fixes
were made as part of an effort to rewrite the Fortran 77 implementation of
hyp2f1 in Cython piece by piece. This rewriting is now roughly 50% complete.
scipy.stats
improvementsscipy.stats.qmc.LatinHypercube
introduces two new optional keyword-only
arguments, optimization
and strength
. optimization
is either
None
or random-cd
. In the latter, random permutations are performed to
improve the centered discrepancy. strength
is either 1 or 2. 1 corresponds
to the classical LHS while 2 has better sub-projection properties. This
construction is referred to as an orthogonal array based LHS of strength 2.
In both cases, the output is still a LHS.
scipy.stats.qmc.Halton
is faster as the underlying Van der Corput sequence
was ported to Cython.
The alternative
parameter was added to the kendalltau
and somersd
functions to allow one-sided hypothesis testing. Similarly, the masked
versions of skewtest
, kurtosistest
, ttest_1samp
, ttest_ind
,
and ttest_rel
now also have an alternative
parameter.
Add scipy.stats.gzscore
to calculate the geometrical z score.
Random variate generators to sample from arbitrary univariate non-uniform
continuous and discrete distributions have been added to the new
scipy.stats.sampling
submodule. Implementations of a C library
UNU.RAN <http://statmath.wu.ac.at/software/unuran/>
_ are used for
performance. The generators added are:
The binned_statistic
set of functions now have improved performance for
the std
, min
, max
, and median
statistic calculations.
somersd
and _tau_b
now have faster Pythran-based implementations.
Some general efficiency improvements to handling of nan
values in
several stats
functions.
Added the Tukey-Kramer test as scipy.stats.tukey_hsd
.
Improved performance of scipy.stats.argus
rvs
method.
Added the parameter keepdims
to scipy.stats.variation
and prevent the
undesirable return of a masked array from the function in some cases.
permutation_test
performs an exact or randomized permutation test of a
given statistic on provided data.
SciPy has always documented what its public API consisted of in
:ref:its API reference docs <scipy-api>
,
however there never was a clear split between public and
private namespaces in the code base. In this release, all namespaces that were
private but happened to miss underscores in their names have been deprecated.
These include (as examples, there are many more):
scipy.signal.spline
scipy.ndimage.filters
scipy.ndimage.fourier
scipy.ndimage.measurements
scipy.ndimage.morphology
scipy.ndimage.interpolation
scipy.sparse.linalg.solve
scipy.sparse.linalg.eigen
scipy.sparse.linalg.isolve
All functions and other objects in these namespaces that were meant to be
public are accessible from their respective public namespace (e.g.
scipy.signal
). The design principle is that any public object must be
accessible from a single namespace only; there are a few exceptions, mostly for
historical reasons (e.g., stats
and stats.distributions
overlap).
For other libraries aiming to provide a SciPy-compatible API, it is now
unambiguous what namespace structure to follow. See
gh-14360 <https://github.com/scipy/scipy/issues/14360>
_ for more details.
NumericalInverseHermite
has been deprecated from scipy.stats
and moved
to the scipy.stats.sampling
submodule. It now uses the C implementation of
the UNU.RAN library so the result of methods like ppf
may vary slightly.
Parameter tol
has been deprecated and renamed to u_resolution
. The
parameter max_intervals
has also been deprecated and will be removed in a
future release of SciPy.
here <https://docs.scipy.org/doc/scipy/reference/dev/toolchain.html>
_.scipy.stats.binned_statistic
with the builtin
'std'
metric is now nan
, for consistency with np.std
.scipy.spatial.distance.wminkowski
has been removed. To achieve
the same results as before, please use the minkowski
distance function
with the (optional) w=
keyword-argument for the given weight.Some Fortran 77 code was modernized to be compatible with NAG's nagfor Fortran
compiler (see, e.g., PR 13229 <https://github.com/scipy/scipy/pull/13229>
_).
threadpoolctl
may now be used by our test suite to substantially improve
the efficiency of parallel test suite runs.
A total of 133 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.
Note: SciPy 1.8.0
is not released yet!
SciPy 1.8.0
is the culmination of 6
months of hard work. It contains
many 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 for DeprecationWarning
s).
Our development attention will now shift to bug-fix releases on the
1.8.x branch, and on adding new features on the master branch.
This release requires Python 3.8
+ and NumPy 1.17.3
or greater.
For running on PyPy, PyPy3 6.0
+ is required.
scipy.sparse.svds
with solver='PROPACK'
.scipy.stats.sampling
submodule that leverages the UNU.RAN
C
library to sample from arbitrary univariate non-uniform continuous and
discrete distributionsscipy.fft
improvementsAdded an orthogonalize=None
parameter to the real transforms in scipy.fft
which controls whether the modified definition of DCT/DST is used without
changing the overall scaling.
scipy.fft
backend registration is now smoother, operating with a single
registration call and no longer requiring a context manager.
scipy.integrate
improvementsscipy.integrate.quad_vec
introduces a new optional keyword-only argument,
args
. args
takes in a tuple of extra arguments if any (default is
args=()
), which is then internally used to pass into the callable function
(needing these extra arguments) which we wish to integrate.
scipy.interpolate
improvementsscipy.interpolate.BSpline
has a new method, design_matrix
, which
constructs a design matrix of b-splines in the sparse CSR format.
A new method from_cubic
in BSpline
class allows to convert a
CubicSpline
object to BSpline
object.
scipy.linalg
improvementsscipy.linalg
gained three new public array structure investigation functions.
scipy.linalg.bandwidth
returns information about the bandedness of an array
and can be used to test for triangular structure discovery, while
scipy.linalg.issymmetric
and scipy.linalg.ishermitian
test the array for
exact and approximate symmetric/Hermitian structure.
scipy.optimize
improvementsscipy.optimize.check_grad
introduces two new optional keyword only arguments,
direction
and seed
. direction
can take values, 'all'
(default),
in which case all the one hot direction vectors will be used for verifying
the input analytical gradient function and 'random'
, in which case a
random direction vector will be used for the same purpose. seed
(default is None
) can be used for reproducing the return value of
check_grad
function. It will be used only when direction='random'
.
The scipy.optimize.minimize
TNC
method has been rewritten to use Cython
bindings. This also fixes an issue with the callback altering the state of the
optimization.
Added optional parameters target_accept_rate
and stepwise_factor
for
adapative step size adjustment in basinhopping
.
The epsilon
argument to approx_fprime
is now optional so that it may
have a default value consistent with most other functions in scipy.optimize
.
scipy.signal
improvementsAdd analog
argument, default False
, to zpk2sos
, and add new pairing
option 'minimal'
to construct analog and minimal discrete SOS arrays.
tf2sos
uses zpk2sos; add analog
argument here as well, and pass it on
to zpk2sos
.
savgol_coeffs
and savgol_filter
now work for even window lengths.
Added the Chirp Z-transform and Zoom FFT available as scipy.signal.CZT
and
scipy.signal.ZoomFFT
.
scipy.sparse
improvementsAn array API has been added for early testing and feedback; this
work is ongoing, and users should expect minor API refinements over
the next few releases. Please refer to the scipy.sparse
docstring for more information.
maximum_flow
introduces optional keyword only argument, method
which accepts either, 'edmonds-karp'
(Edmonds Karp algorithm) or
'dinic'
(Dinic's algorithm). Moreover, 'dinic'
is used as default
value for method
which means that Dinic's algorithm is used for computing
maximum flow unless specified. See, the comparison between the supported
algorithms in
this comment <https://github.com/scipy/scipy/pull/14358#issue-684212523>
_.
Parameters atol
, btol
now default to 1e-6 in
scipy.sparse.linalg.lsmr
to match with default values in
scipy.sparse.linalg.lsqr
.
Add the Transpose-Free Quasi-Minimal Residual algorithm (TFQMR) for general
nonsingular non-Hermitian linear systems in scipy.sparse.linalg.tfqmr
.
The sparse SVD library PROPACK is now vendored with SciPy, and an interface is
exposed via scipy.sparse.svds
with solver='PROPACK'
. For some problems,
this may be faster and/or more accurate than the default, ARPACK.
sparse.linalg
iterative solvers now have a nonzero initial guess option,
which may be specified as x0 = 'Mb'
.
The trace
method has been added for sparse matrices.
scipy.spatial
improvementsscipy.spatial.transform.Rotation
now supports item assignment and has a new
concatenate
method.
Add scipy.spatial.distance.kulczynski1
in favour of
scipy.spatial.distance.kulsinski
which will be deprecated in the next
release.
scipy.spatial.distance.minkowski
now also supports 0<p<1
.
scipy.special
improvementsThe new function scipy.special.log_expit
computes the logarithm of the
logistic sigmoid function. The function is formulated to provide accurate
results for large positive and negative inputs, so it avoids the problems
that would occur in the naive implementation log(expit(x))
.
A suite of five new functions for elliptic integrals:
scipy.special.ellipr{c,d,f,g,j}
. These are the
Carlson symmetric elliptic integrals <https://dlmf.nist.gov/19.16>
_, which
have computational advantages over the classical Legendre integrals. Previous
versions included some elliptic integrals from the Cephes library
(scipy.special.ellip{k,km1,kinc,e,einc}
) but was missing the integral of
third kind (Legendre's Pi), which can be evaluated using the new Carlson
functions. The new Carlson elliptic integral functions can be evaluated in the
complex plane, whereas the Cephes library's functions are only defined for
real inputs.
Several defects in scipy.special.hyp2f1
have been corrected. Approximately
correct values are now returned for z
near exp(+-i*pi/3)
, fixing
#8054 <https://github.com/scipy/scipy/issues/8054>
. Evaluation for such z
is now calculated through a series derived by
López and Temme (2013) <https://arxiv.org/abs/1306.2046>
that converges in
these regions. In addition, degenerate cases with one or more of a
, b
,
and/or c
a non-positive integer are now handled in a manner consistent with
mpmath's hyp2f1 implementation <https://mpmath.org/doc/current/functions/hypergeometric.html>
,
which fixes #7340 <https://github.com/scipy/scipy/issues/7340>
. These fixes
were made as part of an effort to rewrite the Fortran 77 implementation of
hyp2f1 in Cython piece by piece. This rewriting is now roughly 50% complete.
scipy.stats
improvementsscipy.stats.qmc.LatinHypercube
introduces two new optional keyword-only
arguments, optimization
and strength
. optimization
is either
None
or random-cd
. In the latter, random permutations are performed to
improve the centered discrepancy. strength
is either 1 or 2. 1 corresponds
to the classical LHS while 2 has better sub-projection properties. This
construction is referred to as an orthogonal array based LHS of strength 2.
In both cases, the output is still a LHS.
scipy.stats.qmc.Halton
is faster as the underlying Van der Corput sequence
was ported to Cython.
The alternative
parameter was added to the kendalltau
and somersd
functions to allow one-sided hypothesis testing. Similarly, the masked
versions of skewtest
, kurtosistest
, ttest_1samp
, ttest_ind
,
and ttest_rel
now also have an alternative
parameter.
Add scipy.stats.gzscore
to calculate the geometrical z score.
Random variate generators to sample from arbitrary univariate non-uniform
continuous and discrete distributions have been added to the new
scipy.stats.sampling
submodule. Implementations of a C library
UNU.RAN <http://statmath.wu.ac.at/software/unuran/>
_ are used for
performance. The generators added are:
The binned_statistic
set of functions now have improved performance for
the std
, min
, max
, and median
statistic calculations.
somersd
and _tau_b
now have faster Pythran-based implementations.
Some general efficiency improvements to handling of nan
values in
several stats
functions.
Added the Tukey-Kramer test as scipy.stats.tukey_hsd
.
Improved performance of scipy.stats.argus
rvs
method.
Added the parameter keepdims
to scipy.stats.variation
and prevent the
undesirable return of a masked array from the function in some cases.
permutation_test
performs an exact or randomized permutation test of a
given statistic on provided data.
SciPy has always documented what its public API consisted of in
:ref:its API reference docs <scipy-api>
,
however there never was a clear split between public and
private namespaces in the code base. In this release, all namespaces that were
private but happened to miss underscores in their names have been deprecated.
These include (as examples, there are many more):
scipy.signal.spline
scipy.ndimage.filters
scipy.ndimage.fourier
scipy.ndimage.measurements
scipy.ndimage.morphology
scipy.ndimage.interpolation
scipy.sparse.linalg.solve
scipy.sparse.linalg.eigen
scipy.sparse.linalg.isolve
All functions and other objects in these namespaces that were meant to be
public are accessible from their respective public namespace (e.g.
scipy.signal
). The design principle is that any public object must be
accessible from a single namespace only; there are a few exceptions, mostly for
historical reasons (e.g., stats
and stats.distributions
overlap).
For other libraries aiming to provide a SciPy-compatible API, it is now
unambiguous what namespace structure to follow. See
gh-14360 <https://github.com/scipy/scipy/issues/14360>
_ for more details.
NumericalInverseHermite
has been deprecated from scipy.stats
and moved
to the scipy.stats.sampling
submodule. It now uses the C implementation of
the UNU.RAN library so the result of methods like ppf
may vary slightly.
Parameter tol
has been deprecated and renamed to u_resolution
. The
parameter max_intervals
has also been deprecated and will be removed in a
future release of SciPy.
here <https://docs.scipy.org/doc/scipy/reference/dev/toolchain.html>
_.scipy.stats.binned_statistic
with the builtin
'std'
metric is now nan
, for consistency with np.std
.scipy.spatial.distance.wminkowski
has been removed. To achieve
the same results as before, please use the minkowski
distance function
with the (optional) w=
keyword-argument for the given weight.Some Fortran 77 code was modernized to be compatible with NAG's nagfor Fortran
compiler (see, e.g., PR 13229 <https://github.com/scipy/scipy/pull/13229>
_).
threadpoolctl
may now be used by our test suite to substantially improve
the efficiency of parallel test suite runs.
A total of 132 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.
SciPy 1.7.3
is a bug-fix release that provides binary wheels
for MacOS arm64 with Python 3.8
, 3.9
, and 3.10
. The MacOS arm64 wheels
are only available for MacOS version 12.0
and greater, as explained
in Issue 14688.
A total of 6 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.