scipy 1.16.1__cp314-cp314-musllinux_1_2_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scipy/__config__.py +161 -0
- scipy/__init__.py +138 -0
- scipy/_cyutility.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/_distributor_init.py +18 -0
- scipy/_lib/__init__.py +14 -0
- scipy/_lib/_array_api.py +931 -0
- scipy/_lib/_array_api_compat_vendor.py +9 -0
- scipy/_lib/_array_api_no_0d.py +103 -0
- scipy/_lib/_bunch.py +229 -0
- scipy/_lib/_ccallback.py +251 -0
- scipy/_lib/_ccallback_c.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/_lib/_disjoint_set.py +254 -0
- scipy/_lib/_docscrape.py +761 -0
- scipy/_lib/_elementwise_iterative_method.py +346 -0
- scipy/_lib/_fpumode.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/_lib/_gcutils.py +105 -0
- scipy/_lib/_pep440.py +487 -0
- scipy/_lib/_sparse.py +41 -0
- scipy/_lib/_test_ccallback.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/_lib/_test_deprecation_call.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/_lib/_test_deprecation_def.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/_lib/_testutils.py +373 -0
- scipy/_lib/_threadsafety.py +58 -0
- scipy/_lib/_tmpdirs.py +86 -0
- scipy/_lib/_uarray/LICENSE +29 -0
- scipy/_lib/_uarray/__init__.py +116 -0
- scipy/_lib/_uarray/_backend.py +707 -0
- scipy/_lib/_uarray/_uarray.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/_lib/_util.py +1283 -0
- scipy/_lib/array_api_compat/__init__.py +22 -0
- scipy/_lib/array_api_compat/_internal.py +59 -0
- scipy/_lib/array_api_compat/common/__init__.py +1 -0
- scipy/_lib/array_api_compat/common/_aliases.py +727 -0
- scipy/_lib/array_api_compat/common/_fft.py +213 -0
- scipy/_lib/array_api_compat/common/_helpers.py +1058 -0
- scipy/_lib/array_api_compat/common/_linalg.py +232 -0
- scipy/_lib/array_api_compat/common/_typing.py +192 -0
- scipy/_lib/array_api_compat/cupy/__init__.py +13 -0
- scipy/_lib/array_api_compat/cupy/_aliases.py +156 -0
- scipy/_lib/array_api_compat/cupy/_info.py +336 -0
- scipy/_lib/array_api_compat/cupy/_typing.py +31 -0
- scipy/_lib/array_api_compat/cupy/fft.py +36 -0
- scipy/_lib/array_api_compat/cupy/linalg.py +49 -0
- scipy/_lib/array_api_compat/dask/__init__.py +0 -0
- scipy/_lib/array_api_compat/dask/array/__init__.py +12 -0
- scipy/_lib/array_api_compat/dask/array/_aliases.py +376 -0
- scipy/_lib/array_api_compat/dask/array/_info.py +416 -0
- scipy/_lib/array_api_compat/dask/array/fft.py +21 -0
- scipy/_lib/array_api_compat/dask/array/linalg.py +72 -0
- scipy/_lib/array_api_compat/numpy/__init__.py +28 -0
- scipy/_lib/array_api_compat/numpy/_aliases.py +190 -0
- scipy/_lib/array_api_compat/numpy/_info.py +366 -0
- scipy/_lib/array_api_compat/numpy/_typing.py +30 -0
- scipy/_lib/array_api_compat/numpy/fft.py +35 -0
- scipy/_lib/array_api_compat/numpy/linalg.py +143 -0
- scipy/_lib/array_api_compat/torch/__init__.py +22 -0
- scipy/_lib/array_api_compat/torch/_aliases.py +855 -0
- scipy/_lib/array_api_compat/torch/_info.py +369 -0
- scipy/_lib/array_api_compat/torch/_typing.py +3 -0
- scipy/_lib/array_api_compat/torch/fft.py +85 -0
- scipy/_lib/array_api_compat/torch/linalg.py +121 -0
- scipy/_lib/array_api_extra/__init__.py +38 -0
- scipy/_lib/array_api_extra/_delegation.py +171 -0
- scipy/_lib/array_api_extra/_lib/__init__.py +1 -0
- scipy/_lib/array_api_extra/_lib/_at.py +463 -0
- scipy/_lib/array_api_extra/_lib/_backends.py +46 -0
- scipy/_lib/array_api_extra/_lib/_funcs.py +937 -0
- scipy/_lib/array_api_extra/_lib/_lazy.py +357 -0
- scipy/_lib/array_api_extra/_lib/_testing.py +278 -0
- scipy/_lib/array_api_extra/_lib/_utils/__init__.py +1 -0
- scipy/_lib/array_api_extra/_lib/_utils/_compat.py +74 -0
- scipy/_lib/array_api_extra/_lib/_utils/_compat.pyi +45 -0
- scipy/_lib/array_api_extra/_lib/_utils/_helpers.py +559 -0
- scipy/_lib/array_api_extra/_lib/_utils/_typing.py +10 -0
- scipy/_lib/array_api_extra/_lib/_utils/_typing.pyi +105 -0
- scipy/_lib/array_api_extra/testing.py +359 -0
- scipy/_lib/cobyqa/__init__.py +20 -0
- scipy/_lib/cobyqa/framework.py +1240 -0
- scipy/_lib/cobyqa/main.py +1506 -0
- scipy/_lib/cobyqa/models.py +1529 -0
- scipy/_lib/cobyqa/problem.py +1296 -0
- scipy/_lib/cobyqa/settings.py +132 -0
- scipy/_lib/cobyqa/subsolvers/__init__.py +14 -0
- scipy/_lib/cobyqa/subsolvers/geometry.py +387 -0
- scipy/_lib/cobyqa/subsolvers/optim.py +1203 -0
- scipy/_lib/cobyqa/utils/__init__.py +18 -0
- scipy/_lib/cobyqa/utils/exceptions.py +22 -0
- scipy/_lib/cobyqa/utils/math.py +77 -0
- scipy/_lib/cobyqa/utils/versions.py +67 -0
- scipy/_lib/decorator.py +399 -0
- scipy/_lib/deprecation.py +274 -0
- scipy/_lib/doccer.py +366 -0
- scipy/_lib/messagestream.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/_lib/pyprima/__init__.py +212 -0
- scipy/_lib/pyprima/cobyla/__init__.py +0 -0
- scipy/_lib/pyprima/cobyla/cobyla.py +559 -0
- scipy/_lib/pyprima/cobyla/cobylb.py +714 -0
- scipy/_lib/pyprima/cobyla/geometry.py +226 -0
- scipy/_lib/pyprima/cobyla/initialize.py +215 -0
- scipy/_lib/pyprima/cobyla/trustregion.py +492 -0
- scipy/_lib/pyprima/cobyla/update.py +289 -0
- scipy/_lib/pyprima/common/__init__.py +0 -0
- scipy/_lib/pyprima/common/_bounds.py +34 -0
- scipy/_lib/pyprima/common/_linear_constraints.py +46 -0
- scipy/_lib/pyprima/common/_nonlinear_constraints.py +54 -0
- scipy/_lib/pyprima/common/_project.py +173 -0
- scipy/_lib/pyprima/common/checkbreak.py +93 -0
- scipy/_lib/pyprima/common/consts.py +47 -0
- scipy/_lib/pyprima/common/evaluate.py +99 -0
- scipy/_lib/pyprima/common/history.py +38 -0
- scipy/_lib/pyprima/common/infos.py +30 -0
- scipy/_lib/pyprima/common/linalg.py +435 -0
- scipy/_lib/pyprima/common/message.py +290 -0
- scipy/_lib/pyprima/common/powalg.py +131 -0
- scipy/_lib/pyprima/common/preproc.py +277 -0
- scipy/_lib/pyprima/common/present.py +5 -0
- scipy/_lib/pyprima/common/ratio.py +54 -0
- scipy/_lib/pyprima/common/redrho.py +47 -0
- scipy/_lib/pyprima/common/selectx.py +296 -0
- scipy/_lib/tests/__init__.py +0 -0
- scipy/_lib/tests/test__gcutils.py +110 -0
- scipy/_lib/tests/test__pep440.py +67 -0
- scipy/_lib/tests/test__testutils.py +32 -0
- scipy/_lib/tests/test__threadsafety.py +51 -0
- scipy/_lib/tests/test__util.py +641 -0
- scipy/_lib/tests/test_array_api.py +322 -0
- scipy/_lib/tests/test_bunch.py +169 -0
- scipy/_lib/tests/test_ccallback.py +196 -0
- scipy/_lib/tests/test_config.py +45 -0
- scipy/_lib/tests/test_deprecation.py +10 -0
- scipy/_lib/tests/test_doccer.py +143 -0
- scipy/_lib/tests/test_import_cycles.py +18 -0
- scipy/_lib/tests/test_public_api.py +482 -0
- scipy/_lib/tests/test_scipy_version.py +28 -0
- scipy/_lib/tests/test_tmpdirs.py +48 -0
- scipy/_lib/tests/test_warnings.py +137 -0
- scipy/_lib/uarray.py +31 -0
- scipy/cluster/__init__.py +31 -0
- scipy/cluster/_hierarchy.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/cluster/_optimal_leaf_ordering.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/cluster/_vq.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/cluster/hierarchy.py +4348 -0
- scipy/cluster/tests/__init__.py +0 -0
- scipy/cluster/tests/hierarchy_test_data.py +145 -0
- scipy/cluster/tests/test_disjoint_set.py +202 -0
- scipy/cluster/tests/test_hierarchy.py +1238 -0
- scipy/cluster/tests/test_vq.py +434 -0
- scipy/cluster/vq.py +832 -0
- scipy/conftest.py +683 -0
- scipy/constants/__init__.py +358 -0
- scipy/constants/_codata.py +2266 -0
- scipy/constants/_constants.py +369 -0
- scipy/constants/codata.py +21 -0
- scipy/constants/constants.py +53 -0
- scipy/constants/tests/__init__.py +0 -0
- scipy/constants/tests/test_codata.py +78 -0
- scipy/constants/tests/test_constants.py +83 -0
- scipy/datasets/__init__.py +90 -0
- scipy/datasets/_download_all.py +71 -0
- scipy/datasets/_fetchers.py +225 -0
- scipy/datasets/_registry.py +26 -0
- scipy/datasets/_utils.py +81 -0
- scipy/datasets/tests/__init__.py +0 -0
- scipy/datasets/tests/test_data.py +128 -0
- scipy/differentiate/__init__.py +27 -0
- scipy/differentiate/_differentiate.py +1129 -0
- scipy/differentiate/tests/__init__.py +0 -0
- scipy/differentiate/tests/test_differentiate.py +694 -0
- scipy/fft/__init__.py +114 -0
- scipy/fft/_backend.py +196 -0
- scipy/fft/_basic.py +1650 -0
- scipy/fft/_basic_backend.py +197 -0
- scipy/fft/_debug_backends.py +22 -0
- scipy/fft/_fftlog.py +223 -0
- scipy/fft/_fftlog_backend.py +200 -0
- scipy/fft/_helper.py +348 -0
- scipy/fft/_pocketfft/LICENSE.md +25 -0
- scipy/fft/_pocketfft/__init__.py +9 -0
- scipy/fft/_pocketfft/basic.py +251 -0
- scipy/fft/_pocketfft/helper.py +249 -0
- scipy/fft/_pocketfft/pypocketfft.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/fft/_pocketfft/realtransforms.py +109 -0
- scipy/fft/_pocketfft/tests/__init__.py +0 -0
- scipy/fft/_pocketfft/tests/test_basic.py +1011 -0
- scipy/fft/_pocketfft/tests/test_real_transforms.py +505 -0
- scipy/fft/_realtransforms.py +706 -0
- scipy/fft/_realtransforms_backend.py +63 -0
- scipy/fft/tests/__init__.py +0 -0
- scipy/fft/tests/mock_backend.py +96 -0
- scipy/fft/tests/test_backend.py +98 -0
- scipy/fft/tests/test_basic.py +504 -0
- scipy/fft/tests/test_fftlog.py +215 -0
- scipy/fft/tests/test_helper.py +558 -0
- scipy/fft/tests/test_multithreading.py +84 -0
- scipy/fft/tests/test_real_transforms.py +247 -0
- scipy/fftpack/__init__.py +103 -0
- scipy/fftpack/_basic.py +428 -0
- scipy/fftpack/_helper.py +115 -0
- scipy/fftpack/_pseudo_diffs.py +554 -0
- scipy/fftpack/_realtransforms.py +598 -0
- scipy/fftpack/basic.py +20 -0
- scipy/fftpack/convolve.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/fftpack/helper.py +19 -0
- scipy/fftpack/pseudo_diffs.py +22 -0
- scipy/fftpack/realtransforms.py +19 -0
- scipy/fftpack/tests/__init__.py +0 -0
- scipy/fftpack/tests/fftw_double_ref.npz +0 -0
- scipy/fftpack/tests/fftw_longdouble_ref.npz +0 -0
- scipy/fftpack/tests/fftw_single_ref.npz +0 -0
- scipy/fftpack/tests/test.npz +0 -0
- scipy/fftpack/tests/test_basic.py +877 -0
- scipy/fftpack/tests/test_helper.py +54 -0
- scipy/fftpack/tests/test_import.py +33 -0
- scipy/fftpack/tests/test_pseudo_diffs.py +388 -0
- scipy/fftpack/tests/test_real_transforms.py +836 -0
- scipy/integrate/__init__.py +122 -0
- scipy/integrate/_bvp.py +1160 -0
- scipy/integrate/_cubature.py +729 -0
- scipy/integrate/_dop.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/integrate/_ivp/__init__.py +8 -0
- scipy/integrate/_ivp/base.py +290 -0
- scipy/integrate/_ivp/bdf.py +478 -0
- scipy/integrate/_ivp/common.py +451 -0
- scipy/integrate/_ivp/dop853_coefficients.py +193 -0
- scipy/integrate/_ivp/ivp.py +755 -0
- scipy/integrate/_ivp/lsoda.py +224 -0
- scipy/integrate/_ivp/radau.py +572 -0
- scipy/integrate/_ivp/rk.py +601 -0
- scipy/integrate/_ivp/tests/__init__.py +0 -0
- scipy/integrate/_ivp/tests/test_ivp.py +1287 -0
- scipy/integrate/_ivp/tests/test_rk.py +37 -0
- scipy/integrate/_lebedev.py +5450 -0
- scipy/integrate/_lsoda.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/integrate/_ode.py +1395 -0
- scipy/integrate/_odepack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/integrate/_odepack_py.py +273 -0
- scipy/integrate/_quad_vec.py +674 -0
- scipy/integrate/_quadpack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/integrate/_quadpack_py.py +1283 -0
- scipy/integrate/_quadrature.py +1336 -0
- scipy/integrate/_rules/__init__.py +12 -0
- scipy/integrate/_rules/_base.py +518 -0
- scipy/integrate/_rules/_gauss_kronrod.py +202 -0
- scipy/integrate/_rules/_gauss_legendre.py +62 -0
- scipy/integrate/_rules/_genz_malik.py +210 -0
- scipy/integrate/_tanhsinh.py +1385 -0
- scipy/integrate/_test_multivariate.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/integrate/_test_odeint_banded.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/integrate/_vode.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/integrate/dop.py +15 -0
- scipy/integrate/lsoda.py +15 -0
- scipy/integrate/odepack.py +17 -0
- scipy/integrate/quadpack.py +23 -0
- scipy/integrate/tests/__init__.py +0 -0
- scipy/integrate/tests/test__quad_vec.py +211 -0
- scipy/integrate/tests/test_banded_ode_solvers.py +305 -0
- scipy/integrate/tests/test_bvp.py +714 -0
- scipy/integrate/tests/test_cubature.py +1375 -0
- scipy/integrate/tests/test_integrate.py +840 -0
- scipy/integrate/tests/test_odeint_jac.py +74 -0
- scipy/integrate/tests/test_quadpack.py +680 -0
- scipy/integrate/tests/test_quadrature.py +730 -0
- scipy/integrate/tests/test_tanhsinh.py +1171 -0
- scipy/integrate/vode.py +15 -0
- scipy/interpolate/__init__.py +228 -0
- scipy/interpolate/_bary_rational.py +715 -0
- scipy/interpolate/_bsplines.py +2469 -0
- scipy/interpolate/_cubic.py +973 -0
- scipy/interpolate/_dfitpack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/interpolate/_dierckx.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/interpolate/_fitpack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/interpolate/_fitpack2.py +2397 -0
- scipy/interpolate/_fitpack_impl.py +811 -0
- scipy/interpolate/_fitpack_py.py +898 -0
- scipy/interpolate/_fitpack_repro.py +996 -0
- scipy/interpolate/_interpnd.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/interpolate/_interpolate.py +2266 -0
- scipy/interpolate/_ndbspline.py +415 -0
- scipy/interpolate/_ndgriddata.py +329 -0
- scipy/interpolate/_pade.py +67 -0
- scipy/interpolate/_polyint.py +1025 -0
- scipy/interpolate/_ppoly.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/interpolate/_rbf.py +290 -0
- scipy/interpolate/_rbfinterp.py +550 -0
- scipy/interpolate/_rbfinterp_pythran.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/interpolate/_rgi.py +764 -0
- scipy/interpolate/_rgi_cython.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/interpolate/dfitpack.py +24 -0
- scipy/interpolate/fitpack.py +31 -0
- scipy/interpolate/fitpack2.py +29 -0
- scipy/interpolate/interpnd.py +24 -0
- scipy/interpolate/interpolate.py +30 -0
- scipy/interpolate/ndgriddata.py +23 -0
- scipy/interpolate/polyint.py +24 -0
- scipy/interpolate/rbf.py +18 -0
- scipy/interpolate/tests/__init__.py +0 -0
- scipy/interpolate/tests/data/bug-1310.npz +0 -0
- scipy/interpolate/tests/data/estimate_gradients_hang.npy +0 -0
- scipy/interpolate/tests/data/gcvspl.npz +0 -0
- scipy/interpolate/tests/test_bary_rational.py +368 -0
- scipy/interpolate/tests/test_bsplines.py +3754 -0
- scipy/interpolate/tests/test_fitpack.py +519 -0
- scipy/interpolate/tests/test_fitpack2.py +1431 -0
- scipy/interpolate/tests/test_gil.py +64 -0
- scipy/interpolate/tests/test_interpnd.py +452 -0
- scipy/interpolate/tests/test_interpolate.py +2630 -0
- scipy/interpolate/tests/test_ndgriddata.py +308 -0
- scipy/interpolate/tests/test_pade.py +107 -0
- scipy/interpolate/tests/test_polyint.py +972 -0
- scipy/interpolate/tests/test_rbf.py +246 -0
- scipy/interpolate/tests/test_rbfinterp.py +534 -0
- scipy/interpolate/tests/test_rgi.py +1151 -0
- scipy/io/__init__.py +116 -0
- scipy/io/_fast_matrix_market/__init__.py +600 -0
- scipy/io/_fast_matrix_market/_fmm_core.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/io/_fortran.py +354 -0
- scipy/io/_harwell_boeing/__init__.py +7 -0
- scipy/io/_harwell_boeing/_fortran_format_parser.py +316 -0
- scipy/io/_harwell_boeing/hb.py +571 -0
- scipy/io/_harwell_boeing/tests/__init__.py +0 -0
- scipy/io/_harwell_boeing/tests/test_fortran_format.py +74 -0
- scipy/io/_harwell_boeing/tests/test_hb.py +70 -0
- scipy/io/_idl.py +917 -0
- scipy/io/_mmio.py +968 -0
- scipy/io/_netcdf.py +1104 -0
- scipy/io/_test_fortran.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/io/arff/__init__.py +28 -0
- scipy/io/arff/_arffread.py +873 -0
- scipy/io/arff/arffread.py +19 -0
- scipy/io/arff/tests/__init__.py +0 -0
- scipy/io/arff/tests/data/iris.arff +225 -0
- scipy/io/arff/tests/data/missing.arff +8 -0
- scipy/io/arff/tests/data/nodata.arff +11 -0
- scipy/io/arff/tests/data/quoted_nominal.arff +13 -0
- scipy/io/arff/tests/data/quoted_nominal_spaces.arff +13 -0
- scipy/io/arff/tests/data/test1.arff +10 -0
- scipy/io/arff/tests/data/test10.arff +8 -0
- scipy/io/arff/tests/data/test11.arff +11 -0
- scipy/io/arff/tests/data/test2.arff +15 -0
- scipy/io/arff/tests/data/test3.arff +6 -0
- scipy/io/arff/tests/data/test4.arff +11 -0
- scipy/io/arff/tests/data/test5.arff +26 -0
- scipy/io/arff/tests/data/test6.arff +12 -0
- scipy/io/arff/tests/data/test7.arff +15 -0
- scipy/io/arff/tests/data/test8.arff +12 -0
- scipy/io/arff/tests/data/test9.arff +14 -0
- scipy/io/arff/tests/test_arffread.py +421 -0
- scipy/io/harwell_boeing.py +17 -0
- scipy/io/idl.py +17 -0
- scipy/io/matlab/__init__.py +66 -0
- scipy/io/matlab/_byteordercodes.py +75 -0
- scipy/io/matlab/_mio.py +375 -0
- scipy/io/matlab/_mio4.py +632 -0
- scipy/io/matlab/_mio5.py +901 -0
- scipy/io/matlab/_mio5_params.py +281 -0
- scipy/io/matlab/_mio5_utils.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/io/matlab/_mio_utils.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/io/matlab/_miobase.py +435 -0
- scipy/io/matlab/_streams.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/io/matlab/byteordercodes.py +17 -0
- scipy/io/matlab/mio.py +16 -0
- scipy/io/matlab/mio4.py +17 -0
- scipy/io/matlab/mio5.py +19 -0
- scipy/io/matlab/mio5_params.py +18 -0
- scipy/io/matlab/mio5_utils.py +17 -0
- scipy/io/matlab/mio_utils.py +17 -0
- scipy/io/matlab/miobase.py +16 -0
- scipy/io/matlab/streams.py +16 -0
- scipy/io/matlab/tests/__init__.py +0 -0
- scipy/io/matlab/tests/data/bad_miuint32.mat +0 -0
- scipy/io/matlab/tests/data/bad_miutf8_array_name.mat +0 -0
- scipy/io/matlab/tests/data/big_endian.mat +0 -0
- scipy/io/matlab/tests/data/broken_utf8.mat +0 -0
- scipy/io/matlab/tests/data/corrupted_zlib_checksum.mat +0 -0
- scipy/io/matlab/tests/data/corrupted_zlib_data.mat +0 -0
- scipy/io/matlab/tests/data/debigged_m4.mat +0 -0
- scipy/io/matlab/tests/data/japanese_utf8.txt +5 -0
- scipy/io/matlab/tests/data/little_endian.mat +0 -0
- scipy/io/matlab/tests/data/logical_sparse.mat +0 -0
- scipy/io/matlab/tests/data/malformed1.mat +0 -0
- scipy/io/matlab/tests/data/miuint32_for_miint32.mat +0 -0
- scipy/io/matlab/tests/data/miutf8_array_name.mat +0 -0
- scipy/io/matlab/tests/data/nasty_duplicate_fieldnames.mat +0 -0
- scipy/io/matlab/tests/data/one_by_zero_char.mat +0 -0
- scipy/io/matlab/tests/data/parabola.mat +0 -0
- scipy/io/matlab/tests/data/single_empty_string.mat +0 -0
- scipy/io/matlab/tests/data/some_functions.mat +0 -0
- scipy/io/matlab/tests/data/sqr.mat +0 -0
- scipy/io/matlab/tests/data/test3dmatrix_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/test3dmatrix_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/test3dmatrix_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/test3dmatrix_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/test_empty_struct.mat +0 -0
- scipy/io/matlab/tests/data/test_mat4_le_floats.mat +0 -0
- scipy/io/matlab/tests/data/test_skip_variable.mat +0 -0
- scipy/io/matlab/tests/data/testbool_8_WIN64.mat +0 -0
- scipy/io/matlab/tests/data/testcell_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testcell_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcell_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcell_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcellnest_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testcellnest_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcellnest_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcellnest_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testcomplex_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testdouble_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testemptycell_5.3_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testemptycell_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testemptycell_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testemptycell_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testfunc_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testhdf5_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmatrix_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testminus_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testminus_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testminus_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testminus_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testminus_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmulti_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testmulti_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testmulti_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testobject_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testobject_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testobject_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testobject_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testonechar_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testscalarcell_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsimplecell.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparse_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparsecomplex_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testsparsefloat_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststring_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststring_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststring_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststring_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststring_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_4.2c_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststringarray_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststruct_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststruct_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststruct_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststruct_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructarr_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststructarr_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructarr_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructarr_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructnest_6.1_SOL2.mat +0 -0
- scipy/io/matlab/tests/data/teststructnest_6.5.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructnest_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/teststructnest_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testunicode_7.1_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testunicode_7.4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/data/testvec_4_GLNX86.mat +0 -0
- scipy/io/matlab/tests/test_byteordercodes.py +29 -0
- scipy/io/matlab/tests/test_mio.py +1399 -0
- scipy/io/matlab/tests/test_mio5_utils.py +179 -0
- scipy/io/matlab/tests/test_mio_funcs.py +51 -0
- scipy/io/matlab/tests/test_mio_utils.py +45 -0
- scipy/io/matlab/tests/test_miobase.py +32 -0
- scipy/io/matlab/tests/test_pathological.py +33 -0
- scipy/io/matlab/tests/test_streams.py +241 -0
- scipy/io/mmio.py +17 -0
- scipy/io/netcdf.py +17 -0
- scipy/io/tests/__init__.py +0 -0
- scipy/io/tests/data/Transparent Busy.ani +0 -0
- scipy/io/tests/data/array_float32_1d.sav +0 -0
- scipy/io/tests/data/array_float32_2d.sav +0 -0
- scipy/io/tests/data/array_float32_3d.sav +0 -0
- scipy/io/tests/data/array_float32_4d.sav +0 -0
- scipy/io/tests/data/array_float32_5d.sav +0 -0
- scipy/io/tests/data/array_float32_6d.sav +0 -0
- scipy/io/tests/data/array_float32_7d.sav +0 -0
- scipy/io/tests/data/array_float32_8d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_1d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_2d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_3d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_4d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_5d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_6d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_7d.sav +0 -0
- scipy/io/tests/data/array_float32_pointer_8d.sav +0 -0
- scipy/io/tests/data/example_1.nc +0 -0
- scipy/io/tests/data/example_2.nc +0 -0
- scipy/io/tests/data/example_3_maskedvals.nc +0 -0
- scipy/io/tests/data/fortran-3x3d-2i.dat +0 -0
- scipy/io/tests/data/fortran-mixed.dat +0 -0
- scipy/io/tests/data/fortran-sf8-11x1x10.dat +0 -0
- scipy/io/tests/data/fortran-sf8-15x10x22.dat +0 -0
- scipy/io/tests/data/fortran-sf8-1x1x1.dat +0 -0
- scipy/io/tests/data/fortran-sf8-1x1x5.dat +0 -0
- scipy/io/tests/data/fortran-sf8-1x1x7.dat +0 -0
- scipy/io/tests/data/fortran-sf8-1x3x5.dat +0 -0
- scipy/io/tests/data/fortran-si4-11x1x10.dat +0 -0
- scipy/io/tests/data/fortran-si4-15x10x22.dat +0 -0
- scipy/io/tests/data/fortran-si4-1x1x1.dat +0 -0
- scipy/io/tests/data/fortran-si4-1x1x5.dat +0 -0
- scipy/io/tests/data/fortran-si4-1x1x7.dat +0 -0
- scipy/io/tests/data/fortran-si4-1x3x5.dat +0 -0
- scipy/io/tests/data/invalid_pointer.sav +0 -0
- scipy/io/tests/data/null_pointer.sav +0 -0
- scipy/io/tests/data/scalar_byte.sav +0 -0
- scipy/io/tests/data/scalar_byte_descr.sav +0 -0
- scipy/io/tests/data/scalar_complex32.sav +0 -0
- scipy/io/tests/data/scalar_complex64.sav +0 -0
- scipy/io/tests/data/scalar_float32.sav +0 -0
- scipy/io/tests/data/scalar_float64.sav +0 -0
- scipy/io/tests/data/scalar_heap_pointer.sav +0 -0
- scipy/io/tests/data/scalar_int16.sav +0 -0
- scipy/io/tests/data/scalar_int32.sav +0 -0
- scipy/io/tests/data/scalar_int64.sav +0 -0
- scipy/io/tests/data/scalar_string.sav +0 -0
- scipy/io/tests/data/scalar_uint16.sav +0 -0
- scipy/io/tests/data/scalar_uint32.sav +0 -0
- scipy/io/tests/data/scalar_uint64.sav +0 -0
- scipy/io/tests/data/struct_arrays.sav +0 -0
- scipy/io/tests/data/struct_arrays_byte_idl80.sav +0 -0
- scipy/io/tests/data/struct_arrays_replicated.sav +0 -0
- scipy/io/tests/data/struct_arrays_replicated_3d.sav +0 -0
- scipy/io/tests/data/struct_inherit.sav +0 -0
- scipy/io/tests/data/struct_pointer_arrays.sav +0 -0
- scipy/io/tests/data/struct_pointer_arrays_replicated.sav +0 -0
- scipy/io/tests/data/struct_pointer_arrays_replicated_3d.sav +0 -0
- scipy/io/tests/data/struct_pointers.sav +0 -0
- scipy/io/tests/data/struct_pointers_replicated.sav +0 -0
- scipy/io/tests/data/struct_pointers_replicated_3d.sav +0 -0
- scipy/io/tests/data/struct_scalars.sav +0 -0
- scipy/io/tests/data/struct_scalars_replicated.sav +0 -0
- scipy/io/tests/data/struct_scalars_replicated_3d.sav +0 -0
- scipy/io/tests/data/test-1234Hz-le-1ch-10S-20bit-extra.wav +0 -0
- scipy/io/tests/data/test-44100Hz-2ch-32bit-float-be.wav +0 -0
- scipy/io/tests/data/test-44100Hz-2ch-32bit-float-le.wav +0 -0
- scipy/io/tests/data/test-44100Hz-be-1ch-4bytes.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-early-eof-no-data.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-early-eof.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-incomplete-chunk.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes-rf64.wav +0 -0
- scipy/io/tests/data/test-44100Hz-le-1ch-4bytes.wav +0 -0
- scipy/io/tests/data/test-48000Hz-2ch-64bit-float-le-wavex.wav +0 -0
- scipy/io/tests/data/test-8000Hz-be-3ch-5S-24bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-1ch-1byte-ulaw.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-2ch-1byteu.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-24bit-inconsistent.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-24bit-rf64.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-24bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-36bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-45bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-53bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-3ch-5S-64bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-4ch-9S-12bit.wav +0 -0
- scipy/io/tests/data/test-8000Hz-le-5ch-9S-5bit.wav +0 -0
- scipy/io/tests/data/various_compressed.sav +0 -0
- scipy/io/tests/test_fortran.py +264 -0
- scipy/io/tests/test_idl.py +483 -0
- scipy/io/tests/test_mmio.py +831 -0
- scipy/io/tests/test_netcdf.py +550 -0
- scipy/io/tests/test_paths.py +93 -0
- scipy/io/tests/test_wavfile.py +501 -0
- scipy/io/wavfile.py +938 -0
- scipy/linalg/__init__.pxd +1 -0
- scipy/linalg/__init__.py +236 -0
- scipy/linalg/_basic.py +2146 -0
- scipy/linalg/_blas_subroutines.h +164 -0
- scipy/linalg/_cythonized_array_utils.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_cythonized_array_utils.pxd +40 -0
- scipy/linalg/_cythonized_array_utils.pyi +16 -0
- scipy/linalg/_decomp.py +1645 -0
- scipy/linalg/_decomp_cholesky.py +413 -0
- scipy/linalg/_decomp_cossin.py +236 -0
- scipy/linalg/_decomp_interpolative.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_decomp_ldl.py +356 -0
- scipy/linalg/_decomp_lu.py +401 -0
- scipy/linalg/_decomp_lu_cython.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_decomp_lu_cython.pyi +6 -0
- scipy/linalg/_decomp_polar.py +113 -0
- scipy/linalg/_decomp_qr.py +494 -0
- scipy/linalg/_decomp_qz.py +452 -0
- scipy/linalg/_decomp_schur.py +336 -0
- scipy/linalg/_decomp_svd.py +545 -0
- scipy/linalg/_decomp_update.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_expm_frechet.py +417 -0
- scipy/linalg/_fblas.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_flapack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_lapack_subroutines.h +1521 -0
- scipy/linalg/_linalg_pythran.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_matfuncs.py +1050 -0
- scipy/linalg/_matfuncs_expm.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_matfuncs_expm.pyi +6 -0
- scipy/linalg/_matfuncs_inv_ssq.py +886 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_matfuncs_sqrtm.py +107 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_misc.py +191 -0
- scipy/linalg/_procrustes.py +113 -0
- scipy/linalg/_sketches.py +189 -0
- scipy/linalg/_solve_toeplitz.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/_solvers.py +862 -0
- scipy/linalg/_special_matrices.py +1322 -0
- scipy/linalg/_testutils.py +65 -0
- scipy/linalg/basic.py +23 -0
- scipy/linalg/blas.py +495 -0
- scipy/linalg/cython_blas.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/cython_blas.pxd +169 -0
- scipy/linalg/cython_blas.pyx +1432 -0
- scipy/linalg/cython_lapack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/linalg/cython_lapack.pxd +1528 -0
- scipy/linalg/cython_lapack.pyx +12045 -0
- scipy/linalg/decomp.py +23 -0
- scipy/linalg/decomp_cholesky.py +21 -0
- scipy/linalg/decomp_lu.py +21 -0
- scipy/linalg/decomp_qr.py +20 -0
- scipy/linalg/decomp_schur.py +21 -0
- scipy/linalg/decomp_svd.py +21 -0
- scipy/linalg/interpolative.py +989 -0
- scipy/linalg/lapack.py +1081 -0
- scipy/linalg/matfuncs.py +23 -0
- scipy/linalg/misc.py +21 -0
- scipy/linalg/special_matrices.py +22 -0
- scipy/linalg/tests/__init__.py +0 -0
- scipy/linalg/tests/_cython_examples/extending.pyx +23 -0
- scipy/linalg/tests/_cython_examples/meson.build +34 -0
- scipy/linalg/tests/data/carex_15_data.npz +0 -0
- scipy/linalg/tests/data/carex_18_data.npz +0 -0
- scipy/linalg/tests/data/carex_19_data.npz +0 -0
- scipy/linalg/tests/data/carex_20_data.npz +0 -0
- scipy/linalg/tests/data/carex_6_data.npz +0 -0
- scipy/linalg/tests/data/gendare_20170120_data.npz +0 -0
- scipy/linalg/tests/test_basic.py +2074 -0
- scipy/linalg/tests/test_batch.py +588 -0
- scipy/linalg/tests/test_blas.py +1127 -0
- scipy/linalg/tests/test_cython_blas.py +118 -0
- scipy/linalg/tests/test_cython_lapack.py +22 -0
- scipy/linalg/tests/test_cythonized_array_utils.py +130 -0
- scipy/linalg/tests/test_decomp.py +3189 -0
- scipy/linalg/tests/test_decomp_cholesky.py +268 -0
- scipy/linalg/tests/test_decomp_cossin.py +314 -0
- scipy/linalg/tests/test_decomp_ldl.py +137 -0
- scipy/linalg/tests/test_decomp_lu.py +308 -0
- scipy/linalg/tests/test_decomp_polar.py +110 -0
- scipy/linalg/tests/test_decomp_update.py +1701 -0
- scipy/linalg/tests/test_extending.py +46 -0
- scipy/linalg/tests/test_fblas.py +607 -0
- scipy/linalg/tests/test_interpolative.py +232 -0
- scipy/linalg/tests/test_lapack.py +3616 -0
- scipy/linalg/tests/test_matfuncs.py +1125 -0
- scipy/linalg/tests/test_matmul_toeplitz.py +136 -0
- scipy/linalg/tests/test_procrustes.py +214 -0
- scipy/linalg/tests/test_sketches.py +118 -0
- scipy/linalg/tests/test_solve_toeplitz.py +150 -0
- scipy/linalg/tests/test_solvers.py +844 -0
- scipy/linalg/tests/test_special_matrices.py +636 -0
- scipy/misc/__init__.py +6 -0
- scipy/misc/common.py +6 -0
- scipy/misc/doccer.py +6 -0
- scipy/ndimage/__init__.py +174 -0
- scipy/ndimage/_ctest.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/ndimage/_cytest.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/ndimage/_delegators.py +303 -0
- scipy/ndimage/_filters.py +2422 -0
- scipy/ndimage/_fourier.py +306 -0
- scipy/ndimage/_interpolation.py +1033 -0
- scipy/ndimage/_measurements.py +1689 -0
- scipy/ndimage/_morphology.py +2634 -0
- scipy/ndimage/_nd_image.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/ndimage/_ndimage_api.py +16 -0
- scipy/ndimage/_ni_docstrings.py +214 -0
- scipy/ndimage/_ni_label.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/ndimage/_ni_support.py +139 -0
- scipy/ndimage/_rank_filter_1d.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/ndimage/_support_alternative_backends.py +84 -0
- scipy/ndimage/filters.py +27 -0
- scipy/ndimage/fourier.py +21 -0
- scipy/ndimage/interpolation.py +22 -0
- scipy/ndimage/measurements.py +24 -0
- scipy/ndimage/morphology.py +27 -0
- scipy/ndimage/tests/__init__.py +12 -0
- scipy/ndimage/tests/data/label_inputs.txt +21 -0
- scipy/ndimage/tests/data/label_results.txt +294 -0
- scipy/ndimage/tests/data/label_strels.txt +42 -0
- scipy/ndimage/tests/dots.png +0 -0
- scipy/ndimage/tests/test_c_api.py +102 -0
- scipy/ndimage/tests/test_datatypes.py +67 -0
- scipy/ndimage/tests/test_filters.py +3083 -0
- scipy/ndimage/tests/test_fourier.py +187 -0
- scipy/ndimage/tests/test_interpolation.py +1491 -0
- scipy/ndimage/tests/test_measurements.py +1592 -0
- scipy/ndimage/tests/test_morphology.py +2950 -0
- scipy/ndimage/tests/test_ni_support.py +78 -0
- scipy/ndimage/tests/test_splines.py +70 -0
- scipy/odr/__init__.py +131 -0
- scipy/odr/__odrpack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/odr/_add_newdocs.py +34 -0
- scipy/odr/_models.py +315 -0
- scipy/odr/_odrpack.py +1154 -0
- scipy/odr/models.py +20 -0
- scipy/odr/odrpack.py +21 -0
- scipy/odr/tests/__init__.py +0 -0
- scipy/odr/tests/test_odr.py +607 -0
- scipy/optimize/__init__.pxd +1 -0
- scipy/optimize/__init__.py +460 -0
- scipy/optimize/_basinhopping.py +741 -0
- scipy/optimize/_bglu_dense.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_bracket.py +706 -0
- scipy/optimize/_chandrupatla.py +551 -0
- scipy/optimize/_cobyla_py.py +297 -0
- scipy/optimize/_cobyqa_py.py +72 -0
- scipy/optimize/_constraints.py +598 -0
- scipy/optimize/_dcsrch.py +728 -0
- scipy/optimize/_differentiable_functions.py +835 -0
- scipy/optimize/_differentialevolution.py +1970 -0
- scipy/optimize/_direct.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_direct_py.py +280 -0
- scipy/optimize/_dual_annealing.py +732 -0
- scipy/optimize/_elementwise.py +798 -0
- scipy/optimize/_group_columns.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_hessian_update_strategy.py +479 -0
- scipy/optimize/_highspy/__init__.py +0 -0
- scipy/optimize/_highspy/_core.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_highspy/_highs_options.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_highspy/_highs_wrapper.py +338 -0
- scipy/optimize/_isotonic.py +157 -0
- scipy/optimize/_lbfgsb.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_lbfgsb_py.py +634 -0
- scipy/optimize/_linesearch.py +896 -0
- scipy/optimize/_linprog.py +733 -0
- scipy/optimize/_linprog_doc.py +1434 -0
- scipy/optimize/_linprog_highs.py +422 -0
- scipy/optimize/_linprog_ip.py +1141 -0
- scipy/optimize/_linprog_rs.py +572 -0
- scipy/optimize/_linprog_simplex.py +663 -0
- scipy/optimize/_linprog_util.py +1521 -0
- scipy/optimize/_lsap.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_lsq/__init__.py +5 -0
- scipy/optimize/_lsq/bvls.py +183 -0
- scipy/optimize/_lsq/common.py +731 -0
- scipy/optimize/_lsq/dogbox.py +345 -0
- scipy/optimize/_lsq/givens_elimination.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_lsq/least_squares.py +1044 -0
- scipy/optimize/_lsq/lsq_linear.py +361 -0
- scipy/optimize/_lsq/trf.py +587 -0
- scipy/optimize/_lsq/trf_linear.py +249 -0
- scipy/optimize/_milp.py +394 -0
- scipy/optimize/_minimize.py +1199 -0
- scipy/optimize/_minpack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_minpack_py.py +1178 -0
- scipy/optimize/_moduleTNC.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_nnls.py +96 -0
- scipy/optimize/_nonlin.py +1634 -0
- scipy/optimize/_numdiff.py +963 -0
- scipy/optimize/_optimize.py +4169 -0
- scipy/optimize/_pava_pybind.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_qap.py +760 -0
- scipy/optimize/_remove_redundancy.py +522 -0
- scipy/optimize/_root.py +732 -0
- scipy/optimize/_root_scalar.py +538 -0
- scipy/optimize/_shgo.py +1606 -0
- scipy/optimize/_shgo_lib/__init__.py +0 -0
- scipy/optimize/_shgo_lib/_complex.py +1225 -0
- scipy/optimize/_shgo_lib/_vertex.py +460 -0
- scipy/optimize/_slsqp_py.py +603 -0
- scipy/optimize/_slsqplib.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_spectral.py +260 -0
- scipy/optimize/_tnc.py +438 -0
- scipy/optimize/_trlib/__init__.py +12 -0
- scipy/optimize/_trlib/_trlib.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_trustregion.py +318 -0
- scipy/optimize/_trustregion_constr/__init__.py +6 -0
- scipy/optimize/_trustregion_constr/canonical_constraint.py +390 -0
- scipy/optimize/_trustregion_constr/equality_constrained_sqp.py +231 -0
- scipy/optimize/_trustregion_constr/minimize_trustregion_constr.py +584 -0
- scipy/optimize/_trustregion_constr/projections.py +411 -0
- scipy/optimize/_trustregion_constr/qp_subproblem.py +637 -0
- scipy/optimize/_trustregion_constr/report.py +49 -0
- scipy/optimize/_trustregion_constr/tests/__init__.py +0 -0
- scipy/optimize/_trustregion_constr/tests/test_canonical_constraint.py +296 -0
- scipy/optimize/_trustregion_constr/tests/test_nested_minimize.py +39 -0
- scipy/optimize/_trustregion_constr/tests/test_projections.py +214 -0
- scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py +645 -0
- scipy/optimize/_trustregion_constr/tests/test_report.py +34 -0
- scipy/optimize/_trustregion_constr/tr_interior_point.py +361 -0
- scipy/optimize/_trustregion_dogleg.py +122 -0
- scipy/optimize/_trustregion_exact.py +437 -0
- scipy/optimize/_trustregion_krylov.py +65 -0
- scipy/optimize/_trustregion_ncg.py +126 -0
- scipy/optimize/_tstutils.py +972 -0
- scipy/optimize/_zeros.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/_zeros_py.py +1475 -0
- scipy/optimize/cobyla.py +19 -0
- scipy/optimize/cython_optimize/__init__.py +133 -0
- scipy/optimize/cython_optimize/_zeros.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/optimize/cython_optimize/_zeros.pxd +33 -0
- scipy/optimize/cython_optimize/c_zeros.pxd +26 -0
- scipy/optimize/cython_optimize.pxd +11 -0
- scipy/optimize/elementwise.py +38 -0
- scipy/optimize/lbfgsb.py +23 -0
- scipy/optimize/linesearch.py +18 -0
- scipy/optimize/minpack.py +27 -0
- scipy/optimize/minpack2.py +17 -0
- scipy/optimize/moduleTNC.py +19 -0
- scipy/optimize/nonlin.py +29 -0
- scipy/optimize/optimize.py +40 -0
- scipy/optimize/slsqp.py +22 -0
- scipy/optimize/tests/__init__.py +0 -0
- scipy/optimize/tests/_cython_examples/extending.pyx +43 -0
- scipy/optimize/tests/_cython_examples/meson.build +32 -0
- scipy/optimize/tests/test__basinhopping.py +535 -0
- scipy/optimize/tests/test__differential_evolution.py +1703 -0
- scipy/optimize/tests/test__dual_annealing.py +416 -0
- scipy/optimize/tests/test__linprog_clean_inputs.py +312 -0
- scipy/optimize/tests/test__numdiff.py +885 -0
- scipy/optimize/tests/test__remove_redundancy.py +228 -0
- scipy/optimize/tests/test__root.py +124 -0
- scipy/optimize/tests/test__shgo.py +1164 -0
- scipy/optimize/tests/test__spectral.py +226 -0
- scipy/optimize/tests/test_bracket.py +896 -0
- scipy/optimize/tests/test_chandrupatla.py +982 -0
- scipy/optimize/tests/test_cobyla.py +195 -0
- scipy/optimize/tests/test_cobyqa.py +252 -0
- scipy/optimize/tests/test_constraint_conversion.py +286 -0
- scipy/optimize/tests/test_constraints.py +255 -0
- scipy/optimize/tests/test_cython_optimize.py +92 -0
- scipy/optimize/tests/test_differentiable_functions.py +1025 -0
- scipy/optimize/tests/test_direct.py +321 -0
- scipy/optimize/tests/test_extending.py +28 -0
- scipy/optimize/tests/test_hessian_update_strategy.py +300 -0
- scipy/optimize/tests/test_isotonic_regression.py +167 -0
- scipy/optimize/tests/test_lbfgsb_hessinv.py +65 -0
- scipy/optimize/tests/test_lbfgsb_setulb.py +122 -0
- scipy/optimize/tests/test_least_squares.py +986 -0
- scipy/optimize/tests/test_linear_assignment.py +116 -0
- scipy/optimize/tests/test_linesearch.py +328 -0
- scipy/optimize/tests/test_linprog.py +2577 -0
- scipy/optimize/tests/test_lsq_common.py +297 -0
- scipy/optimize/tests/test_lsq_linear.py +287 -0
- scipy/optimize/tests/test_milp.py +459 -0
- scipy/optimize/tests/test_minimize_constrained.py +845 -0
- scipy/optimize/tests/test_minpack.py +1194 -0
- scipy/optimize/tests/test_nnls.py +469 -0
- scipy/optimize/tests/test_nonlin.py +572 -0
- scipy/optimize/tests/test_optimize.py +3335 -0
- scipy/optimize/tests/test_quadratic_assignment.py +455 -0
- scipy/optimize/tests/test_regression.py +40 -0
- scipy/optimize/tests/test_slsqp.py +645 -0
- scipy/optimize/tests/test_tnc.py +345 -0
- scipy/optimize/tests/test_trustregion.py +110 -0
- scipy/optimize/tests/test_trustregion_exact.py +351 -0
- scipy/optimize/tests/test_trustregion_krylov.py +170 -0
- scipy/optimize/tests/test_zeros.py +998 -0
- scipy/optimize/tnc.py +22 -0
- scipy/optimize/zeros.py +26 -0
- scipy/signal/__init__.py +316 -0
- scipy/signal/_arraytools.py +264 -0
- scipy/signal/_czt.py +575 -0
- scipy/signal/_delegators.py +568 -0
- scipy/signal/_filter_design.py +5893 -0
- scipy/signal/_fir_filter_design.py +1458 -0
- scipy/signal/_lti_conversion.py +534 -0
- scipy/signal/_ltisys.py +3546 -0
- scipy/signal/_max_len_seq.py +139 -0
- scipy/signal/_max_len_seq_inner.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/signal/_peak_finding.py +1310 -0
- scipy/signal/_peak_finding_utils.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/signal/_polyutils.py +172 -0
- scipy/signal/_savitzky_golay.py +357 -0
- scipy/signal/_short_time_fft.py +2187 -0
- scipy/signal/_signal_api.py +30 -0
- scipy/signal/_signaltools.py +5309 -0
- scipy/signal/_sigtools.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/signal/_sosfilt.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/signal/_spectral_py.py +2471 -0
- scipy/signal/_spline.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/signal/_spline.pyi +34 -0
- scipy/signal/_spline_filters.py +848 -0
- scipy/signal/_support_alternative_backends.py +73 -0
- scipy/signal/_upfirdn.py +219 -0
- scipy/signal/_upfirdn_apply.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/signal/_waveforms.py +687 -0
- scipy/signal/_wavelets.py +29 -0
- scipy/signal/bsplines.py +21 -0
- scipy/signal/filter_design.py +28 -0
- scipy/signal/fir_filter_design.py +21 -0
- scipy/signal/lti_conversion.py +20 -0
- scipy/signal/ltisys.py +25 -0
- scipy/signal/signaltools.py +27 -0
- scipy/signal/spectral.py +21 -0
- scipy/signal/spline.py +18 -0
- scipy/signal/tests/__init__.py +0 -0
- scipy/signal/tests/_scipy_spectral_test_shim.py +311 -0
- scipy/signal/tests/mpsig.py +122 -0
- scipy/signal/tests/test_array_tools.py +111 -0
- scipy/signal/tests/test_bsplines.py +365 -0
- scipy/signal/tests/test_cont2discrete.py +424 -0
- scipy/signal/tests/test_czt.py +221 -0
- scipy/signal/tests/test_dltisys.py +599 -0
- scipy/signal/tests/test_filter_design.py +4744 -0
- scipy/signal/tests/test_fir_filter_design.py +851 -0
- scipy/signal/tests/test_ltisys.py +1225 -0
- scipy/signal/tests/test_max_len_seq.py +71 -0
- scipy/signal/tests/test_peak_finding.py +915 -0
- scipy/signal/tests/test_result_type.py +51 -0
- scipy/signal/tests/test_savitzky_golay.py +363 -0
- scipy/signal/tests/test_short_time_fft.py +1098 -0
- scipy/signal/tests/test_signaltools.py +4729 -0
- scipy/signal/tests/test_spectral.py +2103 -0
- scipy/signal/tests/test_splines.py +427 -0
- scipy/signal/tests/test_upfirdn.py +322 -0
- scipy/signal/tests/test_waveforms.py +400 -0
- scipy/signal/tests/test_wavelets.py +59 -0
- scipy/signal/tests/test_windows.py +987 -0
- scipy/signal/waveforms.py +20 -0
- scipy/signal/wavelets.py +17 -0
- scipy/signal/windows/__init__.py +52 -0
- scipy/signal/windows/_windows.py +2513 -0
- scipy/signal/windows/windows.py +23 -0
- scipy/sparse/__init__.py +350 -0
- scipy/sparse/_base.py +1613 -0
- scipy/sparse/_bsr.py +880 -0
- scipy/sparse/_compressed.py +1328 -0
- scipy/sparse/_construct.py +1454 -0
- scipy/sparse/_coo.py +1581 -0
- scipy/sparse/_csc.py +367 -0
- scipy/sparse/_csparsetools.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/_csr.py +558 -0
- scipy/sparse/_data.py +569 -0
- scipy/sparse/_dia.py +677 -0
- scipy/sparse/_dok.py +669 -0
- scipy/sparse/_extract.py +178 -0
- scipy/sparse/_index.py +444 -0
- scipy/sparse/_lil.py +632 -0
- scipy/sparse/_matrix.py +169 -0
- scipy/sparse/_matrix_io.py +167 -0
- scipy/sparse/_sparsetools.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/_spfuncs.py +76 -0
- scipy/sparse/_sputils.py +632 -0
- scipy/sparse/base.py +24 -0
- scipy/sparse/bsr.py +22 -0
- scipy/sparse/compressed.py +20 -0
- scipy/sparse/construct.py +38 -0
- scipy/sparse/coo.py +23 -0
- scipy/sparse/csc.py +22 -0
- scipy/sparse/csgraph/__init__.py +210 -0
- scipy/sparse/csgraph/_flow.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/csgraph/_laplacian.py +563 -0
- scipy/sparse/csgraph/_matching.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/csgraph/_reordering.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/csgraph/_shortest_path.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/csgraph/_tools.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/csgraph/_traversal.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/csgraph/_validation.py +66 -0
- scipy/sparse/csgraph/tests/__init__.py +0 -0
- scipy/sparse/csgraph/tests/test_connected_components.py +119 -0
- scipy/sparse/csgraph/tests/test_conversions.py +61 -0
- scipy/sparse/csgraph/tests/test_flow.py +209 -0
- scipy/sparse/csgraph/tests/test_graph_laplacian.py +368 -0
- scipy/sparse/csgraph/tests/test_matching.py +307 -0
- scipy/sparse/csgraph/tests/test_pydata_sparse.py +197 -0
- scipy/sparse/csgraph/tests/test_reordering.py +70 -0
- scipy/sparse/csgraph/tests/test_shortest_path.py +540 -0
- scipy/sparse/csgraph/tests/test_spanning_tree.py +66 -0
- scipy/sparse/csgraph/tests/test_traversal.py +148 -0
- scipy/sparse/csr.py +22 -0
- scipy/sparse/data.py +18 -0
- scipy/sparse/dia.py +22 -0
- scipy/sparse/dok.py +22 -0
- scipy/sparse/extract.py +23 -0
- scipy/sparse/lil.py +22 -0
- scipy/sparse/linalg/__init__.py +148 -0
- scipy/sparse/linalg/_dsolve/__init__.py +71 -0
- scipy/sparse/linalg/_dsolve/_add_newdocs.py +147 -0
- scipy/sparse/linalg/_dsolve/_superlu.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/linalg/_dsolve/linsolve.py +882 -0
- scipy/sparse/linalg/_dsolve/tests/__init__.py +0 -0
- scipy/sparse/linalg/_dsolve/tests/test_linsolve.py +928 -0
- scipy/sparse/linalg/_eigen/__init__.py +22 -0
- scipy/sparse/linalg/_eigen/_svds.py +540 -0
- scipy/sparse/linalg/_eigen/_svds_doc.py +382 -0
- scipy/sparse/linalg/_eigen/arpack/COPYING +45 -0
- scipy/sparse/linalg/_eigen/arpack/__init__.py +20 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/linalg/_eigen/arpack/arpack.py +1706 -0
- scipy/sparse/linalg/_eigen/arpack/tests/__init__.py +0 -0
- scipy/sparse/linalg/_eigen/arpack/tests/test_arpack.py +717 -0
- scipy/sparse/linalg/_eigen/lobpcg/__init__.py +16 -0
- scipy/sparse/linalg/_eigen/lobpcg/lobpcg.py +1110 -0
- scipy/sparse/linalg/_eigen/lobpcg/tests/__init__.py +0 -0
- scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py +725 -0
- scipy/sparse/linalg/_eigen/tests/__init__.py +0 -0
- scipy/sparse/linalg/_eigen/tests/test_svds.py +886 -0
- scipy/sparse/linalg/_expm_multiply.py +816 -0
- scipy/sparse/linalg/_interface.py +920 -0
- scipy/sparse/linalg/_isolve/__init__.py +20 -0
- scipy/sparse/linalg/_isolve/_gcrotmk.py +503 -0
- scipy/sparse/linalg/_isolve/iterative.py +1051 -0
- scipy/sparse/linalg/_isolve/lgmres.py +230 -0
- scipy/sparse/linalg/_isolve/lsmr.py +486 -0
- scipy/sparse/linalg/_isolve/lsqr.py +589 -0
- scipy/sparse/linalg/_isolve/minres.py +372 -0
- scipy/sparse/linalg/_isolve/tests/__init__.py +0 -0
- scipy/sparse/linalg/_isolve/tests/test_gcrotmk.py +183 -0
- scipy/sparse/linalg/_isolve/tests/test_iterative.py +809 -0
- scipy/sparse/linalg/_isolve/tests/test_lgmres.py +225 -0
- scipy/sparse/linalg/_isolve/tests/test_lsmr.py +185 -0
- scipy/sparse/linalg/_isolve/tests/test_lsqr.py +120 -0
- scipy/sparse/linalg/_isolve/tests/test_minres.py +97 -0
- scipy/sparse/linalg/_isolve/tests/test_utils.py +9 -0
- scipy/sparse/linalg/_isolve/tfqmr.py +179 -0
- scipy/sparse/linalg/_isolve/utils.py +121 -0
- scipy/sparse/linalg/_matfuncs.py +940 -0
- scipy/sparse/linalg/_norm.py +195 -0
- scipy/sparse/linalg/_onenormest.py +467 -0
- scipy/sparse/linalg/_propack/_cpropack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/linalg/_propack/_spropack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/sparse/linalg/_special_sparse_arrays.py +949 -0
- scipy/sparse/linalg/_svdp.py +309 -0
- scipy/sparse/linalg/dsolve.py +22 -0
- scipy/sparse/linalg/eigen.py +21 -0
- scipy/sparse/linalg/interface.py +20 -0
- scipy/sparse/linalg/isolve.py +22 -0
- scipy/sparse/linalg/matfuncs.py +18 -0
- scipy/sparse/linalg/tests/__init__.py +0 -0
- scipy/sparse/linalg/tests/propack_test_data.npz +0 -0
- scipy/sparse/linalg/tests/test_expm_multiply.py +367 -0
- scipy/sparse/linalg/tests/test_interface.py +561 -0
- scipy/sparse/linalg/tests/test_matfuncs.py +592 -0
- scipy/sparse/linalg/tests/test_norm.py +154 -0
- scipy/sparse/linalg/tests/test_onenormest.py +252 -0
- scipy/sparse/linalg/tests/test_propack.py +165 -0
- scipy/sparse/linalg/tests/test_pydata_sparse.py +272 -0
- scipy/sparse/linalg/tests/test_special_sparse_arrays.py +337 -0
- scipy/sparse/sparsetools.py +17 -0
- scipy/sparse/spfuncs.py +17 -0
- scipy/sparse/sputils.py +17 -0
- scipy/sparse/tests/__init__.py +0 -0
- scipy/sparse/tests/data/csc_py2.npz +0 -0
- scipy/sparse/tests/data/csc_py3.npz +0 -0
- scipy/sparse/tests/test_arithmetic1d.py +341 -0
- scipy/sparse/tests/test_array_api.py +561 -0
- scipy/sparse/tests/test_base.py +5870 -0
- scipy/sparse/tests/test_common1d.py +447 -0
- scipy/sparse/tests/test_construct.py +872 -0
- scipy/sparse/tests/test_coo.py +1119 -0
- scipy/sparse/tests/test_csc.py +98 -0
- scipy/sparse/tests/test_csr.py +214 -0
- scipy/sparse/tests/test_dok.py +209 -0
- scipy/sparse/tests/test_extract.py +51 -0
- scipy/sparse/tests/test_indexing1d.py +603 -0
- scipy/sparse/tests/test_matrix_io.py +109 -0
- scipy/sparse/tests/test_minmax1d.py +128 -0
- scipy/sparse/tests/test_sparsetools.py +344 -0
- scipy/sparse/tests/test_spfuncs.py +97 -0
- scipy/sparse/tests/test_sputils.py +424 -0
- scipy/spatial/__init__.py +129 -0
- scipy/spatial/_ckdtree.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/spatial/_distance_pybind.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/spatial/_distance_wrap.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/spatial/_geometric_slerp.py +238 -0
- scipy/spatial/_hausdorff.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/spatial/_kdtree.py +920 -0
- scipy/spatial/_plotutils.py +274 -0
- scipy/spatial/_procrustes.py +132 -0
- scipy/spatial/_qhull.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/spatial/_qhull.pyi +213 -0
- scipy/spatial/_spherical_voronoi.py +341 -0
- scipy/spatial/_voronoi.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/spatial/_voronoi.pyi +4 -0
- scipy/spatial/ckdtree.py +18 -0
- scipy/spatial/distance.py +3147 -0
- scipy/spatial/distance.pyi +210 -0
- scipy/spatial/kdtree.py +25 -0
- scipy/spatial/qhull.py +25 -0
- scipy/spatial/tests/__init__.py +0 -0
- scipy/spatial/tests/data/cdist-X1.txt +10 -0
- scipy/spatial/tests/data/cdist-X2.txt +20 -0
- scipy/spatial/tests/data/degenerate_pointset.npz +0 -0
- scipy/spatial/tests/data/iris.txt +150 -0
- scipy/spatial/tests/data/pdist-boolean-inp.txt +20 -0
- scipy/spatial/tests/data/pdist-chebyshev-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-chebyshev-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-cityblock-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-cityblock-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-correlation-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-correlation-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-cosine-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-cosine-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-double-inp.txt +20 -0
- scipy/spatial/tests/data/pdist-euclidean-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-euclidean-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-hamming-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-jaccard-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-jensenshannon-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-jensenshannon-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-minkowski-3.2-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-minkowski-3.2-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-minkowski-5.8-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-seuclidean-ml-iris.txt +1 -0
- scipy/spatial/tests/data/pdist-seuclidean-ml.txt +1 -0
- scipy/spatial/tests/data/pdist-spearman-ml.txt +1 -0
- scipy/spatial/tests/data/random-bool-data.txt +100 -0
- scipy/spatial/tests/data/random-double-data.txt +100 -0
- scipy/spatial/tests/data/random-int-data.txt +100 -0
- scipy/spatial/tests/data/random-uint-data.txt +100 -0
- scipy/spatial/tests/data/selfdual-4d-polytope.txt +27 -0
- scipy/spatial/tests/test__plotutils.py +91 -0
- scipy/spatial/tests/test__procrustes.py +116 -0
- scipy/spatial/tests/test_distance.py +2388 -0
- scipy/spatial/tests/test_hausdorff.py +199 -0
- scipy/spatial/tests/test_kdtree.py +1536 -0
- scipy/spatial/tests/test_qhull.py +1313 -0
- scipy/spatial/tests/test_slerp.py +417 -0
- scipy/spatial/tests/test_spherical_voronoi.py +358 -0
- scipy/spatial/transform/__init__.py +31 -0
- scipy/spatial/transform/_rigid_transform.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/spatial/transform/_rotation.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/spatial/transform/_rotation_groups.py +140 -0
- scipy/spatial/transform/_rotation_spline.py +460 -0
- scipy/spatial/transform/rotation.py +21 -0
- scipy/spatial/transform/tests/__init__.py +0 -0
- scipy/spatial/transform/tests/test_rigid_transform.py +1221 -0
- scipy/spatial/transform/tests/test_rotation.py +2569 -0
- scipy/spatial/transform/tests/test_rotation_groups.py +169 -0
- scipy/spatial/transform/tests/test_rotation_spline.py +183 -0
- scipy/special/__init__.pxd +1 -0
- scipy/special/__init__.py +841 -0
- scipy/special/_add_newdocs.py +9961 -0
- scipy/special/_basic.py +3576 -0
- scipy/special/_comb.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/special/_ellip_harm.py +214 -0
- scipy/special/_ellip_harm_2.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/special/_gufuncs.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/special/_input_validation.py +17 -0
- scipy/special/_lambertw.py +149 -0
- scipy/special/_logsumexp.py +426 -0
- scipy/special/_mptestutils.py +453 -0
- scipy/special/_multiufuncs.py +610 -0
- scipy/special/_orthogonal.py +2592 -0
- scipy/special/_orthogonal.pyi +330 -0
- scipy/special/_precompute/__init__.py +0 -0
- scipy/special/_precompute/cosine_cdf.py +17 -0
- scipy/special/_precompute/expn_asy.py +54 -0
- scipy/special/_precompute/gammainc_asy.py +116 -0
- scipy/special/_precompute/gammainc_data.py +124 -0
- scipy/special/_precompute/hyp2f1_data.py +484 -0
- scipy/special/_precompute/lambertw.py +68 -0
- scipy/special/_precompute/loggamma.py +43 -0
- scipy/special/_precompute/struve_convergence.py +131 -0
- scipy/special/_precompute/utils.py +38 -0
- scipy/special/_precompute/wright_bessel.py +342 -0
- scipy/special/_precompute/wright_bessel_data.py +152 -0
- scipy/special/_precompute/wrightomega.py +41 -0
- scipy/special/_precompute/zetac.py +27 -0
- scipy/special/_sf_error.py +15 -0
- scipy/special/_specfun.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/special/_special_ufuncs.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/special/_spfun_stats.py +106 -0
- scipy/special/_spherical_bessel.py +397 -0
- scipy/special/_support_alternative_backends.py +295 -0
- scipy/special/_test_internal.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/special/_test_internal.pyi +9 -0
- scipy/special/_testutils.py +321 -0
- scipy/special/_ufuncs.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/special/_ufuncs.pyi +522 -0
- scipy/special/_ufuncs.pyx +13173 -0
- scipy/special/_ufuncs_cxx.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/special/_ufuncs_cxx.pxd +142 -0
- scipy/special/_ufuncs_cxx.pyx +427 -0
- scipy/special/_ufuncs_cxx_defs.h +147 -0
- scipy/special/_ufuncs_defs.h +57 -0
- scipy/special/add_newdocs.py +15 -0
- scipy/special/basic.py +87 -0
- scipy/special/cython_special.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/special/cython_special.pxd +259 -0
- scipy/special/cython_special.pyi +3 -0
- scipy/special/orthogonal.py +45 -0
- scipy/special/sf_error.py +20 -0
- scipy/special/specfun.py +24 -0
- scipy/special/spfun_stats.py +17 -0
- scipy/special/tests/__init__.py +0 -0
- scipy/special/tests/_cython_examples/extending.pyx +12 -0
- scipy/special/tests/_cython_examples/meson.build +34 -0
- scipy/special/tests/data/__init__.py +0 -0
- scipy/special/tests/data/boost.npz +0 -0
- scipy/special/tests/data/gsl.npz +0 -0
- scipy/special/tests/data/local.npz +0 -0
- scipy/special/tests/test_basic.py +4815 -0
- scipy/special/tests/test_bdtr.py +112 -0
- scipy/special/tests/test_boost_ufuncs.py +64 -0
- scipy/special/tests/test_boxcox.py +125 -0
- scipy/special/tests/test_cdflib.py +712 -0
- scipy/special/tests/test_cdft_asymptotic.py +49 -0
- scipy/special/tests/test_cephes_intp_cast.py +29 -0
- scipy/special/tests/test_cosine_distr.py +83 -0
- scipy/special/tests/test_cython_special.py +363 -0
- scipy/special/tests/test_data.py +719 -0
- scipy/special/tests/test_dd.py +42 -0
- scipy/special/tests/test_digamma.py +45 -0
- scipy/special/tests/test_ellip_harm.py +278 -0
- scipy/special/tests/test_erfinv.py +89 -0
- scipy/special/tests/test_exponential_integrals.py +118 -0
- scipy/special/tests/test_extending.py +28 -0
- scipy/special/tests/test_faddeeva.py +85 -0
- scipy/special/tests/test_gamma.py +12 -0
- scipy/special/tests/test_gammainc.py +152 -0
- scipy/special/tests/test_hyp2f1.py +2566 -0
- scipy/special/tests/test_hypergeometric.py +234 -0
- scipy/special/tests/test_iv_ratio.py +249 -0
- scipy/special/tests/test_kolmogorov.py +491 -0
- scipy/special/tests/test_lambertw.py +109 -0
- scipy/special/tests/test_legendre.py +1518 -0
- scipy/special/tests/test_log1mexp.py +85 -0
- scipy/special/tests/test_loggamma.py +70 -0
- scipy/special/tests/test_logit.py +162 -0
- scipy/special/tests/test_logsumexp.py +469 -0
- scipy/special/tests/test_mpmath.py +2293 -0
- scipy/special/tests/test_nan_inputs.py +65 -0
- scipy/special/tests/test_ndtr.py +77 -0
- scipy/special/tests/test_ndtri_exp.py +94 -0
- scipy/special/tests/test_orthogonal.py +821 -0
- scipy/special/tests/test_orthogonal_eval.py +275 -0
- scipy/special/tests/test_owens_t.py +53 -0
- scipy/special/tests/test_pcf.py +24 -0
- scipy/special/tests/test_pdtr.py +48 -0
- scipy/special/tests/test_powm1.py +65 -0
- scipy/special/tests/test_precompute_expn_asy.py +24 -0
- scipy/special/tests/test_precompute_gammainc.py +108 -0
- scipy/special/tests/test_precompute_utils.py +36 -0
- scipy/special/tests/test_round.py +18 -0
- scipy/special/tests/test_sf_error.py +146 -0
- scipy/special/tests/test_sici.py +36 -0
- scipy/special/tests/test_specfun.py +48 -0
- scipy/special/tests/test_spence.py +32 -0
- scipy/special/tests/test_spfun_stats.py +61 -0
- scipy/special/tests/test_sph_harm.py +85 -0
- scipy/special/tests/test_spherical_bessel.py +400 -0
- scipy/special/tests/test_support_alternative_backends.py +248 -0
- scipy/special/tests/test_trig.py +72 -0
- scipy/special/tests/test_ufunc_signatures.py +46 -0
- scipy/special/tests/test_wright_bessel.py +205 -0
- scipy/special/tests/test_wrightomega.py +117 -0
- scipy/special/tests/test_zeta.py +301 -0
- scipy/stats/__init__.py +670 -0
- scipy/stats/_ansari_swilk_statistics.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_axis_nan_policy.py +692 -0
- scipy/stats/_biasedurn.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_biasedurn.pxd +27 -0
- scipy/stats/_binned_statistic.py +795 -0
- scipy/stats/_binomtest.py +375 -0
- scipy/stats/_bws_test.py +177 -0
- scipy/stats/_censored_data.py +459 -0
- scipy/stats/_common.py +5 -0
- scipy/stats/_constants.py +42 -0
- scipy/stats/_continued_fraction.py +387 -0
- scipy/stats/_continuous_distns.py +12486 -0
- scipy/stats/_correlation.py +210 -0
- scipy/stats/_covariance.py +636 -0
- scipy/stats/_crosstab.py +204 -0
- scipy/stats/_discrete_distns.py +2098 -0
- scipy/stats/_distn_infrastructure.py +4201 -0
- scipy/stats/_distr_params.py +299 -0
- scipy/stats/_distribution_infrastructure.py +5750 -0
- scipy/stats/_entropy.py +428 -0
- scipy/stats/_finite_differences.py +145 -0
- scipy/stats/_fit.py +1351 -0
- scipy/stats/_hypotests.py +2060 -0
- scipy/stats/_kde.py +732 -0
- scipy/stats/_ksstats.py +600 -0
- scipy/stats/_levy_stable/__init__.py +1231 -0
- scipy/stats/_levy_stable/levyst.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_mannwhitneyu.py +492 -0
- scipy/stats/_mgc.py +550 -0
- scipy/stats/_morestats.py +4626 -0
- scipy/stats/_mstats_basic.py +3658 -0
- scipy/stats/_mstats_extras.py +521 -0
- scipy/stats/_multicomp.py +449 -0
- scipy/stats/_multivariate.py +7281 -0
- scipy/stats/_new_distributions.py +452 -0
- scipy/stats/_odds_ratio.py +466 -0
- scipy/stats/_page_trend_test.py +486 -0
- scipy/stats/_probability_distribution.py +1964 -0
- scipy/stats/_qmc.py +2956 -0
- scipy/stats/_qmc_cy.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_qmc_cy.pyi +54 -0
- scipy/stats/_qmvnt.py +454 -0
- scipy/stats/_qmvnt_cy.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_quantile.py +335 -0
- scipy/stats/_rcont/__init__.py +4 -0
- scipy/stats/_rcont/rcont.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_relative_risk.py +263 -0
- scipy/stats/_resampling.py +2352 -0
- scipy/stats/_result_classes.py +40 -0
- scipy/stats/_sampling.py +1314 -0
- scipy/stats/_sensitivity_analysis.py +713 -0
- scipy/stats/_sobol.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_sobol.pyi +54 -0
- scipy/stats/_sobol_direction_numbers.npz +0 -0
- scipy/stats/_stats.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_stats.pxd +10 -0
- scipy/stats/_stats_mstats_common.py +322 -0
- scipy/stats/_stats_py.py +11089 -0
- scipy/stats/_stats_pythran.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_survival.py +683 -0
- scipy/stats/_tukeylambda_stats.py +199 -0
- scipy/stats/_unuran/__init__.py +0 -0
- scipy/stats/_unuran/unuran_wrapper.cpython-314-x86_64-linux-musl.so +0 -0
- scipy/stats/_unuran/unuran_wrapper.pyi +179 -0
- scipy/stats/_variation.py +126 -0
- scipy/stats/_warnings_errors.py +38 -0
- scipy/stats/_wilcoxon.py +265 -0
- scipy/stats/biasedurn.py +16 -0
- scipy/stats/contingency.py +521 -0
- scipy/stats/distributions.py +24 -0
- scipy/stats/kde.py +18 -0
- scipy/stats/morestats.py +27 -0
- scipy/stats/mstats.py +140 -0
- scipy/stats/mstats_basic.py +42 -0
- scipy/stats/mstats_extras.py +25 -0
- scipy/stats/mvn.py +17 -0
- scipy/stats/qmc.py +236 -0
- scipy/stats/sampling.py +73 -0
- scipy/stats/stats.py +41 -0
- scipy/stats/tests/__init__.py +0 -0
- scipy/stats/tests/common_tests.py +356 -0
- scipy/stats/tests/data/_mvt.py +171 -0
- scipy/stats/tests/data/fisher_exact_results_from_r.py +607 -0
- scipy/stats/tests/data/jf_skew_t_gamlss_pdf_data.npy +0 -0
- scipy/stats/tests/data/levy_stable/stable-Z1-cdf-sample-data.npy +0 -0
- scipy/stats/tests/data/levy_stable/stable-Z1-pdf-sample-data.npy +0 -0
- scipy/stats/tests/data/levy_stable/stable-loc-scale-sample-data.npy +0 -0
- scipy/stats/tests/data/nist_anova/AtmWtAg.dat +108 -0
- scipy/stats/tests/data/nist_anova/SiRstv.dat +85 -0
- scipy/stats/tests/data/nist_anova/SmLs01.dat +249 -0
- scipy/stats/tests/data/nist_anova/SmLs02.dat +1869 -0
- scipy/stats/tests/data/nist_anova/SmLs03.dat +18069 -0
- scipy/stats/tests/data/nist_anova/SmLs04.dat +249 -0
- scipy/stats/tests/data/nist_anova/SmLs05.dat +1869 -0
- scipy/stats/tests/data/nist_anova/SmLs06.dat +18069 -0
- scipy/stats/tests/data/nist_anova/SmLs07.dat +249 -0
- scipy/stats/tests/data/nist_anova/SmLs08.dat +1869 -0
- scipy/stats/tests/data/nist_anova/SmLs09.dat +18069 -0
- scipy/stats/tests/data/nist_linregress/Norris.dat +97 -0
- scipy/stats/tests/data/rel_breitwigner_pdf_sample_data_ROOT.npy +0 -0
- scipy/stats/tests/data/studentized_range_mpmath_ref.json +1499 -0
- scipy/stats/tests/test_axis_nan_policy.py +1388 -0
- scipy/stats/tests/test_binned_statistic.py +568 -0
- scipy/stats/tests/test_censored_data.py +152 -0
- scipy/stats/tests/test_contingency.py +294 -0
- scipy/stats/tests/test_continued_fraction.py +173 -0
- scipy/stats/tests/test_continuous.py +2198 -0
- scipy/stats/tests/test_continuous_basic.py +1053 -0
- scipy/stats/tests/test_continuous_fit_censored.py +683 -0
- scipy/stats/tests/test_correlation.py +80 -0
- scipy/stats/tests/test_crosstab.py +115 -0
- scipy/stats/tests/test_discrete_basic.py +580 -0
- scipy/stats/tests/test_discrete_distns.py +700 -0
- scipy/stats/tests/test_distributions.py +10413 -0
- scipy/stats/tests/test_entropy.py +322 -0
- scipy/stats/tests/test_fast_gen_inversion.py +435 -0
- scipy/stats/tests/test_fit.py +1090 -0
- scipy/stats/tests/test_hypotests.py +1991 -0
- scipy/stats/tests/test_kdeoth.py +676 -0
- scipy/stats/tests/test_marray.py +289 -0
- scipy/stats/tests/test_mgc.py +217 -0
- scipy/stats/tests/test_morestats.py +3259 -0
- scipy/stats/tests/test_mstats_basic.py +2071 -0
- scipy/stats/tests/test_mstats_extras.py +172 -0
- scipy/stats/tests/test_multicomp.py +405 -0
- scipy/stats/tests/test_multivariate.py +4381 -0
- scipy/stats/tests/test_odds_ratio.py +148 -0
- scipy/stats/tests/test_qmc.py +1492 -0
- scipy/stats/tests/test_quantile.py +199 -0
- scipy/stats/tests/test_rank.py +345 -0
- scipy/stats/tests/test_relative_risk.py +95 -0
- scipy/stats/tests/test_resampling.py +2000 -0
- scipy/stats/tests/test_sampling.py +1450 -0
- scipy/stats/tests/test_sensitivity_analysis.py +310 -0
- scipy/stats/tests/test_stats.py +9707 -0
- scipy/stats/tests/test_survival.py +466 -0
- scipy/stats/tests/test_tukeylambda_stats.py +85 -0
- scipy/stats/tests/test_variation.py +216 -0
- scipy/version.py +12 -0
- scipy-1.16.1.dist-info/LICENSE.txt +934 -0
- scipy-1.16.1.dist-info/METADATA +1083 -0
- scipy-1.16.1.dist-info/RECORD +1420 -0
- scipy-1.16.1.dist-info/WHEEL +5 -0
- scipy.libs/libgcc_s-0cd532bd.so.1 +0 -0
- scipy.libs/libgcc_s-a3a07607-e69b4851.so.1 +0 -0
- scipy.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
- scipy.libs/libgfortran-e686bd2c-8cec572a.so.5.0.0 +0 -0
- scipy.libs/libquadmath-9b5eedf9-101a4297.so.0.0.0 +0 -0
- scipy.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
- scipy.libs/libscipy_openblas-e00df7a9.so +0 -0
- scipy.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
@@ -0,0 +1,1098 @@
|
|
1
|
+
"""Unit tests for module `_short_time_fft`.
|
2
|
+
|
3
|
+
This file's structure loosely groups the tests into the following sequential
|
4
|
+
categories:
|
5
|
+
|
6
|
+
1. Test function `_calc_dual_canonical_window`.
|
7
|
+
2. Test for invalid parameters and exceptions in `ShortTimeFFT` (until the
|
8
|
+
`test_from_window` function).
|
9
|
+
3. Test algorithmic properties of STFT/ISTFT. Some tests were ported from
|
10
|
+
``test_spectral.py``.
|
11
|
+
|
12
|
+
Notes
|
13
|
+
-----
|
14
|
+
* Mypy 0.990 does interpret the line::
|
15
|
+
|
16
|
+
from scipy.stats import norm as normal_distribution
|
17
|
+
|
18
|
+
incorrectly (but the code works), hence a ``type: ignore`` was appended.
|
19
|
+
"""
|
20
|
+
import math
|
21
|
+
from itertools import product
|
22
|
+
from typing import cast, get_args, Literal
|
23
|
+
|
24
|
+
import numpy as np
|
25
|
+
import pytest
|
26
|
+
from scipy._lib._array_api import xp_assert_close, xp_assert_equal
|
27
|
+
from scipy.fft import fftshift
|
28
|
+
from scipy.stats import norm as normal_distribution # type: ignore
|
29
|
+
from scipy.signal import check_COLA, get_window, welch, stft, istft, spectrogram
|
30
|
+
|
31
|
+
from scipy.signal._short_time_fft import FFT_MODE_TYPE, \
|
32
|
+
_calc_dual_canonical_window, closest_STFT_dual_window, ShortTimeFFT, PAD_TYPE
|
33
|
+
from scipy.signal.windows import blackman, gaussian, hamming, nuttall, triang
|
34
|
+
|
35
|
+
|
36
|
+
def test__calc_dual_canonical_window_roundtrip():
|
37
|
+
"""Test dual window calculation with a round trip to verify duality.
|
38
|
+
|
39
|
+
Note that this works only for canonical window pairs (having minimal
|
40
|
+
energy) like a Gaussian.
|
41
|
+
|
42
|
+
The window is the same as in the example of `from ShortTimeFFT.from_dual`.
|
43
|
+
"""
|
44
|
+
win = gaussian(51, std=10, sym=True)
|
45
|
+
d_win = _calc_dual_canonical_window(win, 10)
|
46
|
+
win2 = _calc_dual_canonical_window(d_win, 10)
|
47
|
+
xp_assert_close(win2, win)
|
48
|
+
|
49
|
+
|
50
|
+
def test__calc_dual_canonical_window_exceptions():
|
51
|
+
"""Raise all exceptions in `_calc_dual_canonical_window`."""
|
52
|
+
# Verify that calculation can fail:
|
53
|
+
with pytest.raises(ValueError, match="hop=5 is larger than window len.*"):
|
54
|
+
_calc_dual_canonical_window(np.ones(4), 5)
|
55
|
+
with pytest.raises(ValueError, match=".* Transform not invertible!"):
|
56
|
+
_calc_dual_canonical_window(np.array([.1, .2, .3, 0]), 4)
|
57
|
+
|
58
|
+
# Verify that parameter `win` may not be integers:
|
59
|
+
with pytest.raises(ValueError, match="Parameter 'win' cannot be of int.*"):
|
60
|
+
_calc_dual_canonical_window(np.ones(4, dtype=int), 1)
|
61
|
+
|
62
|
+
def test_closest_STFT_dual_window_exceptions():
|
63
|
+
"""Raise all exceptions in `closest_STFT_dual_window`."""
|
64
|
+
with pytest.raises(ValueError, match="Parameters `win` and `desired_dual` are.*"):
|
65
|
+
closest_STFT_dual_window(np.ones(4), 2, np.ones(5))
|
66
|
+
with pytest.raises(ValueError, match="Parameters `win` and `desired_dual` are.*"):
|
67
|
+
closest_STFT_dual_window(np.ones((4, 1)), 2, np.ones(4))
|
68
|
+
with pytest.raises(ValueError, match="Parameter win must have finite entries!"):
|
69
|
+
closest_STFT_dual_window(np.ones(4)*np.nan, 2, np.ones(4))
|
70
|
+
with pytest.raises(ValueError, match="Parameter desired_dual must have finite.*"):
|
71
|
+
closest_STFT_dual_window(np.ones(4), 2, np.ones(4)*np.nan)
|
72
|
+
with pytest.raises(ValueError, match="Parameter hop=20 is not an integer.*"):
|
73
|
+
closest_STFT_dual_window(np.ones(4), 20, np.ones(4))
|
74
|
+
with pytest.raises(ValueError, match="Parameter hop=2.0 is not an integer.*"):
|
75
|
+
# noinspection PyTypeChecker
|
76
|
+
closest_STFT_dual_window(np.ones(4), 2., np.ones(4))
|
77
|
+
|
78
|
+
with pytest.raises(ValueError, match="Unable to calculate scaled closest dual.*"):
|
79
|
+
closest_STFT_dual_window(np.ones(4), 2, np.zeros(4), scaled=True)
|
80
|
+
|
81
|
+
|
82
|
+
@pytest.mark.parametrize("scaled", (True, False))
|
83
|
+
@pytest.mark.parametrize('sym_win', (False, True))
|
84
|
+
@pytest.mark.parametrize('hop', (8, 9))
|
85
|
+
@pytest.mark.parametrize('m', (16, 17))
|
86
|
+
@pytest.mark.parametrize('win_name', ('hann', 'hamming'))
|
87
|
+
def test_closest_STFT_dual_window_roundtrip(win_name, m, hop, sym_win, scaled):
|
88
|
+
"""Do roundtrip, i.e., compare dual of dual windows.
|
89
|
+
|
90
|
+
The default for parameter `desired_dual` is also verified.
|
91
|
+
"""
|
92
|
+
win = get_window(win_name, m, not sym_win)
|
93
|
+
d1, s1 = closest_STFT_dual_window(win, hop, np.ones_like(win), scaled=scaled)
|
94
|
+
d2, s2 = closest_STFT_dual_window(win, hop, scaled=scaled) # equals d1, s1
|
95
|
+
d3, s3 = closest_STFT_dual_window(d1, hop, win * s1, scaled=True) # roundtrip
|
96
|
+
|
97
|
+
# Validate default for parameter `desired_dual` works (hard coded => assert ok):
|
98
|
+
xp_assert_equal(d2, d1, err_msg="Default for parameter `desired_dual` is not ok!")
|
99
|
+
assert s2 == s1, "Default for parameter `desired_dual` is not ok!"
|
100
|
+
|
101
|
+
res = np.finfo(win.dtype).resolution * 5
|
102
|
+
xp_assert_close(s1*s3, 1., atol=res, err_msg="Invalid Scale factors")
|
103
|
+
xp_assert_close(d3, win, atol=res, err_msg="Roundtrip failed!")
|
104
|
+
|
105
|
+
if scaled: # check that scaling factor is correct:
|
106
|
+
d3, _ = closest_STFT_dual_window(win, hop, np.ones(m) * s1, scaled=False)
|
107
|
+
xp_assert_close(d3, d1, atol=res, err_msg="Roundtrip failed!")
|
108
|
+
|
109
|
+
|
110
|
+
@pytest.mark.parametrize('scaled', (False, True))
|
111
|
+
def test_closest_STFT_dual_window_STFT_roundtrip(scaled):
|
112
|
+
"""STFT Roundtrip correctness of closest dual window. """
|
113
|
+
np.random.seed(5613830)
|
114
|
+
n, m_num, hop = 15, 7, 3
|
115
|
+
w, desires_dual = hamming(m_num), triang(m_num)
|
116
|
+
d, _ = closest_STFT_dual_window(w, hop, desires_dual, scaled=scaled)
|
117
|
+
|
118
|
+
SFT = ShortTimeFFT(w, hop=hop, dual_win=d, fs=1, scale_to=None, phase_shift=None)
|
119
|
+
x = 10 * np.random.randn(n)
|
120
|
+
Sx = SFT.stft(x)
|
121
|
+
y = SFT.istft(Sx, 0, n)
|
122
|
+
|
123
|
+
atol = np.finfo(w.dtype).resolution * 10
|
124
|
+
xp_assert_close(y, x, atol=atol, err_msg="Invalid closest window")
|
125
|
+
|
126
|
+
|
127
|
+
@pytest.mark.parametrize('scaled', (False, True))
|
128
|
+
def test_closest_STFT_dual_window_STFT_roundtrip_complex(scaled):
|
129
|
+
"""STFT Roundtrip correctness of closest dual window with complex values. """
|
130
|
+
np.random.seed(34905436)
|
131
|
+
n, m_num, hop = 15, 7, 3
|
132
|
+
win = 1j*hamming(m_num) + nuttall(m_num)
|
133
|
+
desires_dual = 1j*triang(m_num) + blackman(m_num)
|
134
|
+
dual, s = closest_STFT_dual_window(win, hop, desires_dual, scaled=scaled)
|
135
|
+
|
136
|
+
SFT = ShortTimeFFT(win, hop=hop, dual_win=dual, fs=1, fft_mode='twosided',
|
137
|
+
scale_to=None, phase_shift=None)
|
138
|
+
x = 10 * np.random.randn(n) + 10j * np.random.randn(n)
|
139
|
+
Sx = SFT.stft(x)
|
140
|
+
y = SFT.istft(Sx, 0, n)
|
141
|
+
|
142
|
+
atol = np.finfo(win.dtype).resolution * 10
|
143
|
+
xp_assert_close(y, x, atol=atol, err_msg=f"Invalid complex closest window ({s=})")
|
144
|
+
|
145
|
+
|
146
|
+
@pytest.mark.parametrize("win_name, nperseg, noverlap, scale_fac", ([
|
147
|
+
('boxcar', 16, 8, 1/2),
|
148
|
+
('boxcar', 18, 12, 1/3),
|
149
|
+
('boxcar', 16, 12, 1/4),
|
150
|
+
('bartlett', 16, 8, 1.),
|
151
|
+
('bartlett', 16, 12, 1/2),
|
152
|
+
('bartlett', 30, 25, 1/3),
|
153
|
+
('hann', 16, 8, 1.),
|
154
|
+
('hann', 18, 12, 2/3),
|
155
|
+
('hann', 16, 12, 1/2),
|
156
|
+
('blackman', 9, 6, 50/63),
|
157
|
+
('boxcar', 8, 7, 1/8)])) # hop = 1
|
158
|
+
def test_closest_STFT_dual_window_cola(win_name, nperseg, noverlap, scale_fac):
|
159
|
+
"""Test if `closest_STFT_dual_window` generalizes `check_COLA`.
|
160
|
+
|
161
|
+
The parameters were taken from the `check_COLA` documentation.
|
162
|
+
Note that `check_COLA` only guarantees the existence of a dual window with constant
|
163
|
+
values but not that those values are unity (which is clear, when investigating the
|
164
|
+
'boxcar' examples). The values for `scale_fac` were determined empirically.
|
165
|
+
"""
|
166
|
+
desired_dual = get_window(win_name, nperseg, fftbins=True)
|
167
|
+
assert check_COLA(desired_dual, nperseg, noverlap), "COLA cond. violated!"
|
168
|
+
|
169
|
+
win = np.ones(nperseg) # check scaled window:
|
170
|
+
d_s, s = closest_STFT_dual_window(win, nperseg-noverlap, desired_dual, scaled=True)
|
171
|
+
|
172
|
+
res = np.finfo(desired_dual.dtype).resolution
|
173
|
+
rel_tol_d = max(abs(d_s))*res*3
|
174
|
+
xp_assert_close(s, scale_fac, atol=res*10,
|
175
|
+
err_msg=f"Scale factor off by {s/scale_fac}")
|
176
|
+
xp_assert_close(d_s, desired_dual*scale_fac, atol=res*10, rtol=rel_tol_d,
|
177
|
+
err_msg="Calculated incorrect scaled window!")
|
178
|
+
|
179
|
+
# check unscaled window:
|
180
|
+
d_u, u = closest_STFT_dual_window(win * scale_fac, nperseg - noverlap,
|
181
|
+
desired_dual, scaled=False)
|
182
|
+
|
183
|
+
# this should be hard-coded not computed, so no need for allclose
|
184
|
+
assert u == 1., "Scaling factor not 1 for parameter `scaled=True`!"
|
185
|
+
xp_assert_close(d_u, desired_dual, atol=res*10, rtol=rel_tol_d,
|
186
|
+
err_msg="Calculated incorrect unscaled window!")
|
187
|
+
|
188
|
+
|
189
|
+
def test_invalid_initializer_parameters():
|
190
|
+
"""Verify that exceptions get raised on invalid parameters when
|
191
|
+
instantiating ShortTimeFFT. """
|
192
|
+
with pytest.raises(ValueError, match=r"Parameter win must be 1d, " +
|
193
|
+
r"but win.shape=\(2, 2\)!"):
|
194
|
+
ShortTimeFFT(np.ones((2, 2)), hop=4, fs=1)
|
195
|
+
with pytest.raises(ValueError, match="Parameter win must have " +
|
196
|
+
"finite entries"):
|
197
|
+
ShortTimeFFT(np.array([1, np.inf, 2, 3]), hop=4, fs=1)
|
198
|
+
with pytest.raises(ValueError, match="Parameter hop=0 is not " +
|
199
|
+
"an integer >= 1!"):
|
200
|
+
ShortTimeFFT(np.ones(4), hop=0, fs=1)
|
201
|
+
with pytest.raises(ValueError, match="Parameter hop=2.0 is not " +
|
202
|
+
"an integer >= 1!"):
|
203
|
+
# noinspection PyTypeChecker
|
204
|
+
ShortTimeFFT(np.ones(4), hop=2.0, fs=1)
|
205
|
+
with pytest.raises(ValueError, match=r"dual_win.shape=\(5,\) must equal " +
|
206
|
+
r"win.shape=\(4,\)!"):
|
207
|
+
ShortTimeFFT(np.ones(4), hop=2, fs=1, dual_win=np.ones(5))
|
208
|
+
with pytest.raises(ValueError, match="Parameter dual_win must be " +
|
209
|
+
"a finite array!"):
|
210
|
+
ShortTimeFFT(np.ones(3), hop=2, fs=1,
|
211
|
+
dual_win=np.array([np.nan, 2, 3]))
|
212
|
+
|
213
|
+
|
214
|
+
def test_exceptions_properties_methods():
|
215
|
+
"""Verify that exceptions get raised when setting properties or calling
|
216
|
+
method of ShortTimeFFT to/with invalid values."""
|
217
|
+
SFT = ShortTimeFFT(np.ones(8), hop=4, fs=1)
|
218
|
+
with pytest.raises(ValueError, match="Sampling interval T=-1 must be " +
|
219
|
+
"positive!"):
|
220
|
+
SFT.T = -1
|
221
|
+
with pytest.raises(ValueError, match="Sampling frequency fs=-1 must be " +
|
222
|
+
"positive!"):
|
223
|
+
SFT.fs = -1
|
224
|
+
with pytest.raises(ValueError, match="fft_mode='invalid_typ' not in " +
|
225
|
+
r"\('twosided', 'centered', " +
|
226
|
+
r"'onesided', 'onesided2X'\)!"):
|
227
|
+
SFT.fft_mode = 'invalid_typ'
|
228
|
+
with pytest.raises(ValueError, match="For scaling is None, " +
|
229
|
+
"fft_mode='onesided2X' is invalid.*"):
|
230
|
+
SFT.fft_mode = 'onesided2X'
|
231
|
+
with pytest.raises(ValueError, match="Attribute mfft=7 needs to be " +
|
232
|
+
"at least the window length.*"):
|
233
|
+
SFT.mfft = 7
|
234
|
+
with pytest.raises(ValueError, match="scaling='invalid' not in.*"):
|
235
|
+
# noinspection PyTypeChecker
|
236
|
+
SFT.scale_to('invalid')
|
237
|
+
with pytest.raises(ValueError, match="phase_shift=3.0 has the unit .*"):
|
238
|
+
SFT.phase_shift = 3.0
|
239
|
+
with pytest.raises(ValueError, match="-mfft < phase_shift < mfft " +
|
240
|
+
"does not hold.*"):
|
241
|
+
SFT.phase_shift = 2*SFT.mfft
|
242
|
+
with pytest.raises(ValueError, match="Parameter padding='invalid' not.*"):
|
243
|
+
# noinspection PyTypeChecker
|
244
|
+
g = SFT._x_slices(np.zeros(16), k_off=0, p0=0, p1=1, padding='invalid')
|
245
|
+
next(g) # execute generator
|
246
|
+
with pytest.raises(ValueError, match="Trend type must be 'linear' " +
|
247
|
+
"or 'constant'"):
|
248
|
+
# noinspection PyTypeChecker
|
249
|
+
SFT.stft_detrend(np.zeros(16), detr='invalid')
|
250
|
+
with pytest.raises(ValueError, match="Parameter detr=nan is not a str, " +
|
251
|
+
"function or None!"):
|
252
|
+
# noinspection PyTypeChecker
|
253
|
+
SFT.stft_detrend(np.zeros(16), detr=np.nan)
|
254
|
+
with pytest.raises(ValueError, match="Invalid Parameter p0=0, p1=200.*"):
|
255
|
+
SFT.p_range(100, 0, 200)
|
256
|
+
|
257
|
+
with pytest.raises(ValueError, match="f_axis=0 may not be equal to " +
|
258
|
+
"t_axis=0!"):
|
259
|
+
SFT.istft(np.zeros((SFT.f_pts, 2)), t_axis=0, f_axis=0)
|
260
|
+
with pytest.raises(ValueError, match=r"S.shape\[f_axis\]=2 must be equal" +
|
261
|
+
" to self.f_pts=5.*"):
|
262
|
+
SFT.istft(np.zeros((2, 2)))
|
263
|
+
with pytest.raises(ValueError, match=r"S.shape\[t_axis\]=1 needs to have" +
|
264
|
+
" at least 2 slices.*"):
|
265
|
+
SFT.istft(np.zeros((SFT.f_pts, 1)))
|
266
|
+
with pytest.raises(ValueError, match=r".*\(k1=100\) <= \(k_max=12\) " +
|
267
|
+
"is false!$"):
|
268
|
+
SFT.istft(np.zeros((SFT.f_pts, 3)), k1=100)
|
269
|
+
with pytest.raises(ValueError, match=r"\(k1=1\) - \(k0=0\) = 1 has to " +
|
270
|
+
"be at least.* length 4!"):
|
271
|
+
SFT.istft(np.zeros((SFT.f_pts, 3)), k0=0, k1=1)
|
272
|
+
|
273
|
+
with pytest.raises(ValueError, match=r"Parameter axes_seq='invalid' " +
|
274
|
+
r"not in \['tf', 'ft'\]!"):
|
275
|
+
# noinspection PyTypeChecker
|
276
|
+
SFT.extent(n=100, axes_seq='invalid')
|
277
|
+
with pytest.raises(ValueError, match="Attribute fft_mode=twosided must.*"):
|
278
|
+
SFT.fft_mode = 'twosided'
|
279
|
+
SFT.extent(n=100)
|
280
|
+
|
281
|
+
|
282
|
+
@pytest.mark.parametrize('m', ('onesided', 'onesided2X'))
|
283
|
+
def test_exceptions_fft_mode_complex_win(m: FFT_MODE_TYPE):
|
284
|
+
"""Verify that one-sided spectra are not allowed with complex-valued
|
285
|
+
windows or with complex-valued signals.
|
286
|
+
|
287
|
+
The reason being, the `rfft` function only accepts real-valued input.
|
288
|
+
"""
|
289
|
+
with pytest.raises(ValueError,
|
290
|
+
match=f"One-sided spectra, i.e., fft_mode='{m}'.*"):
|
291
|
+
ShortTimeFFT(np.ones(8)*1j, hop=4, fs=1, fft_mode=m)
|
292
|
+
|
293
|
+
SFT = ShortTimeFFT(np.ones(8)*1j, hop=4, fs=1, fft_mode='twosided')
|
294
|
+
with pytest.raises(ValueError,
|
295
|
+
match=f"One-sided spectra, i.e., fft_mode='{m}'.*"):
|
296
|
+
SFT.fft_mode = m
|
297
|
+
|
298
|
+
SFT = ShortTimeFFT(np.ones(8), hop=4, fs=1, scale_to='psd', fft_mode='onesided')
|
299
|
+
with pytest.raises(ValueError, match="Complex-valued `x` not allowed for self.*"):
|
300
|
+
SFT.stft(np.ones(8)*1j)
|
301
|
+
SFT.fft_mode = 'onesided2X'
|
302
|
+
with pytest.raises(ValueError, match="Complex-valued `x` not allowed for self.*"):
|
303
|
+
SFT.stft(np.ones(8)*1j)
|
304
|
+
|
305
|
+
|
306
|
+
def test_invalid_fft_mode_RuntimeError():
|
307
|
+
"""Ensure exception gets raised when property `fft_mode` is invalid. """
|
308
|
+
SFT = ShortTimeFFT(np.ones(8), hop=4, fs=1)
|
309
|
+
# noinspection PyTypeChecker
|
310
|
+
SFT._fft_mode = 'invalid_typ'
|
311
|
+
|
312
|
+
with pytest.raises(RuntimeError):
|
313
|
+
_ = SFT.f
|
314
|
+
with pytest.raises(RuntimeError):
|
315
|
+
SFT._fft_func(np.ones(8))
|
316
|
+
with pytest.raises(RuntimeError):
|
317
|
+
SFT._ifft_func(np.ones(8))
|
318
|
+
|
319
|
+
|
320
|
+
@pytest.mark.parametrize('win_params, Nx', [(('gaussian', 2.), 9), # in docstr
|
321
|
+
('triang', 7),
|
322
|
+
(('kaiser', 4.0), 9),
|
323
|
+
(('exponential', None, 1.), 9),
|
324
|
+
(4.0, 9)])
|
325
|
+
def test_from_window(win_params, Nx: int):
|
326
|
+
"""Verify that `from_window()` handles parameters correctly.
|
327
|
+
|
328
|
+
The window parameterizations are documented in the `get_window` docstring.
|
329
|
+
"""
|
330
|
+
w_sym, fs = get_window(win_params, Nx, fftbins=False), 16.
|
331
|
+
w_per = get_window(win_params, Nx, fftbins=True)
|
332
|
+
SFT0 = ShortTimeFFT(w_sym, hop=3, fs=fs, fft_mode='twosided',
|
333
|
+
scale_to='psd', phase_shift=1)
|
334
|
+
nperseg = len(w_sym)
|
335
|
+
noverlap = nperseg - SFT0.hop
|
336
|
+
SFT1 = ShortTimeFFT.from_window(win_params, fs, nperseg, noverlap,
|
337
|
+
symmetric_win=True, fft_mode='twosided',
|
338
|
+
scale_to='psd', phase_shift=1)
|
339
|
+
# periodic window:
|
340
|
+
SFT2 = ShortTimeFFT.from_window(win_params, fs, nperseg, noverlap,
|
341
|
+
symmetric_win=False, fft_mode='twosided',
|
342
|
+
scale_to='psd', phase_shift=1)
|
343
|
+
# Be informative when comparing instances:
|
344
|
+
xp_assert_equal(SFT1.win, SFT0.win)
|
345
|
+
xp_assert_close(SFT2.win, w_per / np.sqrt(sum(w_per**2) * fs))
|
346
|
+
for n_ in ('hop', 'T', 'fft_mode', 'mfft', 'scaling', 'phase_shift'):
|
347
|
+
v0, v1, v2 = (getattr(SFT_, n_) for SFT_ in (SFT0, SFT1, SFT2))
|
348
|
+
assert v1 == v0, f"SFT1.{n_}={v1} does not equal SFT0.{n_}={v0}"
|
349
|
+
assert v2 == v0, f"SFT2.{n_}={v2} does not equal SFT0.{n_}={v0}"
|
350
|
+
|
351
|
+
|
352
|
+
def test_from_win_equals_dual_exceptions():
|
353
|
+
"""Raise all occurring exceptions in `ShortTimeFFT.from_closest_win_equals_dual`.
|
354
|
+
"""
|
355
|
+
with pytest.raises(ValueError, match="Parameter desired_win is not 1d, but.*"):
|
356
|
+
ShortTimeFFT.from_win_equals_dual(np.ones((3, 4)), hop=1, fs=1)
|
357
|
+
with pytest.raises(ValueError, match="Parameter desired_win cannot be of int.*"):
|
358
|
+
ShortTimeFFT.from_win_equals_dual(np.ones(4, dtype=int), hop=1, fs=1)
|
359
|
+
with pytest.raises(ValueError, match="Parameter desired_win is not 1d, but.*"):
|
360
|
+
ShortTimeFFT.from_win_equals_dual(np.array([]), hop=1, fs=1)
|
361
|
+
with pytest.raises(ValueError, match="Parameter desired_win must have finite.*"):
|
362
|
+
ShortTimeFFT.from_win_equals_dual(np.ones(3) * np.inf, hop=1, fs=1)
|
363
|
+
with pytest.raises(ValueError, match="Parameter hop=0 is not an integer .*"):
|
364
|
+
ShortTimeFFT.from_win_equals_dual(np.ones(4), hop=0, fs=1)
|
365
|
+
with pytest.raises(ValueError, match="Parameter hop=5 is not an integer .*"):
|
366
|
+
ShortTimeFFT.from_win_equals_dual(np.ones(4), hop=5, fs=1)
|
367
|
+
|
368
|
+
with pytest.raises(ValueError, match="P.+ desired_win does not have valid.*"):
|
369
|
+
w = np.array([1, 0, 1, 0, 1], dtype=float)
|
370
|
+
ShortTimeFFT.from_win_equals_dual(w, hop=2, fs=1)
|
371
|
+
with pytest.raises(ValueError, match="Parameter scale_to='invalid' not in.*"):
|
372
|
+
# noinspection PyTypeChecker
|
373
|
+
ShortTimeFFT.from_win_equals_dual(w, hop=2, fs=1, scale_to='invalid')
|
374
|
+
|
375
|
+
@pytest.mark.parametrize('fft_bins', (True, False))
|
376
|
+
@pytest.mark.parametrize('m, hop', [(16, 8), (16, 7), (17, 8), (17, 9), (16, 16)])
|
377
|
+
def test_from_win_equals_dual_params(m, hop, fft_bins):
|
378
|
+
"""Test windows parameterizations for `ShortTimeFFT.from_closest_win_equals_dual`.
|
379
|
+
|
380
|
+
The flattop window is used since it also has negative values.
|
381
|
+
"""
|
382
|
+
desired_win = get_window('flattop', m, fftbins=fft_bins)
|
383
|
+
SFT0 = ShortTimeFFT.from_win_equals_dual(desired_win, hop, fs=1)
|
384
|
+
xp_assert_close(SFT0.dual_win, SFT0.win, err_msg="win must equals dual window!")
|
385
|
+
|
386
|
+
SFT1 = ShortTimeFFT(SFT0.win, hop, fs=1)
|
387
|
+
xp_assert_close(SFT1.dual_win, SFT0.win, err_msg="dual win isn't canonical win!")
|
388
|
+
|
389
|
+
|
390
|
+
@pytest.mark.parametrize('fft_bins', (True, False))
|
391
|
+
@pytest.mark.parametrize('m, hop', [(16, 8), (16, 7), (17, 8), (17, 9), (16, 16)])
|
392
|
+
@pytest.mark.parametrize('scale_to', (None, 'unitary'))
|
393
|
+
def test_from_win_equals_dual_roundtrip(m, hop, fft_bins, scale_to):
|
394
|
+
"""Testing roundtrip verifies that the dual window is correct.
|
395
|
+
"""
|
396
|
+
desired_win = get_window('flattop', m, fftbins=fft_bins)
|
397
|
+
SFT0 = ShortTimeFFT.from_win_equals_dual(desired_win, hop, fs=1)
|
398
|
+
|
399
|
+
x = np.cos(np.arange(2*m)**2)
|
400
|
+
x1 = SFT0.istft(SFT0.stft(x), 0, len(x))
|
401
|
+
xp_assert_close(x1, x, err_msg="Roundtrip for win equaling its dual failed!")
|
402
|
+
|
403
|
+
|
404
|
+
def test_from_win_equals_dual_unitary():
|
405
|
+
"""Check that STFT can be unitary mapping. """
|
406
|
+
m, hop = 8, 4
|
407
|
+
des_win = get_window('hann', m)
|
408
|
+
SFT = ShortTimeFFT.from_win_equals_dual(des_win, hop, 1, fft_mode='twosided',
|
409
|
+
scale_to='unitary')
|
410
|
+
# Orthogonal signals:
|
411
|
+
x, y = np.tile([-1, -1, 1, 1], 4), np.tile([1, -1, -1, 1], 4)
|
412
|
+
Sxx, Sxy = SFT.spectrogram(x), SFT.spectrogram(x, y)
|
413
|
+
|
414
|
+
atol = np.finfo(Sxx.dtype).resolution
|
415
|
+
assert sum(x * y) == 0
|
416
|
+
xp_assert_close(np.sum(Sxx), np.sum(x ** 2, dtype=Sxx.dtype), atol=atol,
|
417
|
+
err_msg="Energies do not match!")
|
418
|
+
xp_assert_close(np.sum(Sxy), 0.0j, atol=atol,
|
419
|
+
err_msg="STFT scalar product of Sx and Sy not 0!")
|
420
|
+
xp_assert_close(SFT.dual_win, SFT.win*SFT.m_num, atol=atol,
|
421
|
+
err_msg="Wrong factor for dual_win/win!")
|
422
|
+
|
423
|
+
|
424
|
+
def test_dual_win_roundtrip():
|
425
|
+
"""Verify the duality of `win` and `dual_win`.
|
426
|
+
|
427
|
+
Note that this test does not work for arbitrary windows, since dual windows
|
428
|
+
are not unique. It always works for invertible STFTs if the windows do not
|
429
|
+
overlap.
|
430
|
+
"""
|
431
|
+
# Non-standard values for keyword arguments (except for `scale_to`):
|
432
|
+
kw = dict(hop=4, fs=1, fft_mode='twosided', mfft=8, scale_to=None,
|
433
|
+
phase_shift=2)
|
434
|
+
SFT0 = ShortTimeFFT(np.ones(4), **kw)
|
435
|
+
SFT1 = ShortTimeFFT.from_dual(SFT0.dual_win, **kw)
|
436
|
+
xp_assert_close(SFT1.dual_win, SFT0.win)
|
437
|
+
|
438
|
+
|
439
|
+
@pytest.mark.parametrize('scale_to, fac_psd, fac_mag',
|
440
|
+
[(None, 0.25, 0.125),
|
441
|
+
('magnitude', 2.0, 1),
|
442
|
+
('psd', 1, 0.5)])
|
443
|
+
def test_scaling(scale_to: Literal['magnitude', 'psd'], fac_psd, fac_mag):
|
444
|
+
"""Verify scaling calculations.
|
445
|
+
|
446
|
+
* Verify passing `scale_to`parameter to ``__init__().
|
447
|
+
* Roundtrip while changing scaling factor.
|
448
|
+
"""
|
449
|
+
SFT = ShortTimeFFT(np.ones(4) * 2, hop=4, fs=1, scale_to=scale_to)
|
450
|
+
assert SFT.fac_psd == fac_psd
|
451
|
+
assert SFT.fac_magnitude == fac_mag
|
452
|
+
# increase coverage by accessing properties twice:
|
453
|
+
assert SFT.fac_psd == fac_psd
|
454
|
+
assert SFT.fac_magnitude == fac_mag
|
455
|
+
|
456
|
+
x = np.fft.irfft([0, 0, 7, 0, 0, 0, 0]) # periodic signal
|
457
|
+
Sx = SFT.stft(x)
|
458
|
+
Sx_mag, Sx_psd = Sx * SFT.fac_magnitude, Sx * SFT.fac_psd
|
459
|
+
|
460
|
+
SFT.scale_to('magnitude')
|
461
|
+
x_mag = SFT.istft(Sx_mag, k1=len(x))
|
462
|
+
xp_assert_close(x_mag, x)
|
463
|
+
|
464
|
+
SFT.scale_to('psd')
|
465
|
+
x_psd = SFT.istft(Sx_psd, k1=len(x))
|
466
|
+
xp_assert_close(x_psd, x)
|
467
|
+
|
468
|
+
|
469
|
+
def test_scale_to():
|
470
|
+
"""Verify `scale_to()` method."""
|
471
|
+
SFT = ShortTimeFFT(np.ones(4) * 2, hop=4, fs=1, scale_to=None)
|
472
|
+
|
473
|
+
SFT.scale_to('magnitude')
|
474
|
+
assert SFT.scaling == 'magnitude'
|
475
|
+
assert SFT.fac_psd == 2.0
|
476
|
+
assert SFT.fac_magnitude == 1
|
477
|
+
|
478
|
+
SFT.scale_to('psd')
|
479
|
+
assert SFT.scaling == 'psd'
|
480
|
+
assert SFT.fac_psd == 1
|
481
|
+
assert SFT.fac_magnitude == 0.5
|
482
|
+
|
483
|
+
SFT.scale_to('psd') # needed for coverage
|
484
|
+
|
485
|
+
for scale, s_fac in zip(('magnitude', 'psd'), (8, 4)):
|
486
|
+
SFT = ShortTimeFFT(np.ones(4) * 2, hop=4, fs=1, scale_to=None)
|
487
|
+
dual_win = SFT.dual_win.copy()
|
488
|
+
|
489
|
+
SFT.scale_to(cast(Literal['magnitude', 'psd'], scale))
|
490
|
+
xp_assert_close(SFT.dual_win, dual_win * s_fac)
|
491
|
+
|
492
|
+
|
493
|
+
def test_x_slices_padding():
|
494
|
+
"""Verify padding.
|
495
|
+
|
496
|
+
The reference arrays were taken from the docstrings of `zero_ext`,
|
497
|
+
`const_ext`, `odd_ext()`, and `even_ext()` from the _array_tools module.
|
498
|
+
"""
|
499
|
+
SFT = ShortTimeFFT(np.ones(5), hop=4, fs=1)
|
500
|
+
x = np.array([[1, 2, 3, 4, 5], [0, 1, 4, 9, 16]], dtype=float)
|
501
|
+
d = {'zeros': [[[0, 0, 1, 2, 3], [0, 0, 0, 1, 4]],
|
502
|
+
[[3, 4, 5, 0, 0], [4, 9, 16, 0, 0]]],
|
503
|
+
'edge': [[[1, 1, 1, 2, 3], [0, 0, 0, 1, 4]],
|
504
|
+
[[3, 4, 5, 5, 5], [4, 9, 16, 16, 16]]],
|
505
|
+
'even': [[[3, 2, 1, 2, 3], [4, 1, 0, 1, 4]],
|
506
|
+
[[3, 4, 5, 4, 3], [4, 9, 16, 9, 4]]],
|
507
|
+
'odd': [[[-1, 0, 1, 2, 3], [-4, -1, 0, 1, 4]],
|
508
|
+
[[3, 4, 5, 6, 7], [4, 9, 16, 23, 28]]]}
|
509
|
+
for p_, xx in d.items():
|
510
|
+
gen = SFT._x_slices(np.array(x), 0, 0, 2, padding=cast(PAD_TYPE, p_))
|
511
|
+
yy = np.array([y_.copy() for y_ in gen]) # due to inplace copying
|
512
|
+
xx = np.asarray(xx, dtype=np.float64)
|
513
|
+
xp_assert_equal(yy, xx, err_msg=f"Failed '{p_}' padding.")
|
514
|
+
|
515
|
+
|
516
|
+
def test_invertible():
|
517
|
+
"""Verify `invertible` property. """
|
518
|
+
SFT = ShortTimeFFT(np.ones(8), hop=4, fs=1)
|
519
|
+
assert SFT.invertible
|
520
|
+
SFT = ShortTimeFFT(np.ones(8), hop=9, fs=1)
|
521
|
+
assert not SFT.invertible
|
522
|
+
|
523
|
+
|
524
|
+
def test_border_values():
|
525
|
+
"""Ensure that minimum and maximum values of slices are correct."""
|
526
|
+
SFT = ShortTimeFFT(np.ones(8), hop=4, fs=1)
|
527
|
+
assert SFT.p_min == 0
|
528
|
+
assert SFT.k_min == -4
|
529
|
+
assert SFT.lower_border_end == (4, 1)
|
530
|
+
assert SFT.lower_border_end == (4, 1) # needed to test caching
|
531
|
+
assert SFT.p_max(10) == 4
|
532
|
+
assert SFT.k_max(10) == 16
|
533
|
+
assert SFT.upper_border_begin(10) == (4, 2)
|
534
|
+
# Raise exceptions:
|
535
|
+
with pytest.raises(ValueError, match="^Parameter n must be"):
|
536
|
+
SFT.upper_border_begin(3)
|
537
|
+
with pytest.raises(ValueError, match="^Parameter n must be"):
|
538
|
+
SFT._post_padding(3)
|
539
|
+
|
540
|
+
def test_border_values_exotic():
|
541
|
+
"""Ensure that the border calculations are correct for windows with
|
542
|
+
zeros. """
|
543
|
+
w = np.array([0, 0, 0, 0, 0, 0, 0, 1.])
|
544
|
+
SFT = ShortTimeFFT(w, hop=1, fs=1)
|
545
|
+
assert SFT.lower_border_end == (0, 0)
|
546
|
+
|
547
|
+
SFT = ShortTimeFFT(np.flip(w), hop=20, fs=1)
|
548
|
+
assert SFT.upper_border_begin(4) == (16, 1)
|
549
|
+
assert SFT.upper_border_begin(5) == (16, 1)
|
550
|
+
assert SFT.upper_border_begin(23) == (36, 2)
|
551
|
+
assert SFT.upper_border_begin(24) == (36, 2)
|
552
|
+
assert SFT.upper_border_begin(25) == (36, 2)
|
553
|
+
|
554
|
+
SFT._hop = -1 # provoke unreachable line
|
555
|
+
with pytest.raises(RuntimeError):
|
556
|
+
_ = SFT.k_max(4)
|
557
|
+
with pytest.raises(RuntimeError):
|
558
|
+
_ = SFT.k_min
|
559
|
+
|
560
|
+
|
561
|
+
def test_t():
|
562
|
+
"""Verify that the times of the slices are correct. """
|
563
|
+
SFT = ShortTimeFFT(np.ones(8), hop=4, fs=2)
|
564
|
+
assert SFT.T == 1/2
|
565
|
+
assert SFT.fs == 2.
|
566
|
+
assert SFT.delta_t == 4 * 1/2
|
567
|
+
t_stft = np.arange(0, SFT.p_max(10)) * SFT.delta_t
|
568
|
+
xp_assert_equal(SFT.t(10), t_stft)
|
569
|
+
xp_assert_equal(SFT.t(10, 1, 3), t_stft[1:3])
|
570
|
+
SFT.T = 1/4
|
571
|
+
assert SFT.T == 1/4
|
572
|
+
assert SFT.fs == 4
|
573
|
+
SFT.fs = 1/8
|
574
|
+
assert SFT.fs == 1/8
|
575
|
+
assert SFT.T == 8
|
576
|
+
|
577
|
+
|
578
|
+
@pytest.mark.parametrize('fft_mode, f',
|
579
|
+
[('onesided', [0., 1., 2.]),
|
580
|
+
('onesided2X', [0., 1., 2.]),
|
581
|
+
('twosided', [0., 1., 2., -2., -1.]),
|
582
|
+
('centered', [-2., -1., 0., 1., 2.])])
|
583
|
+
def test_f(fft_mode: FFT_MODE_TYPE, f):
|
584
|
+
"""Verify the frequency values property `f`."""
|
585
|
+
SFT = ShortTimeFFT(np.ones(5), hop=4, fs=5, fft_mode=fft_mode,
|
586
|
+
scale_to='psd')
|
587
|
+
xp_assert_equal(SFT.f, f)
|
588
|
+
|
589
|
+
|
590
|
+
@pytest.mark.parametrize('n', [20, 21])
|
591
|
+
@pytest.mark.parametrize('m', [5, 6])
|
592
|
+
@pytest.mark.parametrize('fft_mode', ['onesided', 'centered'])
|
593
|
+
def test_extent(n, m, fft_mode: FFT_MODE_TYPE):
|
594
|
+
"""Ensure that the `extent()` method is correct. """
|
595
|
+
SFT = ShortTimeFFT(np.ones(m), hop=m, fs=m, fft_mode=fft_mode)
|
596
|
+
|
597
|
+
t0 = SFT.t(n)[0] # first timestamp
|
598
|
+
t1 = SFT.t(n)[-1] + SFT.delta_t # last timestamp + 1
|
599
|
+
t0c, t1c = t0 - SFT.delta_t / 2, t1 - SFT.delta_t / 2 # centered timestamps
|
600
|
+
|
601
|
+
f0 = SFT.f[0] # first frequency
|
602
|
+
f1 = SFT.f[-1] + SFT.delta_f # last frequency + 1
|
603
|
+
f0c, f1c = f0 - SFT.delta_f / 2, f1 - SFT.delta_f / 2 # centered frequencies
|
604
|
+
|
605
|
+
assert SFT.extent(n, 'tf', False) == (t0, t1, f0, f1)
|
606
|
+
assert SFT.extent(n, 'ft', False) == (f0, f1, t0, t1)
|
607
|
+
assert SFT.extent(n, 'tf', True) == (t0c, t1c, f0c, f1c)
|
608
|
+
assert SFT.extent(n, 'ft', True) == (f0c, f1c, t0c, t1c)
|
609
|
+
|
610
|
+
|
611
|
+
def test_spectrogram():
|
612
|
+
"""Verify spectrogram and cross-spectrogram methods. """
|
613
|
+
SFT = ShortTimeFFT(np.ones(8), hop=4, fs=1)
|
614
|
+
x, y = np.ones(10), np.arange(10)
|
615
|
+
X, Y = SFT.stft(x), SFT.stft(y)
|
616
|
+
xp_assert_close(SFT.spectrogram(x), X.real**2+X.imag**2)
|
617
|
+
xp_assert_close(SFT.spectrogram(x, y), X * Y.conj())
|
618
|
+
|
619
|
+
|
620
|
+
@pytest.mark.parametrize('n', [8, 9])
|
621
|
+
def test_fft_func_roundtrip(n: int):
|
622
|
+
"""Test roundtrip `ifft_func(fft_func(x)) == x` for all permutations of
|
623
|
+
relevant parameters. """
|
624
|
+
np.random.seed(2394795)
|
625
|
+
x0 = np.random.rand(n)
|
626
|
+
w, h_n = np.ones(n), 4
|
627
|
+
|
628
|
+
pp = dict(
|
629
|
+
fft_mode=get_args(FFT_MODE_TYPE),
|
630
|
+
mfft=[None, n, n+1, n+2],
|
631
|
+
scaling=[None, 'magnitude', 'psd'],
|
632
|
+
phase_shift=[None, -n+1, 0, n // 2, n-1])
|
633
|
+
for f_typ, mfft, scaling, phase_shift in product(*pp.values()):
|
634
|
+
if f_typ == 'onesided2X' and scaling is None:
|
635
|
+
continue # this combination is forbidden
|
636
|
+
SFT = ShortTimeFFT(w, h_n, fs=n, fft_mode=f_typ, mfft=mfft,
|
637
|
+
scale_to=scaling, phase_shift=phase_shift)
|
638
|
+
X0 = SFT._fft_func(x0)
|
639
|
+
x1 = SFT._ifft_func(X0)
|
640
|
+
xp_assert_close(x0.astype(x1.dtype), x1,
|
641
|
+
err_msg="_fft_func() roundtrip failed for " +
|
642
|
+
f"{f_typ=}, {mfft=}, {scaling=}, {phase_shift=}")
|
643
|
+
|
644
|
+
SFT = ShortTimeFFT(w, h_n, fs=1)
|
645
|
+
SFT._fft_mode = 'invalid_fft' # type: ignore
|
646
|
+
with pytest.raises(RuntimeError):
|
647
|
+
SFT._fft_func(x0)
|
648
|
+
with pytest.raises(RuntimeError):
|
649
|
+
SFT._ifft_func(x0)
|
650
|
+
|
651
|
+
|
652
|
+
@pytest.mark.parametrize('i', range(19))
|
653
|
+
def test_impulse_roundtrip(i):
|
654
|
+
"""Roundtrip for an impulse being at different positions `i`."""
|
655
|
+
n = 19
|
656
|
+
w, h_n = np.ones(8), 3
|
657
|
+
x = np.zeros(n)
|
658
|
+
x[i] = 1
|
659
|
+
|
660
|
+
SFT = ShortTimeFFT(w, hop=h_n, fs=1, scale_to=None, phase_shift=None)
|
661
|
+
Sx = SFT.stft(x)
|
662
|
+
# test slicing the input signal into two parts:
|
663
|
+
n_q = SFT.nearest_k_p(n // 2)
|
664
|
+
Sx0 = SFT.stft(x[:n_q], padding='zeros')
|
665
|
+
Sx1 = SFT.stft(x[n_q:], padding='zeros')
|
666
|
+
q0_ub = SFT.upper_border_begin(n_q)[1] - SFT.p_min
|
667
|
+
q1_le = SFT.lower_border_end[1] - SFT.p_min
|
668
|
+
xp_assert_close(Sx0[:, :q0_ub], Sx[:, :q0_ub], err_msg=f"{i=}")
|
669
|
+
xp_assert_close(Sx1[:, q1_le:], Sx[:, q1_le-Sx1.shape[1]:],
|
670
|
+
err_msg=f"{i=}")
|
671
|
+
|
672
|
+
Sx01 = np.hstack((Sx0[:, :q0_ub],
|
673
|
+
Sx0[:, q0_ub:] + Sx1[:, :q1_le],
|
674
|
+
Sx1[:, q1_le:]))
|
675
|
+
xp_assert_close(Sx, Sx01, atol=1e-8, err_msg=f"{i=}")
|
676
|
+
|
677
|
+
y = SFT.istft(Sx, 0, n)
|
678
|
+
xp_assert_close(y, x, atol=1e-8, err_msg=f"{i=}")
|
679
|
+
y0 = SFT.istft(Sx, 0, n//2)
|
680
|
+
xp_assert_close(x[:n//2], y0, atol=1e-8, err_msg=f"{i=}")
|
681
|
+
y1 = SFT.istft(Sx, n // 2, n)
|
682
|
+
xp_assert_close(x[n // 2:], y1, atol=1e-8, err_msg=f"{i=}")
|
683
|
+
|
684
|
+
|
685
|
+
@pytest.mark.parametrize('hop', [1, 7, 8])
|
686
|
+
def test_asymmetric_window_roundtrip(hop: int):
|
687
|
+
"""An asymmetric window could uncover indexing problems. """
|
688
|
+
np.random.seed(23371)
|
689
|
+
|
690
|
+
w = np.arange(16) / 8 # must be of type float
|
691
|
+
w[len(w)//2:] = 1
|
692
|
+
SFT = ShortTimeFFT(w, hop, fs=1)
|
693
|
+
|
694
|
+
x = 10 * np.random.randn(64)
|
695
|
+
Sx = SFT.stft(x)
|
696
|
+
x1 = SFT.istft(Sx, k1=len(x))
|
697
|
+
xp_assert_close(x1, x1, err_msg="Roundtrip for asymmetric window with " +
|
698
|
+
f" {hop=} failed!")
|
699
|
+
|
700
|
+
|
701
|
+
@pytest.mark.parametrize('m_num', [6, 7])
|
702
|
+
def test_minimal_length_signal(m_num):
|
703
|
+
"""Verify that the shortest allowed signal works. """
|
704
|
+
SFT = ShortTimeFFT(np.ones(m_num), m_num//2, fs=1)
|
705
|
+
n = math.ceil(m_num/2)
|
706
|
+
x = np.ones(n)
|
707
|
+
Sx = SFT.stft(x)
|
708
|
+
x1 = SFT.istft(Sx, k1=n)
|
709
|
+
xp_assert_close(x1, x, err_msg=f"Roundtrip minimal length signal ({n=})" +
|
710
|
+
f" for {m_num} sample window failed!")
|
711
|
+
with pytest.raises(ValueError, match=rf"len\(x\)={n-1} must be >= ceil.*"):
|
712
|
+
SFT.stft(x[:-1])
|
713
|
+
with pytest.raises(ValueError, match=rf"S.shape\[t_axis\]={Sx.shape[1]-1}"
|
714
|
+
f" needs to have at least {Sx.shape[1]} slices"):
|
715
|
+
SFT.istft(Sx[:, :-1], k1=n)
|
716
|
+
|
717
|
+
|
718
|
+
def test_compare_stft_detrend():
|
719
|
+
"""Test the detrending in `ShortTimeFFT.stft_detrend()`. """
|
720
|
+
SFT = ShortTimeFFT(np.ones(4), 4, fs=1)
|
721
|
+
x0 = np.zeros(4) # signal without trend
|
722
|
+
x1 = x0 + 3 # signal with constant trend
|
723
|
+
x2 = x0 + np.arange(len(x0)) # signal with linear trend
|
724
|
+
|
725
|
+
kw = dict(k_offset=2, p1=1) # we want only one slice
|
726
|
+
Sx0 = SFT.stft(x0, **kw) # no trend
|
727
|
+
Sx1 = SFT.stft_detrend(x1, detr='constant', **kw)
|
728
|
+
Sx2 = SFT.stft_detrend(x2, detr='linear', **kw)
|
729
|
+
Sx3 = SFT.stft_detrend(x1, detr=lambda x: x - np.mean(x), **kw)
|
730
|
+
|
731
|
+
atol = np.finfo(Sx0.dtype).resolution * 5 # needed to compare with array of zeros
|
732
|
+
xp_assert_close(Sx1, Sx0, atol=atol, err_msg="Constant detrending failed!")
|
733
|
+
xp_assert_close(Sx0, Sx2, atol=atol, err_msg="Linear detrending failed!")
|
734
|
+
xp_assert_close(Sx0, Sx3, atol=atol, err_msg="Detrending using a function failed!")
|
735
|
+
|
736
|
+
|
737
|
+
def test_tutorial_stft_sliding_win():
|
738
|
+
"""Verify example in "Sliding Windows" subsection from the "User Guide".
|
739
|
+
|
740
|
+
In :ref:`tutorial_stft_sliding_win` (file ``signal.rst``) of the
|
741
|
+
:ref:`user_guide` the behavior the border behavior of
|
742
|
+
``ShortTimeFFT(np.ones(6), 2, fs=1)`` with a 50 sample signal is discussed.
|
743
|
+
This test verifies the presented indexes.
|
744
|
+
"""
|
745
|
+
SFT = ShortTimeFFT(np.ones(6), 2, fs=1)
|
746
|
+
|
747
|
+
# Lower border:
|
748
|
+
assert SFT.m_num_mid == 3, f"Slice middle is not 3 but {SFT.m_num_mid=}"
|
749
|
+
assert SFT.p_min == -1, f"Lowest slice {SFT.p_min=} is not -1"
|
750
|
+
assert SFT.k_min == -5, f"Lowest slice sample {SFT.p_min=} is not -5"
|
751
|
+
k_lb, p_lb = SFT.lower_border_end
|
752
|
+
assert p_lb == 2, f"First unaffected slice {p_lb=} is not 2"
|
753
|
+
assert k_lb == 5, f"First unaffected sample {k_lb=} is not 5"
|
754
|
+
|
755
|
+
n = 50 # upper signal border
|
756
|
+
assert (p_max := SFT.p_max(n)) == 27, f"Last slice {p_max=} must be 27"
|
757
|
+
assert (k_max := SFT.k_max(n)) == 55, f"Last sample {k_max=} must be 55"
|
758
|
+
k_ub, p_ub = SFT.upper_border_begin(n)
|
759
|
+
assert p_ub == 24, f"First upper border slice {p_ub=} must be 24"
|
760
|
+
assert k_ub == 45, f"First upper border slice {k_ub=} must be 45"
|
761
|
+
|
762
|
+
|
763
|
+
def test_tutorial_stft_legacy_stft():
|
764
|
+
"""Verify STFT example in "Comparison with Legacy Implementation" from the
|
765
|
+
"User Guide".
|
766
|
+
|
767
|
+
In :ref:`tutorial_stft_legacy_stft` (file ``signal.rst``) of the
|
768
|
+
:ref:`user_guide` the legacy and the new implementation are compared.
|
769
|
+
"""
|
770
|
+
fs, N = 200, 1001 # # 200 Hz sampling rate for 5 s signal
|
771
|
+
t_z = np.arange(N) / fs # time indexes for signal
|
772
|
+
z = np.exp(2j*np.pi * 70 * (t_z - 0.2 * t_z ** 2)) # complex-valued chirp
|
773
|
+
|
774
|
+
nperseg, noverlap = 50, 40
|
775
|
+
win = ('gaussian', 1e-2 * fs) # Gaussian with 0.01 s standard deviation
|
776
|
+
|
777
|
+
# Legacy STFT:
|
778
|
+
f0_u, t0, Sz0_u = stft(z, fs, win, nperseg, noverlap,
|
779
|
+
return_onesided=False, scaling='spectrum')
|
780
|
+
Sz0 = fftshift(Sz0_u, axes=0)
|
781
|
+
|
782
|
+
# New STFT:
|
783
|
+
SFT = ShortTimeFFT.from_window(win, fs, nperseg, noverlap,
|
784
|
+
fft_mode='centered',
|
785
|
+
scale_to='magnitude', phase_shift=None)
|
786
|
+
Sz1 = SFT.stft(z)
|
787
|
+
|
788
|
+
xp_assert_close(Sz0, Sz1[:, 2:-1])
|
789
|
+
|
790
|
+
xp_assert_close((abs(Sz1[:, 1]).min(), abs(Sz1[:, 1]).max()),
|
791
|
+
(6.925060911593139e-07, 8.00271269218721e-07))
|
792
|
+
|
793
|
+
t0_r, z0_r = istft(Sz0_u, fs, win, nperseg, noverlap, input_onesided=False,
|
794
|
+
scaling='spectrum')
|
795
|
+
z1_r = SFT.istft(Sz1, k1=N)
|
796
|
+
assert len(z0_r) == N + 9
|
797
|
+
xp_assert_close(z0_r[:N], z)
|
798
|
+
xp_assert_close(z1_r, z)
|
799
|
+
|
800
|
+
# Spectrogram is just the absolute square of th STFT:
|
801
|
+
xp_assert_close(SFT.spectrogram(z), abs(Sz1) ** 2)
|
802
|
+
|
803
|
+
|
804
|
+
def test_tutorial_stft_legacy_spectrogram():
|
805
|
+
"""Verify spectrogram example in "Comparison with Legacy Implementation"
|
806
|
+
from the "User Guide".
|
807
|
+
|
808
|
+
In :ref:`tutorial_stft_legacy_stft` (file ``signal.rst``) of the
|
809
|
+
:ref:`user_guide` the legacy and the new implementation are compared.
|
810
|
+
"""
|
811
|
+
fs, N = 200, 1001 # 200 Hz sampling rate for almost 5 s signal
|
812
|
+
t_z = np.arange(N) / fs # time indexes for signal
|
813
|
+
z = np.exp(2j*np.pi*70 * (t_z - 0.2*t_z**2)) # complex-valued sweep
|
814
|
+
|
815
|
+
nperseg, noverlap = 50, 40
|
816
|
+
win = ('gaussian', 1e-2 * fs) # Gaussian with 0.01 s standard dev.
|
817
|
+
|
818
|
+
# Legacy spectrogram:
|
819
|
+
f2_u, t2, Sz2_u = spectrogram(z, fs, win, nperseg, noverlap, detrend=None,
|
820
|
+
return_onesided=False, scaling='spectrum',
|
821
|
+
mode='complex')
|
822
|
+
|
823
|
+
f2, Sz2 = fftshift(f2_u), fftshift(Sz2_u, axes=0)
|
824
|
+
|
825
|
+
# New STFT:
|
826
|
+
SFT = ShortTimeFFT.from_window(win, fs, nperseg, noverlap,
|
827
|
+
fft_mode='centered', scale_to='magnitude',
|
828
|
+
phase_shift=None)
|
829
|
+
Sz3 = SFT.stft(z, p0=0, p1=(N-noverlap) // SFT.hop, k_offset=nperseg // 2)
|
830
|
+
t3 = SFT.t(N, p0=0, p1=(N-noverlap) // SFT.hop, k_offset=nperseg // 2)
|
831
|
+
|
832
|
+
xp_assert_close(t2, t3)
|
833
|
+
xp_assert_close(f2, SFT.f)
|
834
|
+
xp_assert_close(Sz2, Sz3)
|
835
|
+
|
836
|
+
|
837
|
+
def test_permute_axes():
|
838
|
+
"""Verify correctness of four-dimensional signal by permuting its
|
839
|
+
shape. """
|
840
|
+
n = 25
|
841
|
+
SFT = ShortTimeFFT(np.ones(8)/8, hop=3, fs=n)
|
842
|
+
x0 = np.arange(n, dtype=np.float64)
|
843
|
+
Sx0 = SFT.stft(x0)
|
844
|
+
Sx0 = Sx0.reshape((Sx0.shape[0], 1, 1, 1, Sx0.shape[-1]))
|
845
|
+
SxT = np.moveaxis(Sx0, (0, -1), (-1, 0))
|
846
|
+
|
847
|
+
atol = 2 * np.finfo(SFT.win.dtype).resolution
|
848
|
+
for i in range(4):
|
849
|
+
y = np.reshape(x0, np.roll((n, 1, 1, 1), i))
|
850
|
+
Sy = SFT.stft(y, axis=i)
|
851
|
+
xp_assert_close(Sy, np.moveaxis(Sx0, 0, i))
|
852
|
+
|
853
|
+
yb0 = SFT.istft(Sy, k1=n, f_axis=i)
|
854
|
+
xp_assert_close(yb0, y, atol=atol)
|
855
|
+
# explicit t-axis parameter (for coverage):
|
856
|
+
yb1 = SFT.istft(Sy, k1=n, f_axis=i, t_axis=Sy.ndim-1)
|
857
|
+
xp_assert_close(yb1, y, atol=atol)
|
858
|
+
|
859
|
+
SyT = np.moveaxis(Sy, (i, -1), (-1, i))
|
860
|
+
xp_assert_close(SyT, np.moveaxis(SxT, 0, i))
|
861
|
+
|
862
|
+
ybT = SFT.istft(SyT, k1=n, t_axis=i, f_axis=-1)
|
863
|
+
xp_assert_close(ybT, y, atol=atol)
|
864
|
+
|
865
|
+
|
866
|
+
@pytest.mark.parametrize("fft_mode",
|
867
|
+
('twosided', 'centered', 'onesided', 'onesided2X'))
|
868
|
+
def test_roundtrip_multidimensional(fft_mode: FFT_MODE_TYPE):
|
869
|
+
"""Test roundtrip of a multidimensional input signal versus its components.
|
870
|
+
|
871
|
+
This test can uncover potential problems with `fftshift()`.
|
872
|
+
"""
|
873
|
+
n = 9
|
874
|
+
x = np.arange(4*n*2, dtype=np.float64).reshape(4, n, 2)
|
875
|
+
SFT = ShortTimeFFT(get_window('hann', 4), hop=2, fs=1,
|
876
|
+
scale_to='magnitude', fft_mode=fft_mode)
|
877
|
+
Sx = SFT.stft(x, axis=1)
|
878
|
+
y = SFT.istft(Sx, k1=n, f_axis=1, t_axis=-1)
|
879
|
+
xp_assert_close(y, x.astype(y.dtype), err_msg='Multidim. roundtrip failed!')
|
880
|
+
|
881
|
+
for i, j in product(range(x.shape[0]), range(x.shape[2])):
|
882
|
+
y_ = SFT.istft(Sx[i, :, j, :], k1=n)
|
883
|
+
xp_assert_close(y_, x[i, :, j].astype(y_.dtype),
|
884
|
+
err_msg="Multidim. roundtrip for component " +
|
885
|
+
f"x[{i}, :, {j}] and {fft_mode=} failed!")
|
886
|
+
|
887
|
+
@pytest.mark.parametrize("phase_shift", (0, 4, None))
|
888
|
+
def test_roundtrip_two_dimensional(phase_shift: int|None):
|
889
|
+
"""Test roundtrip of a 2 channel input signal with `mfft` set with different
|
890
|
+
values for `phase_shift`
|
891
|
+
|
892
|
+
Tests for Issue https://github.com/scipy/scipy/issues/21671
|
893
|
+
"""
|
894
|
+
n = 21
|
895
|
+
SFT = ShortTimeFFT.from_window('hann', fs=1, nperseg=13, noverlap=7,
|
896
|
+
mfft=16, phase_shift=phase_shift)
|
897
|
+
x = np.arange(2*n, dtype=float).reshape(2, n)
|
898
|
+
Sx = SFT.stft(x)
|
899
|
+
y = SFT.istft(Sx, k1=n)
|
900
|
+
xp_assert_close(y, x, atol=2 * np.finfo(SFT.win.dtype).resolution,
|
901
|
+
err_msg='2-dim. roundtrip failed!')
|
902
|
+
|
903
|
+
|
904
|
+
@pytest.mark.parametrize('window, n, nperseg, noverlap',
|
905
|
+
[('boxcar', 100, 10, 0), # Test no overlap
|
906
|
+
('boxcar', 100, 10, 9), # Test high overlap
|
907
|
+
('bartlett', 101, 51, 26), # Test odd nperseg
|
908
|
+
('hann', 1024, 256, 128), # Test defaults
|
909
|
+
(('tukey', 0.5), 1152, 256, 64), # Test Tukey
|
910
|
+
('hann', 1024, 256, 255), # Test overlapped hann
|
911
|
+
('boxcar', 100, 10, 3), # NOLA True, COLA False
|
912
|
+
('bartlett', 101, 51, 37), # NOLA True, COLA False
|
913
|
+
('hann', 1024, 256, 127), # NOLA True, COLA False
|
914
|
+
# NOLA True, COLA False:
|
915
|
+
(('tukey', 0.5), 1152, 256, 14),
|
916
|
+
('hann', 1024, 256, 5)]) # NOLA True, COLA False
|
917
|
+
def test_roundtrip_windows(window, n: int, nperseg: int, noverlap: int):
|
918
|
+
"""Roundtrip test adapted from `test_spectral.TestSTFT`.
|
919
|
+
|
920
|
+
The parameters are taken from the methods test_roundtrip_real(),
|
921
|
+
test_roundtrip_nola_not_cola(), test_roundtrip_float32(),
|
922
|
+
test_roundtrip_complex().
|
923
|
+
"""
|
924
|
+
np.random.seed(2394655)
|
925
|
+
|
926
|
+
w = get_window(window, nperseg)
|
927
|
+
SFT = ShortTimeFFT(w, nperseg - noverlap, fs=1, fft_mode='twosided',
|
928
|
+
phase_shift=None)
|
929
|
+
|
930
|
+
z = 10 * np.random.randn(n) + 10j * np.random.randn(n)
|
931
|
+
Sz = SFT.stft(z)
|
932
|
+
z1 = SFT.istft(Sz, k1=len(z))
|
933
|
+
xp_assert_close(z, z1, err_msg="Roundtrip for complex values failed")
|
934
|
+
|
935
|
+
x = 10 * np.random.randn(n)
|
936
|
+
Sx = SFT.stft(x)
|
937
|
+
x1 = SFT.istft(Sx, k1=len(z))
|
938
|
+
xp_assert_close(x.astype(np.complex128), x1,
|
939
|
+
err_msg="Roundtrip for float values failed")
|
940
|
+
|
941
|
+
x32 = x.astype(np.float32)
|
942
|
+
Sx32 = SFT.stft(x32)
|
943
|
+
x32_1 = SFT.istft(Sx32, k1=len(x32))
|
944
|
+
x32_1_r = x32_1.real
|
945
|
+
xp_assert_close(x32, x32_1_r.astype(np.float32),
|
946
|
+
err_msg="Roundtrip for 32 Bit float values failed")
|
947
|
+
xp_assert_close(x32.imag, np.zeros_like(x32.imag),
|
948
|
+
err_msg="Roundtrip for 32 Bit float values failed")
|
949
|
+
|
950
|
+
|
951
|
+
@pytest.mark.parametrize('signal_type', ('real', 'complex'))
|
952
|
+
def test_roundtrip_complex_window(signal_type):
|
953
|
+
"""Test roundtrip for complex-valued window function
|
954
|
+
|
955
|
+
The purpose of this test is to check if the dual window is calculated
|
956
|
+
correctly for complex-valued windows.
|
957
|
+
"""
|
958
|
+
np.random.seed(1354654)
|
959
|
+
win = np.exp(2j*np.linspace(0, np.pi, 8))
|
960
|
+
SFT = ShortTimeFFT(win, 3, fs=1, fft_mode='twosided')
|
961
|
+
|
962
|
+
z = 10 * np.random.randn(11)
|
963
|
+
if signal_type == 'complex':
|
964
|
+
z = z + 2j * z
|
965
|
+
Sz = SFT.stft(z)
|
966
|
+
z1 = SFT.istft(Sz, k1=len(z))
|
967
|
+
xp_assert_close(z.astype(np.complex128), z1,
|
968
|
+
err_msg="Roundtrip for complex-valued window failed")
|
969
|
+
|
970
|
+
|
971
|
+
def test_average_all_segments():
|
972
|
+
"""Compare `welch` function with stft mean.
|
973
|
+
|
974
|
+
Ported from `TestSpectrogram.test_average_all_segments` from file
|
975
|
+
``test__spectral.py``.
|
976
|
+
"""
|
977
|
+
x = np.random.randn(1024)
|
978
|
+
|
979
|
+
fs = 1.0
|
980
|
+
window = ('tukey', 0.25)
|
981
|
+
nperseg, noverlap = 16, 2
|
982
|
+
fw, Pw = welch(x, fs, window, nperseg, noverlap)
|
983
|
+
SFT = ShortTimeFFT.from_window(window, fs, nperseg, noverlap,
|
984
|
+
fft_mode='onesided2X', scale_to='psd',
|
985
|
+
phase_shift=None)
|
986
|
+
# `welch` positions the window differently than the STFT:
|
987
|
+
P = SFT.spectrogram(x, detr='constant', p0=0,
|
988
|
+
p1=(len(x)-noverlap)//SFT.hop, k_offset=nperseg//2)
|
989
|
+
|
990
|
+
xp_assert_close(SFT.f, fw)
|
991
|
+
xp_assert_close(np.mean(P, axis=-1), Pw)
|
992
|
+
|
993
|
+
|
994
|
+
@pytest.mark.parametrize('window, N, nperseg, noverlap, mfft',
|
995
|
+
# from test_roundtrip_padded_FFT:
|
996
|
+
[('hann', 1024, 256, 128, 512),
|
997
|
+
('hann', 1024, 256, 128, 501),
|
998
|
+
('boxcar', 100, 10, 0, 33),
|
999
|
+
(('tukey', 0.5), 1152, 256, 64, 1024),
|
1000
|
+
# from test_roundtrip_padded_signal:
|
1001
|
+
('boxcar', 101, 10, 0, None),
|
1002
|
+
('hann', 1000, 256, 128, None),
|
1003
|
+
# from test_roundtrip_boundary_extension:
|
1004
|
+
('boxcar', 100, 10, 0, None),
|
1005
|
+
('boxcar', 100, 10, 9, None)])
|
1006
|
+
@pytest.mark.parametrize('padding', get_args(PAD_TYPE))
|
1007
|
+
def test_stft_padding_roundtrip(window, N: int, nperseg: int, noverlap: int,
|
1008
|
+
mfft: int, padding):
|
1009
|
+
"""Test the parameter 'padding' of `stft` with roundtrips.
|
1010
|
+
|
1011
|
+
The STFT parametrizations were taken from the methods
|
1012
|
+
`test_roundtrip_padded_FFT`, `test_roundtrip_padded_signal` and
|
1013
|
+
`test_roundtrip_boundary_extension` from class `TestSTFT` in file
|
1014
|
+
``test_spectral.py``. Note that the ShortTimeFFT does not need the
|
1015
|
+
concept of "boundary extension".
|
1016
|
+
"""
|
1017
|
+
x = normal_distribution.rvs(size=N, random_state=2909) # real signal
|
1018
|
+
z = x * np.exp(1j * np.pi / 4) # complex signal
|
1019
|
+
|
1020
|
+
SFT = ShortTimeFFT.from_window(window, 1, nperseg, noverlap,
|
1021
|
+
fft_mode='twosided', mfft=mfft)
|
1022
|
+
Sx = SFT.stft(x, padding=padding)
|
1023
|
+
x1 = SFT.istft(Sx, k1=N)
|
1024
|
+
xp_assert_close(x1, x.astype(np.complex128),
|
1025
|
+
err_msg=f"Failed real roundtrip with '{padding}' padding")
|
1026
|
+
|
1027
|
+
Sz = SFT.stft(z, padding=padding)
|
1028
|
+
z1 = SFT.istft(Sz, k1=N)
|
1029
|
+
xp_assert_close(z1, z, err_msg="Failed complex roundtrip with " +
|
1030
|
+
f" '{padding}' padding")
|
1031
|
+
|
1032
|
+
|
1033
|
+
@pytest.mark.parametrize('N_x', (128, 129, 255, 256, 1337)) # signal length
|
1034
|
+
@pytest.mark.parametrize('w_size', (128, 256)) # window length
|
1035
|
+
@pytest.mark.parametrize('t_step', (4, 64)) # SFT time hop
|
1036
|
+
@pytest.mark.parametrize('f_c', (7., 23.)) # frequency of input sine
|
1037
|
+
def test_energy_conservation(N_x: int, w_size: int, t_step: int, f_c: float):
|
1038
|
+
"""Test if a `psd`-scaled STFT conserves the L2 norm.
|
1039
|
+
|
1040
|
+
This test is adapted from MNE-Python [1]_. Besides being battle-tested,
|
1041
|
+
this test has the benefit of using non-standard window including
|
1042
|
+
non-positive values and a 2d input signal.
|
1043
|
+
|
1044
|
+
Since `ShortTimeFFT` requires the signal length `N_x` to be at least the
|
1045
|
+
window length `w_size`, the parameter `N_x` was changed from
|
1046
|
+
``(127, 128, 255, 256, 1337)`` to ``(128, 129, 255, 256, 1337)`` to be
|
1047
|
+
more useful.
|
1048
|
+
|
1049
|
+
.. [1] File ``test_stft.py`` of MNE-Python
|
1050
|
+
https://github.com/mne-tools/mne-python/blob/main/mne/time_frequency/tests/test_stft.py
|
1051
|
+
"""
|
1052
|
+
window = np.sin(np.arange(.5, w_size + .5) / w_size * np.pi)
|
1053
|
+
SFT = ShortTimeFFT(window, t_step, fs=1000, fft_mode='onesided2X',
|
1054
|
+
scale_to='psd')
|
1055
|
+
atol = 2*np.finfo(window.dtype).resolution
|
1056
|
+
N_x = max(N_x, w_size) # minimal sing
|
1057
|
+
# Test with low frequency signal
|
1058
|
+
t = np.arange(N_x).astype(np.float64)
|
1059
|
+
x = np.sin(2 * np.pi * f_c * t * SFT.T)
|
1060
|
+
x = np.array([x, x + 1.])
|
1061
|
+
X = SFT.stft(x)
|
1062
|
+
xp = SFT.istft(X, k1=N_x)
|
1063
|
+
|
1064
|
+
max_freq = SFT.f[np.argmax(np.sum(np.abs(X[0]) ** 2, axis=1))]
|
1065
|
+
|
1066
|
+
assert X.shape[1] == SFT.f_pts
|
1067
|
+
assert np.all(SFT.f >= 0.)
|
1068
|
+
assert np.abs(max_freq - f_c) < 1.
|
1069
|
+
xp_assert_close(x, xp, atol=atol)
|
1070
|
+
|
1071
|
+
# check L2-norm squared (i.e., energy) conservation:
|
1072
|
+
E_x = np.sum(x**2, axis=-1) * SFT.T # numerical integration
|
1073
|
+
aX2 = X.real**2 + X.imag.real**2
|
1074
|
+
E_X = np.sum(np.sum(aX2, axis=-1) * SFT.delta_t, axis=-1) * SFT.delta_f
|
1075
|
+
xp_assert_close(E_X, E_x, atol=atol)
|
1076
|
+
|
1077
|
+
# Test with random signal
|
1078
|
+
np.random.seed(2392795)
|
1079
|
+
x = np.random.randn(2, N_x)
|
1080
|
+
X = SFT.stft(x)
|
1081
|
+
xp = SFT.istft(X, k1=N_x)
|
1082
|
+
|
1083
|
+
assert X.shape[1] == SFT.f_pts
|
1084
|
+
assert np.all(SFT.f >= 0.)
|
1085
|
+
assert np.abs(max_freq - f_c) < 1.
|
1086
|
+
xp_assert_close(x, xp, atol=atol)
|
1087
|
+
|
1088
|
+
# check L2-norm squared (i.e., energy) conservation:
|
1089
|
+
E_x = np.sum(x**2, axis=-1) * SFT.T # numeric integration
|
1090
|
+
aX2 = X.real ** 2 + X.imag.real ** 2
|
1091
|
+
E_X = np.sum(np.sum(aX2, axis=-1) * SFT.delta_t, axis=-1) * SFT.delta_f
|
1092
|
+
xp_assert_close(E_X, E_x, atol=atol)
|
1093
|
+
|
1094
|
+
# Try with empty array
|
1095
|
+
x = np.zeros((0, N_x))
|
1096
|
+
X = SFT.stft(x)
|
1097
|
+
xp = SFT.istft(X, k1=N_x)
|
1098
|
+
assert xp.shape == x.shape
|