SciPy 0.19.0 Release Notes#
Contents
-
-
scipy.linalg
improvementsscipy.spatial
improvementsscipy.ndimage
improvementsscipy.optimize
improvementsscipy.signal
improvementsscipy.fftpack
improvementsscipy.cluster
improvementsscipy.sparse
improvementsscipy.special
improvementsscipy.stats
improvementsscipy.interpolate
improvementsscipy.integrate
improvements
-
SciPy 0.19.0 is the culmination of 7 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. Moreover, our development attention will now shift to bug-fix releases on the 0.19.x branch, and on adding new features on the master branch.
This release requires Python 2.7 or 3.4-3.6 and NumPy 1.8.2 or greater.
Highlights of this release include:
A unified foreign function interface layer,
scipy.LowLevelCallable
.Cython API for scalar, typed versions of the universal functions from the
scipy.special
module, via cimport scipy.special.cython_special.
New features#
Foreign function interface improvements#
scipy.LowLevelCallable
provides a new unified interface for wrapping
low-level compiled callback functions in the Python space. It supports
Cython imported “api” functions, ctypes function pointers, CFFI function
pointers, PyCapsules
, Numba jitted functions and more.
See gh-6509 for details.
scipy.linalg
improvements#
The function scipy.linalg.solve
obtained two more keywords assume_a
and
transposed
. The underlying LAPACK routines are replaced with “expert”
versions and now can also be used to solve symmetric, hermitian and positive
definite coefficient matrices. Moreover, ill-conditioned matrices now cause
a warning to be emitted with the estimated condition number information. Old
sym_pos
keyword is kept for backwards compatibility reasons however it
is identical to using assume_a='pos'
. Moreover, the debug
keyword,
which had no function but only printing the overwrite_<a, b>
values, is
deprecated.
The function scipy.linalg.matrix_balance
was added to perform the so-called
matrix balancing using the LAPACK xGEBAL routine family. This can be used to
approximately equate the row and column norms through diagonal similarity
transformations.
The functions scipy.linalg.solve_continuous_are
and
scipy.linalg.solve_discrete_are
have numerically more stable algorithms.
These functions can also solve generalized algebraic matrix Riccati equations.
Moreover, both gained a balanced
keyword to turn balancing on and off.
scipy.spatial
improvements#
scipy.spatial.SphericalVoronoi.sort_vertices_of_regions
has been re-written in
Cython to improve performance.
scipy.spatial.SphericalVoronoi
can handle > 200 k points (at least 10 million)
and has improved performance.
The function scipy.spatial.distance.directed_hausdorff
was
added to calculate the directed Hausdorff distance.
count_neighbors
method of scipy.spatial.cKDTree
gained an ability to
perform weighted pair counting via the new keywords weights
and
cumulative
. See gh-5647 for
details.
scipy.spatial.distance.pdist
and scipy.spatial.distance.cdist
now support
non-double custom metrics.
scipy.ndimage
improvements#
The callback function C API supports PyCapsules in Python 2.7
Multidimensional filters now allow having different extrapolation modes for different axes.
scipy.optimize
improvements#
The scipy.optimize.basinhopping
global minimizer obtained a new keyword,
seed, which can be used to seed the random number generator and obtain
repeatable minimizations.
The keyword sigma in scipy.optimize.curve_fit
was overloaded to also accept
the covariance matrix of errors in the data.
scipy.signal
improvements#
The function scipy.signal.correlate
and scipy.signal.convolve
have a new
optional parameter method. The default value of auto estimates the fastest
of two computation methods, the direct approach and the Fourier transform
approach.
A new function has been added to choose the convolution/correlation method,
scipy.signal.choose_conv_method
which may be appropriate if convolutions or
correlations are performed on many arrays of the same size.
New functions have been added to calculate complex short time fourier
transforms of an input signal, and to invert the transform to recover the
original signal: scipy.signal.stft
and scipy.signal.istft
. This
implementation also fixes the previously incorrect output of
scipy.signal.spectrogram
when complex output data were requested.
The function scipy.signal.sosfreqz
was added to compute the frequency
response from second-order sections.
The function scipy.signal.unit_impulse
was added to conveniently
generate an impulse function.
The function scipy.signal.iirnotch
was added to design second-order
IIR notch filters that can be used to remove a frequency component from
a signal. The dual function scipy.signal.iirpeak
was added to
compute the coefficients of a second-order IIR peak (resonant) filter.
The function scipy.signal.minimum_phase
was added to convert linear-phase
FIR filters to minimum phase.
The functions scipy.signal.upfirdn
and scipy.signal.resample_poly
are now
substantially faster when operating on some n-dimensional arrays when n > 1.
The largest reduction in computation time is realized in cases where the size
of the array is small (<1k samples or so) along the axis to be filtered.
scipy.fftpack
improvements#
Fast Fourier transform routines now accept np.float16 inputs and upcast them to np.float32. Previously, they would raise an error.
scipy.cluster
improvements#
Methods "centroid"
and "median"
of scipy.cluster.hierarchy.linkage
have been significantly sped up. Long-standing issues with using linkage
on
large input data (over 16 GB) have been resolved.
scipy.sparse
improvements#
The functions scipy.sparse.save_npz
and scipy.sparse.load_npz
were added,
providing simple serialization for some sparse formats.
The prune method of classes bsr_matrix, csc_matrix, and csr_matrix was updated to reallocate backing arrays under certain conditions, reducing memory usage.
The methods argmin and argmax were added to classes coo_matrix, csc_matrix, csr_matrix, and bsr_matrix.
New function scipy.sparse.csgraph.structural_rank
computes the structural
rank of a graph with a given sparsity pattern.
New function scipy.sparse.linalg.spsolve_triangular
solves a sparse linear
system with a triangular left hand side matrix.
scipy.special
improvements#
Scalar, typed versions of universal functions from scipy.special
are available
in the Cython space via cimport
from the new module
scipy.special.cython_special
. These scalar functions can be expected to be
significantly faster then the universal functions for scalar arguments. See
the scipy.special
tutorial for details.
Better control over special-function errors is offered by the
functions scipy.special.geterr
and scipy.special.seterr
and the
context manager scipy.special.errstate
.
The names of orthogonal polynomial root functions have been changed to
be consistent with other functions relating to orthogonal
polynomials. For example, scipy.special.j_roots
has been renamed
scipy.special.roots_jacobi
for consistency with the related
functions scipy.special.jacobi
and scipy.special.eval_jacobi
. To
preserve back-compatibility the old names have been left as aliases.
Wright Omega function is implemented as scipy.special.wrightomega
.
scipy.stats
improvements#
The function scipy.stats.weightedtau
was added. It provides a weighted
version of Kendall’s tau.
New class scipy.stats.multinomial
implements the multinomial distribution.
New class scipy.stats.rv_histogram
constructs a continuous univariate
distribution with a piecewise linear CDF from a binned data sample.
New class scipy.stats.argus
implements the Argus distribution.
scipy.interpolate
improvements#
New class scipy.interpolate.BSpline
represents splines. BSpline
objects
contain knots and coefficients and can evaluate the spline. The format is
consistent with FITPACK, so that one can do, for example:
>>> t, c, k = splrep(x, y, s=0)
>>> spl = BSpline(t, c, k)
>>> np.allclose(spl(x), y)
spl*
functions, scipy.interpolate.splev
, scipy.interpolate.splint
,
scipy.interpolate.splder
and scipy.interpolate.splantider
, accept both
BSpline
objects and (t, c, k)
tuples for backwards compatibility.
For multidimensional splines, c.ndim > 1
, BSpline
objects are consistent
with piecewise polynomials, scipy.interpolate.PPoly
. This means that
BSpline
objects are not immediately consistent with
scipy.interpolate.splprep
, and one cannot do
>>> BSpline(*splprep([x, y])[0])
. Consult the scipy.interpolate
test suite
for examples of the precise equivalence.
In new code, prefer using scipy.interpolate.BSpline
objects instead of
manipulating (t, c, k)
tuples directly.
New function scipy.interpolate.make_interp_spline
constructs an interpolating
spline given data points and boundary conditions.
New function scipy.interpolate.make_lsq_spline
constructs a least-squares
spline approximation given data points.
scipy.integrate
improvements#
Now scipy.integrate.fixed_quad
supports vector-valued functions.
Deprecated features#
scipy.interpolate.splmake, scipy.interpolate.spleval and scipy.interpolate.spline are deprecated. The format used by splmake/spleval was inconsistent with splrep/splev which was confusing to users.
scipy.special.errprint is deprecated. Improved functionality is
available in scipy.special.seterr
.
calling scipy.spatial.distance.pdist
or scipy.spatial.distance.cdist
with
arguments not needed by the chosen metric is deprecated. Also, metrics
“old_cosine” and “old_cos” are deprecated.
Backwards incompatible changes#
The deprecated scipy.weave
submodule was removed.
scipy.spatial.distance.squareform
now returns arrays of the same dtype as
the input, instead of always float64.
scipy.special.errprint now returns a boolean.
The function scipy.signal.find_peaks_cwt
now returns an array instead of
a list.
scipy.stats.kendalltau
now computes the correct p-value in case the
input contains ties. The p-value is also identical to that computed by
scipy.stats.mstats.kendalltau
and by R. If the input does not
contain ties there is no change w.r.t. the previous implementation.
The function scipy.linalg.block_diag
will not ignore zero-sized matrices anymore.
Instead it will insert rows or columns of zeros of the appropriate size.
See gh-4908 for more details.
Other changes#
SciPy wheels will now report their dependency on numpy
on all platforms.
This change was made because Numpy wheels are available, and because the pip
upgrade behavior is finally changing for the better (use
--upgrade-strategy=only-if-needed
for pip >= 8.2
; that behavior will
become the default in the next major version of pip
).
Numerical values returned by scipy.interpolate.interp1d
with kind="cubic"
and "quadratic"
may change relative to previous scipy versions. If your
code depended on specific numeric values (i.e., on implementation
details of the interpolators), you may want to double-check your results.