scipy 1.16.2__cp314-cp314t-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scipy/__config__.py +161 -0
- scipy/__init__.py +150 -0
- scipy/_cyutility.cp314t-win_arm64.lib +0 -0
- scipy/_cyutility.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/_lib/_ccallback_c.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/_lib/_fpumode.cp314t-win_arm64.pyd +0 -0
- scipy/_lib/_gcutils.py +105 -0
- scipy/_lib/_pep440.py +487 -0
- scipy/_lib/_sparse.py +41 -0
- scipy/_lib/_test_ccallback.cp314t-win_arm64.lib +0 -0
- scipy/_lib/_test_ccallback.cp314t-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_call.cp314t-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_call.cp314t-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_def.cp314t-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_def.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/_lib/_uarray/_uarray.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/_lib/messagestream.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/cluster/_hierarchy.cp314t-win_arm64.pyd +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp314t-win_arm64.lib +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp314t-win_arm64.pyd +0 -0
- scipy/cluster/_vq.cp314t-win_arm64.lib +0 -0
- scipy/cluster/_vq.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/fft/_pocketfft/pypocketfft.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/fftpack/convolve.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/integrate/_dop.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/integrate/_lsoda.cp314t-win_arm64.pyd +0 -0
- scipy/integrate/_ode.py +1395 -0
- scipy/integrate/_odepack.cp314t-win_arm64.lib +0 -0
- scipy/integrate/_odepack.cp314t-win_arm64.pyd +0 -0
- scipy/integrate/_odepack_py.py +273 -0
- scipy/integrate/_quad_vec.py +674 -0
- scipy/integrate/_quadpack.cp314t-win_arm64.lib +0 -0
- scipy/integrate/_quadpack.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/integrate/_test_multivariate.cp314t-win_arm64.pyd +0 -0
- scipy/integrate/_test_odeint_banded.cp314t-win_arm64.lib +0 -0
- scipy/integrate/_test_odeint_banded.cp314t-win_arm64.pyd +0 -0
- scipy/integrate/_vode.cp314t-win_arm64.lib +0 -0
- scipy/integrate/_vode.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/interpolate/_dfitpack.cp314t-win_arm64.pyd +0 -0
- scipy/interpolate/_dierckx.cp314t-win_arm64.lib +0 -0
- scipy/interpolate/_dierckx.cp314t-win_arm64.pyd +0 -0
- scipy/interpolate/_fitpack.cp314t-win_arm64.lib +0 -0
- scipy/interpolate/_fitpack.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/interpolate/_interpnd.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/interpolate/_ppoly.cp314t-win_arm64.pyd +0 -0
- scipy/interpolate/_rbf.py +290 -0
- scipy/interpolate/_rbfinterp.py +550 -0
- scipy/interpolate/_rbfinterp_pythran.cp314t-win_arm64.lib +0 -0
- scipy/interpolate/_rbfinterp_pythran.cp314t-win_arm64.pyd +0 -0
- scipy/interpolate/_rgi.py +764 -0
- scipy/interpolate/_rgi_cython.cp314t-win_arm64.lib +0 -0
- scipy/interpolate/_rgi_cython.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/io/_fast_matrix_market/_fmm_core.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/io/_test_fortran.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/io/matlab/_mio5_utils.cp314t-win_arm64.pyd +0 -0
- scipy/io/matlab/_mio_utils.cp314t-win_arm64.lib +0 -0
- scipy/io/matlab/_mio_utils.cp314t-win_arm64.pyd +0 -0
- scipy/io/matlab/_miobase.py +435 -0
- scipy/io/matlab/_streams.cp314t-win_arm64.lib +0 -0
- scipy/io/matlab/_streams.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_cythonized_array_utils.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_decomp_interpolative.cp314t-win_arm64.pyd +0 -0
- scipy/linalg/_decomp_ldl.py +356 -0
- scipy/linalg/_decomp_lu.py +401 -0
- scipy/linalg/_decomp_lu_cython.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_decomp_lu_cython.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_decomp_update.cp314t-win_arm64.pyd +0 -0
- scipy/linalg/_expm_frechet.py +417 -0
- scipy/linalg/_fblas.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_fblas.cp314t-win_arm64.pyd +0 -0
- scipy/linalg/_flapack.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_flapack.cp314t-win_arm64.pyd +0 -0
- scipy/linalg/_lapack_subroutines.h +1521 -0
- scipy/linalg/_linalg_pythran.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_linalg_pythran.cp314t-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs.py +1050 -0
- scipy/linalg/_matfuncs_expm.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_expm.cp314t-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs_expm.pyi +6 -0
- scipy/linalg/_matfuncs_inv_ssq.py +886 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cp314t-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs_sqrtm.py +107 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp314t-win_arm64.pyd +0 -0
- scipy/linalg/_misc.py +191 -0
- scipy/linalg/_procrustes.py +113 -0
- scipy/linalg/_sketches.py +189 -0
- scipy/linalg/_solve_toeplitz.cp314t-win_arm64.lib +0 -0
- scipy/linalg/_solve_toeplitz.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/linalg/cython_blas.cp314t-win_arm64.pyd +0 -0
- scipy/linalg/cython_blas.pxd +169 -0
- scipy/linalg/cython_blas.pyx +1432 -0
- scipy/linalg/cython_lapack.cp314t-win_arm64.lib +0 -0
- scipy/linalg/cython_lapack.cp314t-win_arm64.pyd +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 +3620 -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.cp314t-win_arm64.lib +0 -0
- scipy/ndimage/_ctest.cp314t-win_arm64.pyd +0 -0
- scipy/ndimage/_cytest.cp314t-win_arm64.lib +0 -0
- scipy/ndimage/_cytest.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/ndimage/_nd_image.cp314t-win_arm64.pyd +0 -0
- scipy/ndimage/_ndimage_api.py +16 -0
- scipy/ndimage/_ni_docstrings.py +214 -0
- scipy/ndimage/_ni_label.cp314t-win_arm64.lib +0 -0
- scipy/ndimage/_ni_label.cp314t-win_arm64.pyd +0 -0
- scipy/ndimage/_ni_support.py +139 -0
- scipy/ndimage/_rank_filter_1d.cp314t-win_arm64.lib +0 -0
- scipy/ndimage/_rank_filter_1d.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/odr/__odrpack.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_bglu_dense.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_direct.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_group_columns.cp314t-win_arm64.pyd +0 -0
- scipy/optimize/_hessian_update_strategy.py +479 -0
- scipy/optimize/_highspy/__init__.py +0 -0
- scipy/optimize/_highspy/_core.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_core.cp314t-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_options.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_highs_options.cp314t-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_wrapper.py +338 -0
- scipy/optimize/_isotonic.py +157 -0
- scipy/optimize/_lbfgsb.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_lbfgsb.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_lsap.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_lsq/givens_elimination.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_minpack.cp314t-win_arm64.pyd +0 -0
- scipy/optimize/_minpack_py.py +1178 -0
- scipy/optimize/_moduleTNC.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_moduleTNC.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_pava_pybind.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_slsqplib.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_trlib/_trlib.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/_zeros.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/optimize/cython_optimize/_zeros.cp314t-win_arm64.pyd +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 +3344 -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.cp314t-win_arm64.lib +0 -0
- scipy/signal/_max_len_seq_inner.cp314t-win_arm64.pyd +0 -0
- scipy/signal/_peak_finding.py +1310 -0
- scipy/signal/_peak_finding_utils.cp314t-win_arm64.lib +0 -0
- scipy/signal/_peak_finding_utils.cp314t-win_arm64.pyd +0 -0
- scipy/signal/_polyutils.py +172 -0
- scipy/signal/_savitzky_golay.py +357 -0
- scipy/signal/_short_time_fft.py +2228 -0
- scipy/signal/_signal_api.py +30 -0
- scipy/signal/_signaltools.py +5309 -0
- scipy/signal/_sigtools.cp314t-win_arm64.lib +0 -0
- scipy/signal/_sigtools.cp314t-win_arm64.pyd +0 -0
- scipy/signal/_sosfilt.cp314t-win_arm64.lib +0 -0
- scipy/signal/_sosfilt.cp314t-win_arm64.pyd +0 -0
- scipy/signal/_spectral_py.py +2471 -0
- scipy/signal/_spline.cp314t-win_arm64.lib +0 -0
- scipy/signal/_spline.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/signal/_upfirdn_apply.cp314t-win_arm64.pyd +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 +1107 -0
- scipy/signal/tests/test_signaltools.py +4735 -0
- scipy/signal/tests/test_spectral.py +2141 -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.cp314t-win_arm64.lib +0 -0
- scipy/sparse/_csparsetools.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/sparse/_sparsetools.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_flow.cp314t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_laplacian.py +563 -0
- scipy/sparse/csgraph/_matching.cp314t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_matching.cp314t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp314t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp314t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_reordering.cp314t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_reordering.cp314t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_shortest_path.cp314t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_shortest_path.cp314t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_tools.cp314t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_tools.cp314t-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_traversal.cp314t-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_traversal.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_dsolve/_superlu.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_cpropack.cp314t-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp314t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp314t-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp314t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp314t-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp314t-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/spatial/_ckdtree.cp314t-win_arm64.pyd +0 -0
- scipy/spatial/_distance_pybind.cp314t-win_arm64.lib +0 -0
- scipy/spatial/_distance_pybind.cp314t-win_arm64.pyd +0 -0
- scipy/spatial/_distance_wrap.cp314t-win_arm64.lib +0 -0
- scipy/spatial/_distance_wrap.cp314t-win_arm64.pyd +0 -0
- scipy/spatial/_geometric_slerp.py +238 -0
- scipy/spatial/_hausdorff.cp314t-win_arm64.lib +0 -0
- scipy/spatial/_hausdorff.cp314t-win_arm64.pyd +0 -0
- scipy/spatial/_kdtree.py +920 -0
- scipy/spatial/_plotutils.py +274 -0
- scipy/spatial/_procrustes.py +132 -0
- scipy/spatial/_qhull.cp314t-win_arm64.lib +0 -0
- scipy/spatial/_qhull.cp314t-win_arm64.pyd +0 -0
- scipy/spatial/_qhull.pyi +213 -0
- scipy/spatial/_spherical_voronoi.py +341 -0
- scipy/spatial/_voronoi.cp314t-win_arm64.lib +0 -0
- scipy/spatial/_voronoi.cp314t-win_arm64.pyd +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/qhull_src/COPYING_QHULL.txt +39 -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 +2389 -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.cp314t-win_arm64.lib +0 -0
- scipy/spatial/transform/_rigid_transform.cp314t-win_arm64.pyd +0 -0
- scipy/spatial/transform/_rotation.cp314t-win_arm64.lib +0 -0
- scipy/spatial/transform/_rotation.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/special/_comb.cp314t-win_arm64.pyd +0 -0
- scipy/special/_ellip_harm.py +214 -0
- scipy/special/_ellip_harm_2.cp314t-win_arm64.lib +0 -0
- scipy/special/_ellip_harm_2.cp314t-win_arm64.pyd +0 -0
- scipy/special/_gufuncs.cp314t-win_arm64.lib +0 -0
- scipy/special/_gufuncs.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/special/_specfun.cp314t-win_arm64.pyd +0 -0
- scipy/special/_special_ufuncs.cp314t-win_arm64.lib +0 -0
- scipy/special/_special_ufuncs.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/special/_test_internal.cp314t-win_arm64.pyd +0 -0
- scipy/special/_test_internal.pyi +9 -0
- scipy/special/_testutils.py +321 -0
- scipy/special/_ufuncs.cp314t-win_arm64.lib +0 -0
- scipy/special/_ufuncs.cp314t-win_arm64.pyd +0 -0
- scipy/special/_ufuncs.pyi +522 -0
- scipy/special/_ufuncs.pyx +13173 -0
- scipy/special/_ufuncs_cxx.cp314t-win_arm64.lib +0 -0
- scipy/special/_ufuncs_cxx.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/special/cython_special.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/stats/_ansari_swilk_statistics.cp314t-win_arm64.pyd +0 -0
- scipy/stats/_axis_nan_policy.py +692 -0
- scipy/stats/_biasedurn.cp314t-win_arm64.lib +0 -0
- scipy/stats/_biasedurn.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/stats/_levy_stable/levyst.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/stats/_qmc_cy.cp314t-win_arm64.pyd +0 -0
- scipy/stats/_qmc_cy.pyi +54 -0
- scipy/stats/_qmvnt.py +454 -0
- scipy/stats/_qmvnt_cy.cp314t-win_arm64.lib +0 -0
- scipy/stats/_qmvnt_cy.cp314t-win_arm64.pyd +0 -0
- scipy/stats/_quantile.py +335 -0
- scipy/stats/_rcont/__init__.py +4 -0
- scipy/stats/_rcont/rcont.cp314t-win_arm64.lib +0 -0
- scipy/stats/_rcont/rcont.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/stats/_sobol.cp314t-win_arm64.pyd +0 -0
- scipy/stats/_sobol.pyi +54 -0
- scipy/stats/_sobol_direction_numbers.npz +0 -0
- scipy/stats/_stats.cp314t-win_arm64.lib +0 -0
- scipy/stats/_stats.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/stats/_stats_pythran.cp314t-win_arm64.pyd +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.cp314t-win_arm64.lib +0 -0
- scipy/stats/_unuran/unuran_wrapper.cp314t-win_arm64.pyd +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.2.dist-info/DELVEWHEEL +2 -0
- scipy-1.16.2.dist-info/LICENSE.txt +912 -0
- scipy-1.16.2.dist-info/METADATA +1061 -0
- scipy-1.16.2.dist-info/RECORD +1530 -0
- scipy-1.16.2.dist-info/WHEEL +4 -0
- scipy.libs/msvcp140-5f1c5dd31916990d94181e07bc3afb32.dll +0 -0
- scipy.libs/scipy_openblas-f3ac85b1f412f7e86514c923dc4058d1.dll +0 -0
@@ -0,0 +1,1431 @@
|
|
1
|
+
# Created by Pearu Peterson, June 2003
|
2
|
+
import itertools
|
3
|
+
import sys
|
4
|
+
import numpy as np
|
5
|
+
from numpy.testing import suppress_warnings
|
6
|
+
import pytest
|
7
|
+
from pytest import raises as assert_raises
|
8
|
+
from scipy._lib._array_api import (
|
9
|
+
xp_assert_equal, xp_assert_close, assert_almost_equal, assert_array_almost_equal
|
10
|
+
)
|
11
|
+
|
12
|
+
from numpy import array, diff, linspace, meshgrid, ones, pi, shape
|
13
|
+
from scipy.interpolate._fitpack_py import bisplrep, bisplev, splrep, spalde
|
14
|
+
from scipy.interpolate._fitpack2 import (UnivariateSpline,
|
15
|
+
LSQUnivariateSpline, InterpolatedUnivariateSpline,
|
16
|
+
LSQBivariateSpline, SmoothBivariateSpline, RectBivariateSpline,
|
17
|
+
LSQSphereBivariateSpline, SmoothSphereBivariateSpline,
|
18
|
+
RectSphereBivariateSpline)
|
19
|
+
|
20
|
+
from scipy._lib._testutils import _run_concurrent_barrier
|
21
|
+
|
22
|
+
from scipy.interpolate import make_splrep
|
23
|
+
|
24
|
+
class TestUnivariateSpline:
|
25
|
+
def test_linear_constant(self):
|
26
|
+
x = [1,2,3]
|
27
|
+
y = [3,3,3]
|
28
|
+
lut = UnivariateSpline(x,y,k=1)
|
29
|
+
assert_array_almost_equal(lut.get_knots(), [1, 3])
|
30
|
+
assert_array_almost_equal(lut.get_coeffs(), [3, 3])
|
31
|
+
assert abs(lut.get_residual()) < 1e-10
|
32
|
+
assert_array_almost_equal(lut([1, 1.5, 2]), [3, 3, 3])
|
33
|
+
|
34
|
+
spl = make_splrep(x, y, k=1, s=len(x))
|
35
|
+
xp_assert_close(spl.t[1:-1], lut.get_knots(), atol=1e-15)
|
36
|
+
xp_assert_close(spl.c, lut.get_coeffs(), atol=1e-15)
|
37
|
+
|
38
|
+
def test_preserve_shape(self):
|
39
|
+
x = [1, 2, 3]
|
40
|
+
y = [0, 2, 4]
|
41
|
+
lut = UnivariateSpline(x, y, k=1)
|
42
|
+
arg = 2
|
43
|
+
assert shape(arg) == shape(lut(arg))
|
44
|
+
assert shape(arg) == shape(lut(arg, nu=1))
|
45
|
+
arg = [1.5, 2, 2.5]
|
46
|
+
assert shape(arg) == shape(lut(arg))
|
47
|
+
assert shape(arg) == shape(lut(arg, nu=1))
|
48
|
+
|
49
|
+
def test_linear_1d(self):
|
50
|
+
x = [1,2,3]
|
51
|
+
y = [0,2,4]
|
52
|
+
lut = UnivariateSpline(x,y,k=1)
|
53
|
+
assert_array_almost_equal(lut.get_knots(),[1,3])
|
54
|
+
assert_array_almost_equal(lut.get_coeffs(),[0,4])
|
55
|
+
assert abs(lut.get_residual()) < 1e-15
|
56
|
+
assert_array_almost_equal(lut([1,1.5,2]),[0,1,2])
|
57
|
+
|
58
|
+
def test_subclassing(self):
|
59
|
+
# See #731
|
60
|
+
|
61
|
+
class ZeroSpline(UnivariateSpline):
|
62
|
+
def __call__(self, x):
|
63
|
+
return 0*array(x)
|
64
|
+
|
65
|
+
sp = ZeroSpline([1,2,3,4,5], [3,2,3,2,3], k=2)
|
66
|
+
xp_assert_equal(sp([1.5, 2.5]), [0., 0.])
|
67
|
+
|
68
|
+
def test_empty_input(self):
|
69
|
+
# Test whether empty input returns an empty output. Ticket 1014
|
70
|
+
x = [1,3,5,7,9]
|
71
|
+
y = [0,4,9,12,21]
|
72
|
+
spl = UnivariateSpline(x, y, k=3)
|
73
|
+
xp_assert_equal(spl([]), array([]))
|
74
|
+
|
75
|
+
def test_roots(self):
|
76
|
+
x = [1, 3, 5, 7, 9]
|
77
|
+
y = [0, 4, 9, 12, 21]
|
78
|
+
spl = UnivariateSpline(x, y, k=3)
|
79
|
+
assert_almost_equal(spl.roots()[0], 1.050290639101332)
|
80
|
+
|
81
|
+
def test_roots_length(self): # for gh18335
|
82
|
+
x = np.linspace(0, 50 * np.pi, 1000)
|
83
|
+
y = np.cos(x)
|
84
|
+
spl = UnivariateSpline(x, y, s=0)
|
85
|
+
assert len(spl.roots()) == 50
|
86
|
+
|
87
|
+
def test_derivatives(self):
|
88
|
+
x = [1, 3, 5, 7, 9]
|
89
|
+
y = [0, 4, 9, 12, 21]
|
90
|
+
spl = UnivariateSpline(x, y, k=3)
|
91
|
+
assert_almost_equal(spl.derivatives(3.5),
|
92
|
+
[5.5152902, 1.7146577, -0.1830357, 0.3125])
|
93
|
+
|
94
|
+
def test_derivatives_2(self):
|
95
|
+
x = np.arange(8)
|
96
|
+
y = x**3 + 2.*x**2
|
97
|
+
|
98
|
+
tck = splrep(x, y, s=0)
|
99
|
+
ders = spalde(3, tck)
|
100
|
+
xp_assert_close(ders, [45., # 3**3 + 2*(3)**2
|
101
|
+
39., # 3*(3)**2 + 4*(3)
|
102
|
+
22., # 6*(3) + 4
|
103
|
+
6.], # 6*3**0
|
104
|
+
atol=1e-15)
|
105
|
+
spl = UnivariateSpline(x, y, s=0, k=3)
|
106
|
+
xp_assert_close(spl.derivatives(3),
|
107
|
+
ders,
|
108
|
+
atol=1e-15)
|
109
|
+
|
110
|
+
def test_resize_regression(self):
|
111
|
+
"""Regression test for #1375."""
|
112
|
+
x = [-1., -0.65016502, -0.58856235, -0.26903553, -0.17370892,
|
113
|
+
-0.10011001, 0., 0.10011001, 0.17370892, 0.26903553, 0.58856235,
|
114
|
+
0.65016502, 1.]
|
115
|
+
y = [1.,0.62928599, 0.5797223, 0.39965815, 0.36322694, 0.3508061,
|
116
|
+
0.35214793, 0.3508061, 0.36322694, 0.39965815, 0.5797223,
|
117
|
+
0.62928599, 1.]
|
118
|
+
w = [1.00000000e+12, 6.88875973e+02, 4.89314737e+02, 4.26864807e+02,
|
119
|
+
6.07746770e+02, 4.51341444e+02, 3.17480210e+02, 4.51341444e+02,
|
120
|
+
6.07746770e+02, 4.26864807e+02, 4.89314737e+02, 6.88875973e+02,
|
121
|
+
1.00000000e+12]
|
122
|
+
spl = UnivariateSpline(x=x, y=y, w=w, s=None)
|
123
|
+
desired = array([0.35100374, 0.51715855, 0.87789547, 0.98719344])
|
124
|
+
xp_assert_close(spl([0.1, 0.5, 0.9, 0.99]), desired, atol=5e-4)
|
125
|
+
|
126
|
+
def test_out_of_range_regression(self):
|
127
|
+
# Test different extrapolation modes. See ticket 3557
|
128
|
+
x = np.arange(5, dtype=float)
|
129
|
+
y = x**3
|
130
|
+
|
131
|
+
xp = linspace(-8, 13, 100)
|
132
|
+
xp_zeros = xp.copy()
|
133
|
+
xp_zeros[np.logical_or(xp_zeros < 0., xp_zeros > 4.)] = 0
|
134
|
+
xp_clip = xp.copy()
|
135
|
+
xp_clip[xp_clip < x[0]] = x[0]
|
136
|
+
xp_clip[xp_clip > x[-1]] = x[-1]
|
137
|
+
|
138
|
+
for cls in [UnivariateSpline, InterpolatedUnivariateSpline]:
|
139
|
+
spl = cls(x=x, y=y)
|
140
|
+
for ext in [0, 'extrapolate']:
|
141
|
+
xp_assert_close(spl(xp, ext=ext), xp**3, atol=1e-16)
|
142
|
+
xp_assert_close(cls(x, y, ext=ext)(xp), xp**3, atol=1e-16)
|
143
|
+
for ext in [1, 'zeros']:
|
144
|
+
xp_assert_close(spl(xp, ext=ext), xp_zeros**3, atol=1e-16)
|
145
|
+
xp_assert_close(cls(x, y, ext=ext)(xp), xp_zeros**3, atol=1e-16)
|
146
|
+
for ext in [2, 'raise']:
|
147
|
+
assert_raises(ValueError, spl, xp, **dict(ext=ext))
|
148
|
+
for ext in [3, 'const']:
|
149
|
+
xp_assert_close(spl(xp, ext=ext), xp_clip**3, atol=2e-16)
|
150
|
+
xp_assert_close(cls(x, y, ext=ext)(xp), xp_clip**3, atol=2e-16)
|
151
|
+
|
152
|
+
# also test LSQUnivariateSpline [which needs explicit knots]
|
153
|
+
t = spl.get_knots()[3:4] # interior knots w/ default k=3
|
154
|
+
spl = LSQUnivariateSpline(x, y, t)
|
155
|
+
xp_assert_close(spl(xp, ext=0), xp**3, atol=1e-16)
|
156
|
+
xp_assert_close(spl(xp, ext=1), xp_zeros**3, atol=1e-16)
|
157
|
+
assert_raises(ValueError, spl, xp, **dict(ext=2))
|
158
|
+
xp_assert_close(spl(xp, ext=3), xp_clip**3, atol=1e-16)
|
159
|
+
|
160
|
+
# also make sure that unknown values for `ext` are caught early
|
161
|
+
for ext in [-1, 'unknown']:
|
162
|
+
spl = UnivariateSpline(x, y)
|
163
|
+
assert_raises(ValueError, spl, xp, **dict(ext=ext))
|
164
|
+
assert_raises(ValueError, UnivariateSpline,
|
165
|
+
**dict(x=x, y=y, ext=ext))
|
166
|
+
|
167
|
+
def test_lsq_fpchec(self):
|
168
|
+
xs = np.arange(100) * 1.
|
169
|
+
ys = np.arange(100) * 1.
|
170
|
+
knots = np.linspace(0, 99, 10)
|
171
|
+
bbox = (-1, 101)
|
172
|
+
assert_raises(ValueError, LSQUnivariateSpline, xs, ys, knots,
|
173
|
+
bbox=bbox)
|
174
|
+
|
175
|
+
def test_derivative_and_antiderivative(self):
|
176
|
+
# Thin wrappers to splder/splantider, so light smoke test only.
|
177
|
+
x = np.linspace(0, 1, 70)**3
|
178
|
+
y = np.cos(x)
|
179
|
+
|
180
|
+
spl = UnivariateSpline(x, y, s=0)
|
181
|
+
spl2 = spl.antiderivative(2).derivative(2)
|
182
|
+
xp_assert_close(spl(0.3), spl2(0.3))
|
183
|
+
|
184
|
+
spl2 = spl.antiderivative(1)
|
185
|
+
xp_assert_close(spl2(0.6) - spl2(0.2),
|
186
|
+
spl.integral(0.2, 0.6))
|
187
|
+
|
188
|
+
def test_derivative_extrapolation(self):
|
189
|
+
# Regression test for gh-10195: for a const-extrapolation spline
|
190
|
+
# its derivative evaluates to zero for extrapolation
|
191
|
+
x_values = [1, 2, 4, 6, 8.5]
|
192
|
+
y_values = [0.5, 0.8, 1.3, 2.5, 5]
|
193
|
+
f = UnivariateSpline(x_values, y_values, ext='const', k=3)
|
194
|
+
|
195
|
+
x = [-1, 0, -0.5, 9, 9.5, 10]
|
196
|
+
xp_assert_close(f.derivative()(x), np.zeros_like(x), atol=1e-15)
|
197
|
+
|
198
|
+
def test_integral_out_of_bounds(self):
|
199
|
+
# Regression test for gh-7906: .integral(a, b) is wrong if both
|
200
|
+
# a and b are out-of-bounds
|
201
|
+
x = np.linspace(0., 1., 7)
|
202
|
+
for ext in range(4):
|
203
|
+
f = UnivariateSpline(x, x, s=0, ext=ext)
|
204
|
+
for (a, b) in [(1, 1), (1, 5), (2, 5),
|
205
|
+
(0, 0), (-2, 0), (-2, -1)]:
|
206
|
+
assert abs(f.integral(a, b)) < 1e-15
|
207
|
+
|
208
|
+
def test_nan(self):
|
209
|
+
# bail out early if the input data contains nans
|
210
|
+
x = np.arange(10, dtype=float)
|
211
|
+
y = x**3
|
212
|
+
w = np.ones_like(x)
|
213
|
+
# also test LSQUnivariateSpline [which needs explicit knots]
|
214
|
+
spl = UnivariateSpline(x, y, check_finite=True)
|
215
|
+
t = spl.get_knots()[3:4] # interior knots w/ default k=3
|
216
|
+
y_end = y[-1]
|
217
|
+
for z in [np.nan, np.inf, -np.inf]:
|
218
|
+
y[-1] = z
|
219
|
+
assert_raises(ValueError, UnivariateSpline,
|
220
|
+
**dict(x=x, y=y, check_finite=True))
|
221
|
+
assert_raises(ValueError, InterpolatedUnivariateSpline,
|
222
|
+
**dict(x=x, y=y, check_finite=True))
|
223
|
+
assert_raises(ValueError, LSQUnivariateSpline,
|
224
|
+
**dict(x=x, y=y, t=t, check_finite=True))
|
225
|
+
y[-1] = y_end # check valid y but invalid w
|
226
|
+
w[-1] = z
|
227
|
+
assert_raises(ValueError, UnivariateSpline,
|
228
|
+
**dict(x=x, y=y, w=w, check_finite=True))
|
229
|
+
assert_raises(ValueError, InterpolatedUnivariateSpline,
|
230
|
+
**dict(x=x, y=y, w=w, check_finite=True))
|
231
|
+
assert_raises(ValueError, LSQUnivariateSpline,
|
232
|
+
**dict(x=x, y=y, t=t, w=w, check_finite=True))
|
233
|
+
|
234
|
+
def test_strictly_increasing_x(self):
|
235
|
+
# Test the x is required to be strictly increasing for
|
236
|
+
# UnivariateSpline if s=0 and for InterpolatedUnivariateSpline,
|
237
|
+
# but merely increasing for UnivariateSpline if s>0
|
238
|
+
# and for LSQUnivariateSpline; see gh-8535
|
239
|
+
xx = np.arange(10, dtype=float)
|
240
|
+
yy = xx**3
|
241
|
+
x = np.arange(10, dtype=float)
|
242
|
+
x[1] = x[0]
|
243
|
+
y = x**3
|
244
|
+
w = np.ones_like(x)
|
245
|
+
# also test LSQUnivariateSpline [which needs explicit knots]
|
246
|
+
spl = UnivariateSpline(xx, yy, check_finite=True)
|
247
|
+
t = spl.get_knots()[3:4] # interior knots w/ default k=3
|
248
|
+
UnivariateSpline(x=x, y=y, w=w, s=1, check_finite=True)
|
249
|
+
LSQUnivariateSpline(x=x, y=y, t=t, w=w, check_finite=True)
|
250
|
+
assert_raises(ValueError, UnivariateSpline,
|
251
|
+
**dict(x=x, y=y, s=0, check_finite=True))
|
252
|
+
assert_raises(ValueError, InterpolatedUnivariateSpline,
|
253
|
+
**dict(x=x, y=y, check_finite=True))
|
254
|
+
|
255
|
+
def test_increasing_x(self):
|
256
|
+
# Test that x is required to be increasing, see gh-8535
|
257
|
+
xx = np.arange(10, dtype=float)
|
258
|
+
yy = xx**3
|
259
|
+
x = np.arange(10, dtype=float)
|
260
|
+
x[1] = x[0] - 1.0
|
261
|
+
y = x**3
|
262
|
+
w = np.ones_like(x)
|
263
|
+
# also test LSQUnivariateSpline [which needs explicit knots]
|
264
|
+
spl = UnivariateSpline(xx, yy, check_finite=True)
|
265
|
+
t = spl.get_knots()[3:4] # interior knots w/ default k=3
|
266
|
+
assert_raises(ValueError, UnivariateSpline,
|
267
|
+
**dict(x=x, y=y, check_finite=True))
|
268
|
+
assert_raises(ValueError, InterpolatedUnivariateSpline,
|
269
|
+
**dict(x=x, y=y, check_finite=True))
|
270
|
+
assert_raises(ValueError, LSQUnivariateSpline,
|
271
|
+
**dict(x=x, y=y, t=t, w=w, check_finite=True))
|
272
|
+
|
273
|
+
def test_invalid_input_for_univariate_spline(self):
|
274
|
+
|
275
|
+
with assert_raises(ValueError) as info:
|
276
|
+
x_values = [1, 2, 4, 6, 8.5]
|
277
|
+
y_values = [0.5, 0.8, 1.3, 2.5]
|
278
|
+
UnivariateSpline(x_values, y_values)
|
279
|
+
assert "x and y should have a same length" in str(info.value)
|
280
|
+
|
281
|
+
with assert_raises(ValueError) as info:
|
282
|
+
x_values = [1, 2, 4, 6, 8.5]
|
283
|
+
y_values = [0.5, 0.8, 1.3, 2.5, 2.8]
|
284
|
+
w_values = [-1.0, 1.0, 1.0, 1.0]
|
285
|
+
UnivariateSpline(x_values, y_values, w=w_values)
|
286
|
+
assert "x, y, and w should have a same length" in str(info.value)
|
287
|
+
|
288
|
+
with assert_raises(ValueError) as info:
|
289
|
+
bbox = (-1)
|
290
|
+
UnivariateSpline(x_values, y_values, bbox=bbox)
|
291
|
+
assert "bbox shape should be (2,)" in str(info.value)
|
292
|
+
|
293
|
+
with assert_raises(ValueError) as info:
|
294
|
+
UnivariateSpline(x_values, y_values, k=6)
|
295
|
+
assert "k should be 1 <= k <= 5" in str(info.value)
|
296
|
+
|
297
|
+
with assert_raises(ValueError) as info:
|
298
|
+
UnivariateSpline(x_values, y_values, s=-1.0)
|
299
|
+
assert "s should be s >= 0.0" in str(info.value)
|
300
|
+
|
301
|
+
def test_invalid_input_for_interpolated_univariate_spline(self):
|
302
|
+
|
303
|
+
with assert_raises(ValueError) as info:
|
304
|
+
x_values = [1, 2, 4, 6, 8.5]
|
305
|
+
y_values = [0.5, 0.8, 1.3, 2.5]
|
306
|
+
InterpolatedUnivariateSpline(x_values, y_values)
|
307
|
+
assert "x and y should have a same length" in str(info.value)
|
308
|
+
|
309
|
+
with assert_raises(ValueError) as info:
|
310
|
+
x_values = [1, 2, 4, 6, 8.5]
|
311
|
+
y_values = [0.5, 0.8, 1.3, 2.5, 2.8]
|
312
|
+
w_values = [-1.0, 1.0, 1.0, 1.0]
|
313
|
+
InterpolatedUnivariateSpline(x_values, y_values, w=w_values)
|
314
|
+
assert "x, y, and w should have a same length" in str(info.value)
|
315
|
+
|
316
|
+
with assert_raises(ValueError) as info:
|
317
|
+
bbox = (-1)
|
318
|
+
InterpolatedUnivariateSpline(x_values, y_values, bbox=bbox)
|
319
|
+
assert "bbox shape should be (2,)" in str(info.value)
|
320
|
+
|
321
|
+
with assert_raises(ValueError) as info:
|
322
|
+
InterpolatedUnivariateSpline(x_values, y_values, k=6)
|
323
|
+
assert "k should be 1 <= k <= 5" in str(info.value)
|
324
|
+
|
325
|
+
def test_invalid_input_for_lsq_univariate_spline(self):
|
326
|
+
|
327
|
+
x_values = [1, 2, 4, 6, 8.5]
|
328
|
+
y_values = [0.5, 0.8, 1.3, 2.5, 2.8]
|
329
|
+
spl = UnivariateSpline(x_values, y_values, check_finite=True)
|
330
|
+
t_values = spl.get_knots()[3:4] # interior knots w/ default k=3
|
331
|
+
|
332
|
+
with assert_raises(ValueError) as info:
|
333
|
+
x_values = [1, 2, 4, 6, 8.5]
|
334
|
+
y_values = [0.5, 0.8, 1.3, 2.5]
|
335
|
+
LSQUnivariateSpline(x_values, y_values, t_values)
|
336
|
+
assert "x and y should have a same length" in str(info.value)
|
337
|
+
|
338
|
+
with assert_raises(ValueError) as info:
|
339
|
+
x_values = [1, 2, 4, 6, 8.5]
|
340
|
+
y_values = [0.5, 0.8, 1.3, 2.5, 2.8]
|
341
|
+
w_values = [1.0, 1.0, 1.0, 1.0]
|
342
|
+
LSQUnivariateSpline(x_values, y_values, t_values, w=w_values)
|
343
|
+
assert "x, y, and w should have a same length" in str(info.value)
|
344
|
+
|
345
|
+
message = "Interior knots t must satisfy Schoenberg-Whitney conditions"
|
346
|
+
with assert_raises(ValueError, match=message) as info:
|
347
|
+
bbox = (100, -100)
|
348
|
+
LSQUnivariateSpline(x_values, y_values, t_values, bbox=bbox)
|
349
|
+
|
350
|
+
with assert_raises(ValueError) as info:
|
351
|
+
bbox = (-1)
|
352
|
+
LSQUnivariateSpline(x_values, y_values, t_values, bbox=bbox)
|
353
|
+
assert "bbox shape should be (2,)" in str(info.value)
|
354
|
+
|
355
|
+
with assert_raises(ValueError) as info:
|
356
|
+
LSQUnivariateSpline(x_values, y_values, t_values, k=6)
|
357
|
+
assert "k should be 1 <= k <= 5" in str(info.value)
|
358
|
+
|
359
|
+
def test_array_like_input(self):
|
360
|
+
x_values = np.array([1, 2, 4, 6, 8.5])
|
361
|
+
y_values = np.array([0.5, 0.8, 1.3, 2.5, 2.8])
|
362
|
+
w_values = np.array([1.0, 1.0, 1.0, 1.0, 1.0])
|
363
|
+
bbox = np.array([-100, 100])
|
364
|
+
# np.array input
|
365
|
+
spl1 = UnivariateSpline(x=x_values, y=y_values, w=w_values,
|
366
|
+
bbox=bbox)
|
367
|
+
# list input
|
368
|
+
spl2 = UnivariateSpline(x=x_values.tolist(), y=y_values.tolist(),
|
369
|
+
w=w_values.tolist(), bbox=bbox.tolist())
|
370
|
+
|
371
|
+
xp_assert_close(spl1([0.1, 0.5, 0.9, 0.99]),
|
372
|
+
spl2([0.1, 0.5, 0.9, 0.99]))
|
373
|
+
|
374
|
+
@pytest.mark.thread_unsafe
|
375
|
+
def test_fpknot_oob_crash(self):
|
376
|
+
# https://github.com/scipy/scipy/issues/3691
|
377
|
+
x = range(109)
|
378
|
+
y = [0., 0., 0., 0., 0., 10.9, 0., 11., 0.,
|
379
|
+
0., 0., 10.9, 0., 0., 0., 0., 0., 0.,
|
380
|
+
10.9, 0., 0., 0., 11., 0., 0., 0., 10.9,
|
381
|
+
0., 0., 0., 10.5, 0., 0., 0., 10.7, 0.,
|
382
|
+
0., 0., 11., 0., 0., 0., 0., 0., 0.,
|
383
|
+
10.9, 0., 0., 10.7, 0., 0., 0., 10.6, 0.,
|
384
|
+
0., 0., 10.5, 0., 0., 10.7, 0., 0., 10.5,
|
385
|
+
0., 0., 11.5, 0., 0., 0., 10.7, 0., 0.,
|
386
|
+
10.7, 0., 0., 10.9, 0., 0., 10.8, 0., 0.,
|
387
|
+
0., 10.7, 0., 0., 10.6, 0., 0., 0., 10.4,
|
388
|
+
0., 0., 10.6, 0., 0., 10.5, 0., 0., 0.,
|
389
|
+
10.7, 0., 0., 0., 10.4, 0., 0., 0., 10.8, 0.]
|
390
|
+
with suppress_warnings() as sup:
|
391
|
+
r = sup.record(
|
392
|
+
UserWarning,
|
393
|
+
r"""
|
394
|
+
The maximal number of iterations maxit \(set to 20 by the program\)
|
395
|
+
allowed for finding a smoothing spline with fp=s has been reached: s
|
396
|
+
too small.
|
397
|
+
There is an approximation returned but the corresponding weighted sum
|
398
|
+
of squared residuals does not satisfy the condition abs\(fp-s\)/s < tol.""")
|
399
|
+
UnivariateSpline(x, y, k=1)
|
400
|
+
assert len(r) == 1
|
401
|
+
|
402
|
+
def test_concurrency(self):
|
403
|
+
# Check that no segfaults appear with concurrent access to
|
404
|
+
# UnivariateSpline
|
405
|
+
xx = np.arange(100, dtype=float)
|
406
|
+
yy = xx**3
|
407
|
+
x = np.arange(100, dtype=float)
|
408
|
+
x[1] = x[0]
|
409
|
+
spl = UnivariateSpline(xx, yy, check_finite=True)
|
410
|
+
|
411
|
+
def worker_fn(_, interp, x):
|
412
|
+
interp(x)
|
413
|
+
|
414
|
+
_run_concurrent_barrier(10, worker_fn, spl, x)
|
415
|
+
|
416
|
+
|
417
|
+
class TestLSQBivariateSpline:
|
418
|
+
# NOTE: The systems in this test class are rank-deficient
|
419
|
+
@pytest.mark.thread_unsafe
|
420
|
+
def test_linear_constant(self):
|
421
|
+
x = [1,1,1,2,2,2,3,3,3]
|
422
|
+
y = [1,2,3,1,2,3,1,2,3]
|
423
|
+
z = [3,3,3,3,3,3,3,3,3]
|
424
|
+
s = 0.1
|
425
|
+
tx = [1+s,3-s]
|
426
|
+
ty = [1+s,3-s]
|
427
|
+
with suppress_warnings() as sup:
|
428
|
+
r = sup.record(UserWarning, "\nThe coefficients of the spline")
|
429
|
+
lut = LSQBivariateSpline(x,y,z,tx,ty,kx=1,ky=1)
|
430
|
+
assert len(r) == 1
|
431
|
+
|
432
|
+
assert_almost_equal(lut(2, 2), np.asarray(3.))
|
433
|
+
|
434
|
+
def test_bilinearity(self):
|
435
|
+
x = [1,1,1,2,2,2,3,3,3]
|
436
|
+
y = [1,2,3,1,2,3,1,2,3]
|
437
|
+
z = [0,7,8,3,4,7,1,3,4]
|
438
|
+
s = 0.1
|
439
|
+
tx = [1+s,3-s]
|
440
|
+
ty = [1+s,3-s]
|
441
|
+
with suppress_warnings() as sup:
|
442
|
+
# This seems to fail (ier=1, see ticket 1642).
|
443
|
+
sup.filter(UserWarning, "\nThe coefficients of the spline")
|
444
|
+
lut = LSQBivariateSpline(x,y,z,tx,ty,kx=1,ky=1)
|
445
|
+
|
446
|
+
tx, ty = lut.get_knots()
|
447
|
+
for xa, xb in zip(tx[:-1], tx[1:]):
|
448
|
+
for ya, yb in zip(ty[:-1], ty[1:]):
|
449
|
+
for t in [0.1, 0.5, 0.9]:
|
450
|
+
for s in [0.3, 0.4, 0.7]:
|
451
|
+
xp = xa*(1-t) + xb*t
|
452
|
+
yp = ya*(1-s) + yb*s
|
453
|
+
zp = (+ lut(xa, ya)*(1-t)*(1-s)
|
454
|
+
+ lut(xb, ya)*t*(1-s)
|
455
|
+
+ lut(xa, yb)*(1-t)*s
|
456
|
+
+ lut(xb, yb)*t*s)
|
457
|
+
assert_almost_equal(lut(xp,yp), zp)
|
458
|
+
|
459
|
+
@pytest.mark.thread_unsafe
|
460
|
+
def test_integral(self):
|
461
|
+
x = [1,1,1,2,2,2,8,8,8]
|
462
|
+
y = [1,2,3,1,2,3,1,2,3]
|
463
|
+
z = array([0,7,8,3,4,7,1,3,4])
|
464
|
+
|
465
|
+
s = 0.1
|
466
|
+
tx = [1+s,3-s]
|
467
|
+
ty = [1+s,3-s]
|
468
|
+
with suppress_warnings() as sup:
|
469
|
+
r = sup.record(UserWarning, "\nThe coefficients of the spline")
|
470
|
+
lut = LSQBivariateSpline(x, y, z, tx, ty, kx=1, ky=1)
|
471
|
+
assert len(r) == 1
|
472
|
+
tx, ty = lut.get_knots()
|
473
|
+
tz = lut(tx, ty)
|
474
|
+
trpz = .25*(diff(tx)[:,None]*diff(ty)[None,:]
|
475
|
+
* (tz[:-1,:-1]+tz[1:,:-1]+tz[:-1,1:]+tz[1:,1:])).sum()
|
476
|
+
|
477
|
+
assert_almost_equal(np.asarray(lut.integral(tx[0], tx[-1], ty[0], ty[-1])),
|
478
|
+
np.asarray(trpz))
|
479
|
+
|
480
|
+
@pytest.mark.thread_unsafe
|
481
|
+
def test_empty_input(self):
|
482
|
+
# Test whether empty inputs returns an empty output. Ticket 1014
|
483
|
+
x = [1,1,1,2,2,2,3,3,3]
|
484
|
+
y = [1,2,3,1,2,3,1,2,3]
|
485
|
+
z = [3,3,3,3,3,3,3,3,3]
|
486
|
+
s = 0.1
|
487
|
+
tx = [1+s,3-s]
|
488
|
+
ty = [1+s,3-s]
|
489
|
+
with suppress_warnings() as sup:
|
490
|
+
r = sup.record(UserWarning, "\nThe coefficients of the spline")
|
491
|
+
lut = LSQBivariateSpline(x, y, z, tx, ty, kx=1, ky=1)
|
492
|
+
assert len(r) == 1
|
493
|
+
|
494
|
+
xp_assert_equal(lut([], []), np.zeros((0,0)))
|
495
|
+
xp_assert_equal(lut([], [], grid=False), np.zeros((0,)))
|
496
|
+
|
497
|
+
def test_invalid_input(self):
|
498
|
+
s = 0.1
|
499
|
+
tx = [1 + s, 3 - s]
|
500
|
+
ty = [1 + s, 3 - s]
|
501
|
+
|
502
|
+
with assert_raises(ValueError) as info:
|
503
|
+
x = np.linspace(1.0, 10.0)
|
504
|
+
y = np.linspace(1.0, 10.0)
|
505
|
+
z = np.linspace(1.0, 10.0, num=10)
|
506
|
+
LSQBivariateSpline(x, y, z, tx, ty)
|
507
|
+
assert "x, y, and z should have a same length" in str(info.value)
|
508
|
+
|
509
|
+
with assert_raises(ValueError) as info:
|
510
|
+
x = np.linspace(1.0, 10.0)
|
511
|
+
y = np.linspace(1.0, 10.0)
|
512
|
+
z = np.linspace(1.0, 10.0)
|
513
|
+
w = np.linspace(1.0, 10.0, num=20)
|
514
|
+
LSQBivariateSpline(x, y, z, tx, ty, w=w)
|
515
|
+
assert "x, y, z, and w should have a same length" in str(info.value)
|
516
|
+
|
517
|
+
with assert_raises(ValueError) as info:
|
518
|
+
w = np.linspace(-1.0, 10.0)
|
519
|
+
LSQBivariateSpline(x, y, z, tx, ty, w=w)
|
520
|
+
assert "w should be positive" in str(info.value)
|
521
|
+
|
522
|
+
with assert_raises(ValueError) as info:
|
523
|
+
bbox = (-100, 100, -100)
|
524
|
+
LSQBivariateSpline(x, y, z, tx, ty, bbox=bbox)
|
525
|
+
assert "bbox shape should be (4,)" in str(info.value)
|
526
|
+
|
527
|
+
with assert_raises(ValueError) as info:
|
528
|
+
LSQBivariateSpline(x, y, z, tx, ty, kx=10, ky=10)
|
529
|
+
assert "The length of x, y and z should be at least (kx+1) * (ky+1)" in \
|
530
|
+
str(info.value)
|
531
|
+
|
532
|
+
with assert_raises(ValueError) as exc_info:
|
533
|
+
LSQBivariateSpline(x, y, z, tx, ty, eps=0.0)
|
534
|
+
assert "eps should be between (0, 1)" in str(exc_info.value)
|
535
|
+
|
536
|
+
with assert_raises(ValueError) as exc_info:
|
537
|
+
LSQBivariateSpline(x, y, z, tx, ty, eps=1.0)
|
538
|
+
assert "eps should be between (0, 1)" in str(exc_info.value)
|
539
|
+
|
540
|
+
@pytest.mark.thread_unsafe
|
541
|
+
def test_array_like_input(self):
|
542
|
+
s = 0.1
|
543
|
+
tx = np.array([1 + s, 3 - s])
|
544
|
+
ty = np.array([1 + s, 3 - s])
|
545
|
+
x = np.linspace(1.0, 10.0)
|
546
|
+
y = np.linspace(1.0, 10.0)
|
547
|
+
z = np.linspace(1.0, 10.0)
|
548
|
+
w = np.linspace(1.0, 10.0)
|
549
|
+
bbox = np.array([1.0, 10.0, 1.0, 10.0])
|
550
|
+
|
551
|
+
with suppress_warnings() as sup:
|
552
|
+
r = sup.record(UserWarning, "\nThe coefficients of the spline")
|
553
|
+
# np.array input
|
554
|
+
spl1 = LSQBivariateSpline(x, y, z, tx, ty, w=w, bbox=bbox)
|
555
|
+
# list input
|
556
|
+
spl2 = LSQBivariateSpline(x.tolist(), y.tolist(), z.tolist(),
|
557
|
+
tx.tolist(), ty.tolist(), w=w.tolist(),
|
558
|
+
bbox=bbox)
|
559
|
+
xp_assert_close(spl1(2.0, 2.0), spl2(2.0, 2.0))
|
560
|
+
assert len(r) == 2
|
561
|
+
|
562
|
+
@pytest.mark.thread_unsafe
|
563
|
+
def test_unequal_length_of_knots(self):
|
564
|
+
"""Test for the case when the input knot-location arrays in x and y are
|
565
|
+
of different lengths.
|
566
|
+
"""
|
567
|
+
x, y = np.mgrid[0:100, 0:100]
|
568
|
+
x = x.ravel()
|
569
|
+
y = y.ravel()
|
570
|
+
z = 3.0 * np.ones_like(x)
|
571
|
+
tx = np.linspace(0.1, 98.0, 29)
|
572
|
+
ty = np.linspace(0.1, 98.0, 33)
|
573
|
+
with suppress_warnings() as sup:
|
574
|
+
r = sup.record(UserWarning, "\nThe coefficients of the spline")
|
575
|
+
lut = LSQBivariateSpline(x,y,z,tx,ty)
|
576
|
+
assert len(r) == 1
|
577
|
+
|
578
|
+
assert_almost_equal(lut(x, y, grid=False), z)
|
579
|
+
|
580
|
+
|
581
|
+
class TestSmoothBivariateSpline:
|
582
|
+
def test_linear_constant(self):
|
583
|
+
x = [1,1,1,2,2,2,3,3,3]
|
584
|
+
y = [1,2,3,1,2,3,1,2,3]
|
585
|
+
z = [3,3,3,3,3,3,3,3,3]
|
586
|
+
lut = SmoothBivariateSpline(x,y,z,kx=1,ky=1)
|
587
|
+
for t in lut.get_knots():
|
588
|
+
assert_array_almost_equal(t, [1, 1, 3, 3])
|
589
|
+
|
590
|
+
assert_array_almost_equal(lut.get_coeffs(), [3, 3, 3, 3])
|
591
|
+
assert abs(lut.get_residual()) < 1e-15
|
592
|
+
assert_array_almost_equal(lut([1, 1.5, 2], [1, 1.5]), [[3, 3], [3, 3], [3, 3]])
|
593
|
+
|
594
|
+
def test_linear_1d(self):
|
595
|
+
x = [1,1,1,2,2,2,3,3,3]
|
596
|
+
y = [1,2,3,1,2,3,1,2,3]
|
597
|
+
z = [0,0,0,2,2,2,4,4,4]
|
598
|
+
lut = SmoothBivariateSpline(x,y,z,kx=1,ky=1)
|
599
|
+
for t in lut.get_knots():
|
600
|
+
xp_assert_close(t, np.asarray([1.0, 1, 3, 3]))
|
601
|
+
assert_array_almost_equal(lut.get_coeffs(), [0, 0, 4, 4])
|
602
|
+
assert abs(lut.get_residual()) < 1e-15
|
603
|
+
assert_array_almost_equal(lut([1,1.5,2],[1,1.5]),[[0,0],[1,1],[2,2]])
|
604
|
+
|
605
|
+
@pytest.mark.thread_unsafe
|
606
|
+
def test_integral(self):
|
607
|
+
x = [1,1,1,2,2,2,4,4,4]
|
608
|
+
y = [1,2,3,1,2,3,1,2,3]
|
609
|
+
z = array([0,7,8,3,4,7,1,3,4])
|
610
|
+
|
611
|
+
with suppress_warnings() as sup:
|
612
|
+
# This seems to fail (ier=1, see ticket 1642).
|
613
|
+
sup.filter(UserWarning, "\nThe required storage space")
|
614
|
+
lut = SmoothBivariateSpline(x, y, z, kx=1, ky=1, s=0)
|
615
|
+
|
616
|
+
tx = [1,2,4]
|
617
|
+
ty = [1,2,3]
|
618
|
+
|
619
|
+
tz = lut(tx, ty)
|
620
|
+
trpz = .25*(diff(tx)[:,None]*diff(ty)[None,:]
|
621
|
+
* (tz[:-1,:-1]+tz[1:,:-1]+tz[:-1,1:]+tz[1:,1:])).sum()
|
622
|
+
assert_almost_equal(np.asarray(lut.integral(tx[0], tx[-1], ty[0], ty[-1])),
|
623
|
+
np.asarray(trpz))
|
624
|
+
|
625
|
+
lut2 = SmoothBivariateSpline(x, y, z, kx=2, ky=2, s=0)
|
626
|
+
assert_almost_equal(np.asarray(lut2.integral(tx[0], tx[-1], ty[0], ty[-1])),
|
627
|
+
np.asarray(trpz),
|
628
|
+
decimal=0) # the quadratures give 23.75 and 23.85
|
629
|
+
|
630
|
+
tz = lut(tx[:-1], ty[:-1])
|
631
|
+
trpz = .25*(diff(tx[:-1])[:,None]*diff(ty[:-1])[None,:]
|
632
|
+
* (tz[:-1,:-1]+tz[1:,:-1]+tz[:-1,1:]+tz[1:,1:])).sum()
|
633
|
+
assert_almost_equal(np.asarray(lut.integral(tx[0], tx[-2], ty[0], ty[-2])),
|
634
|
+
np.asarray(trpz))
|
635
|
+
|
636
|
+
def test_rerun_lwrk2_too_small(self):
|
637
|
+
# in this setting, lwrk2 is too small in the default run. Here we
|
638
|
+
# check for equality with the bisplrep/bisplev output because there,
|
639
|
+
# an automatic re-run of the spline representation is done if ier>10.
|
640
|
+
x = np.linspace(-2, 2, 80)
|
641
|
+
y = np.linspace(-2, 2, 80)
|
642
|
+
z = x + y
|
643
|
+
xi = np.linspace(-1, 1, 100)
|
644
|
+
yi = np.linspace(-2, 2, 100)
|
645
|
+
tck = bisplrep(x, y, z)
|
646
|
+
res1 = bisplev(xi, yi, tck)
|
647
|
+
interp_ = SmoothBivariateSpline(x, y, z)
|
648
|
+
res2 = interp_(xi, yi)
|
649
|
+
assert_almost_equal(res1, res2)
|
650
|
+
|
651
|
+
def test_invalid_input(self):
|
652
|
+
|
653
|
+
with assert_raises(ValueError) as info:
|
654
|
+
x = np.linspace(1.0, 10.0)
|
655
|
+
y = np.linspace(1.0, 10.0)
|
656
|
+
z = np.linspace(1.0, 10.0, num=10)
|
657
|
+
SmoothBivariateSpline(x, y, z)
|
658
|
+
assert "x, y, and z should have a same length" in str(info.value)
|
659
|
+
|
660
|
+
with assert_raises(ValueError) as info:
|
661
|
+
x = np.linspace(1.0, 10.0)
|
662
|
+
y = np.linspace(1.0, 10.0)
|
663
|
+
z = np.linspace(1.0, 10.0)
|
664
|
+
w = np.linspace(1.0, 10.0, num=20)
|
665
|
+
SmoothBivariateSpline(x, y, z, w=w)
|
666
|
+
assert "x, y, z, and w should have a same length" in str(info.value)
|
667
|
+
|
668
|
+
with assert_raises(ValueError) as info:
|
669
|
+
w = np.linspace(-1.0, 10.0)
|
670
|
+
SmoothBivariateSpline(x, y, z, w=w)
|
671
|
+
assert "w should be positive" in str(info.value)
|
672
|
+
|
673
|
+
with assert_raises(ValueError) as info:
|
674
|
+
bbox = (-100, 100, -100)
|
675
|
+
SmoothBivariateSpline(x, y, z, bbox=bbox)
|
676
|
+
assert "bbox shape should be (4,)" in str(info.value)
|
677
|
+
|
678
|
+
with assert_raises(ValueError) as info:
|
679
|
+
SmoothBivariateSpline(x, y, z, kx=10, ky=10)
|
680
|
+
assert "The length of x, y and z should be at least (kx+1) * (ky+1)" in\
|
681
|
+
str(info.value)
|
682
|
+
|
683
|
+
with assert_raises(ValueError) as info:
|
684
|
+
SmoothBivariateSpline(x, y, z, s=-1.0)
|
685
|
+
assert "s should be s >= 0.0" in str(info.value)
|
686
|
+
|
687
|
+
with assert_raises(ValueError) as exc_info:
|
688
|
+
SmoothBivariateSpline(x, y, z, eps=0.0)
|
689
|
+
assert "eps should be between (0, 1)" in str(exc_info.value)
|
690
|
+
|
691
|
+
with assert_raises(ValueError) as exc_info:
|
692
|
+
SmoothBivariateSpline(x, y, z, eps=1.0)
|
693
|
+
assert "eps should be between (0, 1)" in str(exc_info.value)
|
694
|
+
|
695
|
+
def test_array_like_input(self):
|
696
|
+
x = np.array([1, 1, 1, 2, 2, 2, 3, 3, 3])
|
697
|
+
y = np.array([1, 2, 3, 1, 2, 3, 1, 2, 3])
|
698
|
+
z = np.array([3, 3, 3, 3, 3, 3, 3, 3, 3])
|
699
|
+
w = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1])
|
700
|
+
bbox = np.array([1.0, 3.0, 1.0, 3.0])
|
701
|
+
# np.array input
|
702
|
+
spl1 = SmoothBivariateSpline(x, y, z, w=w, bbox=bbox, kx=1, ky=1)
|
703
|
+
# list input
|
704
|
+
spl2 = SmoothBivariateSpline(x.tolist(), y.tolist(), z.tolist(),
|
705
|
+
bbox=bbox.tolist(), w=w.tolist(),
|
706
|
+
kx=1, ky=1)
|
707
|
+
xp_assert_close(spl1(0.1, 0.5), spl2(0.1, 0.5))
|
708
|
+
|
709
|
+
|
710
|
+
class TestLSQSphereBivariateSpline:
|
711
|
+
def setup_method(self):
|
712
|
+
# define the input data and coordinates
|
713
|
+
ntheta, nphi = 70, 90
|
714
|
+
theta = linspace(0.5/(ntheta - 1), 1 - 0.5/(ntheta - 1), ntheta) * pi
|
715
|
+
phi = linspace(0.5/(nphi - 1), 1 - 0.5/(nphi - 1), nphi) * 2. * pi
|
716
|
+
data = ones((theta.shape[0], phi.shape[0]))
|
717
|
+
# define knots and extract data values at the knots
|
718
|
+
knotst = theta[::5]
|
719
|
+
knotsp = phi[::5]
|
720
|
+
knotdata = data[::5, ::5]
|
721
|
+
# calculate spline coefficients
|
722
|
+
lats, lons = meshgrid(theta, phi)
|
723
|
+
lut_lsq = LSQSphereBivariateSpline(lats.ravel(), lons.ravel(),
|
724
|
+
data.T.ravel(), knotst, knotsp)
|
725
|
+
self.lut_lsq = lut_lsq
|
726
|
+
self.data = knotdata
|
727
|
+
self.new_lons, self.new_lats = knotsp, knotst
|
728
|
+
|
729
|
+
def test_linear_constant(self):
|
730
|
+
assert abs(self.lut_lsq.get_residual()) < 1e-15
|
731
|
+
assert_array_almost_equal(self.lut_lsq(self.new_lats, self.new_lons),
|
732
|
+
self.data)
|
733
|
+
|
734
|
+
def test_empty_input(self):
|
735
|
+
assert_array_almost_equal(self.lut_lsq([], []), np.zeros((0,0)))
|
736
|
+
assert_array_almost_equal(self.lut_lsq([], [], grid=False), np.zeros((0,)))
|
737
|
+
|
738
|
+
def test_invalid_input(self):
|
739
|
+
ntheta, nphi = 70, 90
|
740
|
+
theta = linspace(0.5 / (ntheta - 1), 1 - 0.5 / (ntheta - 1),
|
741
|
+
ntheta) * pi
|
742
|
+
phi = linspace(0.5 / (nphi - 1), 1 - 0.5 / (nphi - 1), nphi) * 2. * pi
|
743
|
+
data = ones((theta.shape[0], phi.shape[0]))
|
744
|
+
# define knots and extract data values at the knots
|
745
|
+
knotst = theta[::5]
|
746
|
+
knotsp = phi[::5]
|
747
|
+
|
748
|
+
with assert_raises(ValueError) as exc_info:
|
749
|
+
invalid_theta = linspace(-0.1, 1.0, num=ntheta) * pi
|
750
|
+
invalid_lats, lons = meshgrid(invalid_theta, phi)
|
751
|
+
LSQSphereBivariateSpline(invalid_lats.ravel(), lons.ravel(),
|
752
|
+
data.T.ravel(), knotst, knotsp)
|
753
|
+
assert "theta should be between [0, pi]" in str(exc_info.value)
|
754
|
+
|
755
|
+
with assert_raises(ValueError) as exc_info:
|
756
|
+
invalid_theta = linspace(0.1, 1.1, num=ntheta) * pi
|
757
|
+
invalid_lats, lons = meshgrid(invalid_theta, phi)
|
758
|
+
LSQSphereBivariateSpline(invalid_lats.ravel(), lons.ravel(),
|
759
|
+
data.T.ravel(), knotst, knotsp)
|
760
|
+
assert "theta should be between [0, pi]" in str(exc_info.value)
|
761
|
+
|
762
|
+
with assert_raises(ValueError) as exc_info:
|
763
|
+
invalid_phi = linspace(-0.1, 1.0, num=ntheta) * 2.0 * pi
|
764
|
+
lats, invalid_lons = meshgrid(theta, invalid_phi)
|
765
|
+
LSQSphereBivariateSpline(lats.ravel(), invalid_lons.ravel(),
|
766
|
+
data.T.ravel(), knotst, knotsp)
|
767
|
+
assert "phi should be between [0, 2pi]" in str(exc_info.value)
|
768
|
+
|
769
|
+
with assert_raises(ValueError) as exc_info:
|
770
|
+
invalid_phi = linspace(0.0, 1.1, num=ntheta) * 2.0 * pi
|
771
|
+
lats, invalid_lons = meshgrid(theta, invalid_phi)
|
772
|
+
LSQSphereBivariateSpline(lats.ravel(), invalid_lons.ravel(),
|
773
|
+
data.T.ravel(), knotst, knotsp)
|
774
|
+
assert "phi should be between [0, 2pi]" in str(exc_info.value)
|
775
|
+
|
776
|
+
lats, lons = meshgrid(theta, phi)
|
777
|
+
|
778
|
+
with assert_raises(ValueError) as exc_info:
|
779
|
+
invalid_knotst = np.copy(knotst)
|
780
|
+
invalid_knotst[0] = -0.1
|
781
|
+
LSQSphereBivariateSpline(lats.ravel(), lons.ravel(),
|
782
|
+
data.T.ravel(), invalid_knotst, knotsp)
|
783
|
+
assert "tt should be between (0, pi)" in str(exc_info.value)
|
784
|
+
|
785
|
+
with assert_raises(ValueError) as exc_info:
|
786
|
+
invalid_knotst = np.copy(knotst)
|
787
|
+
invalid_knotst[0] = pi
|
788
|
+
LSQSphereBivariateSpline(lats.ravel(), lons.ravel(),
|
789
|
+
data.T.ravel(), invalid_knotst, knotsp)
|
790
|
+
assert "tt should be between (0, pi)" in str(exc_info.value)
|
791
|
+
|
792
|
+
with assert_raises(ValueError) as exc_info:
|
793
|
+
invalid_knotsp = np.copy(knotsp)
|
794
|
+
invalid_knotsp[0] = -0.1
|
795
|
+
LSQSphereBivariateSpline(lats.ravel(), lons.ravel(),
|
796
|
+
data.T.ravel(), knotst, invalid_knotsp)
|
797
|
+
assert "tp should be between (0, 2pi)" in str(exc_info.value)
|
798
|
+
|
799
|
+
with assert_raises(ValueError) as exc_info:
|
800
|
+
invalid_knotsp = np.copy(knotsp)
|
801
|
+
invalid_knotsp[0] = 2 * pi
|
802
|
+
LSQSphereBivariateSpline(lats.ravel(), lons.ravel(),
|
803
|
+
data.T.ravel(), knotst, invalid_knotsp)
|
804
|
+
assert "tp should be between (0, 2pi)" in str(exc_info.value)
|
805
|
+
|
806
|
+
with assert_raises(ValueError) as exc_info:
|
807
|
+
invalid_w = array([-1.0, 1.0, 1.5, 0.5, 1.0, 1.5, 0.5, 1.0, 1.0])
|
808
|
+
LSQSphereBivariateSpline(lats.ravel(), lons.ravel(), data.T.ravel(),
|
809
|
+
knotst, knotsp, w=invalid_w)
|
810
|
+
assert "w should be positive" in str(exc_info.value)
|
811
|
+
|
812
|
+
with assert_raises(ValueError) as exc_info:
|
813
|
+
LSQSphereBivariateSpline(lats.ravel(), lons.ravel(), data.T.ravel(),
|
814
|
+
knotst, knotsp, eps=0.0)
|
815
|
+
assert "eps should be between (0, 1)" in str(exc_info.value)
|
816
|
+
|
817
|
+
with assert_raises(ValueError) as exc_info:
|
818
|
+
LSQSphereBivariateSpline(lats.ravel(), lons.ravel(), data.T.ravel(),
|
819
|
+
knotst, knotsp, eps=1.0)
|
820
|
+
assert "eps should be between (0, 1)" in str(exc_info.value)
|
821
|
+
|
822
|
+
def test_array_like_input(self):
|
823
|
+
ntheta, nphi = 70, 90
|
824
|
+
theta = linspace(0.5 / (ntheta - 1), 1 - 0.5 / (ntheta - 1),
|
825
|
+
ntheta) * pi
|
826
|
+
phi = linspace(0.5 / (nphi - 1), 1 - 0.5 / (nphi - 1),
|
827
|
+
nphi) * 2. * pi
|
828
|
+
lats, lons = meshgrid(theta, phi)
|
829
|
+
data = ones((theta.shape[0], phi.shape[0]))
|
830
|
+
# define knots and extract data values at the knots
|
831
|
+
knotst = theta[::5]
|
832
|
+
knotsp = phi[::5]
|
833
|
+
w = ones(lats.ravel().shape[0])
|
834
|
+
|
835
|
+
# np.array input
|
836
|
+
spl1 = LSQSphereBivariateSpline(lats.ravel(), lons.ravel(),
|
837
|
+
data.T.ravel(), knotst, knotsp, w=w)
|
838
|
+
# list input
|
839
|
+
spl2 = LSQSphereBivariateSpline(lats.ravel().tolist(),
|
840
|
+
lons.ravel().tolist(),
|
841
|
+
data.T.ravel().tolist(),
|
842
|
+
knotst.tolist(),
|
843
|
+
knotsp.tolist(), w=w.tolist())
|
844
|
+
assert_array_almost_equal(spl1(1.0, 1.0), spl2(1.0, 1.0))
|
845
|
+
|
846
|
+
|
847
|
+
class TestSmoothSphereBivariateSpline:
|
848
|
+
def setup_method(self):
|
849
|
+
theta = array([.25*pi, .25*pi, .25*pi, .5*pi, .5*pi, .5*pi, .75*pi,
|
850
|
+
.75*pi, .75*pi])
|
851
|
+
phi = array([.5 * pi, pi, 1.5 * pi, .5 * pi, pi, 1.5 * pi, .5 * pi, pi,
|
852
|
+
1.5 * pi])
|
853
|
+
r = array([3, 3, 3, 3, 3, 3, 3, 3, 3])
|
854
|
+
self.lut = SmoothSphereBivariateSpline(theta, phi, r, s=1E10)
|
855
|
+
|
856
|
+
def test_linear_constant(self):
|
857
|
+
assert abs(self.lut.get_residual()) < 1e-15
|
858
|
+
assert_array_almost_equal(self.lut([1, 1.5, 2],[1, 1.5]),
|
859
|
+
[[3, 3], [3, 3], [3, 3]])
|
860
|
+
|
861
|
+
def test_empty_input(self):
|
862
|
+
assert_array_almost_equal(self.lut([], []), np.zeros((0,0)))
|
863
|
+
assert_array_almost_equal(self.lut([], [], grid=False), np.zeros((0,)))
|
864
|
+
|
865
|
+
def test_invalid_input(self):
|
866
|
+
theta = array([.25 * pi, .25 * pi, .25 * pi, .5 * pi, .5 * pi, .5 * pi,
|
867
|
+
.75 * pi, .75 * pi, .75 * pi])
|
868
|
+
phi = array([.5 * pi, pi, 1.5 * pi, .5 * pi, pi, 1.5 * pi, .5 * pi, pi,
|
869
|
+
1.5 * pi])
|
870
|
+
r = array([3, 3, 3, 3, 3, 3, 3, 3, 3])
|
871
|
+
|
872
|
+
with assert_raises(ValueError) as exc_info:
|
873
|
+
invalid_theta = array([-0.1 * pi, .25 * pi, .25 * pi, .5 * pi,
|
874
|
+
.5 * pi, .5 * pi, .75 * pi, .75 * pi,
|
875
|
+
.75 * pi])
|
876
|
+
SmoothSphereBivariateSpline(invalid_theta, phi, r, s=1E10)
|
877
|
+
assert "theta should be between [0, pi]" in str(exc_info.value)
|
878
|
+
|
879
|
+
with assert_raises(ValueError) as exc_info:
|
880
|
+
invalid_theta = array([.25 * pi, .25 * pi, .25 * pi, .5 * pi,
|
881
|
+
.5 * pi, .5 * pi, .75 * pi, .75 * pi,
|
882
|
+
1.1 * pi])
|
883
|
+
SmoothSphereBivariateSpline(invalid_theta, phi, r, s=1E10)
|
884
|
+
assert "theta should be between [0, pi]" in str(exc_info.value)
|
885
|
+
|
886
|
+
with assert_raises(ValueError) as exc_info:
|
887
|
+
invalid_phi = array([-.1 * pi, pi, 1.5 * pi, .5 * pi, pi, 1.5 * pi,
|
888
|
+
.5 * pi, pi, 1.5 * pi])
|
889
|
+
SmoothSphereBivariateSpline(theta, invalid_phi, r, s=1E10)
|
890
|
+
assert "phi should be between [0, 2pi]" in str(exc_info.value)
|
891
|
+
|
892
|
+
with assert_raises(ValueError) as exc_info:
|
893
|
+
invalid_phi = array([1.0 * pi, pi, 1.5 * pi, .5 * pi, pi, 1.5 * pi,
|
894
|
+
.5 * pi, pi, 2.1 * pi])
|
895
|
+
SmoothSphereBivariateSpline(theta, invalid_phi, r, s=1E10)
|
896
|
+
assert "phi should be between [0, 2pi]" in str(exc_info.value)
|
897
|
+
|
898
|
+
with assert_raises(ValueError) as exc_info:
|
899
|
+
invalid_w = array([-1.0, 1.0, 1.5, 0.5, 1.0, 1.5, 0.5, 1.0, 1.0])
|
900
|
+
SmoothSphereBivariateSpline(theta, phi, r, w=invalid_w, s=1E10)
|
901
|
+
assert "w should be positive" in str(exc_info.value)
|
902
|
+
|
903
|
+
with assert_raises(ValueError) as exc_info:
|
904
|
+
SmoothSphereBivariateSpline(theta, phi, r, s=-1.0)
|
905
|
+
assert "s should be positive" in str(exc_info.value)
|
906
|
+
|
907
|
+
with assert_raises(ValueError) as exc_info:
|
908
|
+
SmoothSphereBivariateSpline(theta, phi, r, eps=-1.0)
|
909
|
+
assert "eps should be between (0, 1)" in str(exc_info.value)
|
910
|
+
|
911
|
+
with assert_raises(ValueError) as exc_info:
|
912
|
+
SmoothSphereBivariateSpline(theta, phi, r, eps=1.0)
|
913
|
+
assert "eps should be between (0, 1)" in str(exc_info.value)
|
914
|
+
|
915
|
+
def test_array_like_input(self):
|
916
|
+
theta = np.array([.25 * pi, .25 * pi, .25 * pi, .5 * pi, .5 * pi,
|
917
|
+
.5 * pi, .75 * pi, .75 * pi, .75 * pi])
|
918
|
+
phi = np.array([.5 * pi, pi, 1.5 * pi, .5 * pi, pi, 1.5 * pi, .5 * pi,
|
919
|
+
pi, 1.5 * pi])
|
920
|
+
r = np.array([3, 3, 3, 3, 3, 3, 3, 3, 3])
|
921
|
+
w = np.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0])
|
922
|
+
|
923
|
+
# np.array input
|
924
|
+
spl1 = SmoothSphereBivariateSpline(theta, phi, r, w=w, s=1E10)
|
925
|
+
|
926
|
+
# list input
|
927
|
+
spl2 = SmoothSphereBivariateSpline(theta.tolist(), phi.tolist(),
|
928
|
+
r.tolist(), w=w.tolist(), s=1E10)
|
929
|
+
assert_array_almost_equal(spl1(1.0, 1.0), spl2(1.0, 1.0))
|
930
|
+
|
931
|
+
|
932
|
+
class TestRectBivariateSpline:
|
933
|
+
def test_defaults(self):
|
934
|
+
x = array([1,2,3,4,5])
|
935
|
+
y = array([1,2,3,4,5])
|
936
|
+
z = array([[1,2,1,2,1],[1,2,1,2,1],[1,2,3,2,1],[1,2,2,2,1],[1,2,1,2,1]])
|
937
|
+
lut = RectBivariateSpline(x,y,z)
|
938
|
+
assert_array_almost_equal(lut(x,y),z)
|
939
|
+
|
940
|
+
def test_evaluate(self):
|
941
|
+
x = array([1,2,3,4,5])
|
942
|
+
y = array([1,2,3,4,5])
|
943
|
+
z = array([[1,2,1,2,1],[1,2,1,2,1],[1,2,3,2,1],[1,2,2,2,1],[1,2,1,2,1]])
|
944
|
+
lut = RectBivariateSpline(x,y,z)
|
945
|
+
|
946
|
+
xi = [1, 2.3, 5.3, 0.5, 3.3, 1.2, 3]
|
947
|
+
yi = [1, 3.3, 1.2, 4.0, 5.0, 1.0, 3]
|
948
|
+
zi = lut.ev(xi, yi)
|
949
|
+
zi2 = array([lut(xp, yp)[0,0] for xp, yp in zip(xi, yi)])
|
950
|
+
|
951
|
+
assert_almost_equal(zi, zi2)
|
952
|
+
|
953
|
+
def test_derivatives_grid(self):
|
954
|
+
x = array([1,2,3,4,5])
|
955
|
+
y = array([1,2,3,4,5])
|
956
|
+
z = array([[1,2,1,2,1],[1,2,1,2,1],[1,2,3,2,1],[1,2,2,2,1],[1,2,1,2,1]])
|
957
|
+
dx = array([[0,0,-20,0,0],[0,0,13,0,0],[0,0,4,0,0],
|
958
|
+
[0,0,-11,0,0],[0,0,4,0,0]])/6.
|
959
|
+
dy = array([[4,-1,0,1,-4],[4,-1,0,1,-4],[0,1.5,0,-1.5,0],
|
960
|
+
[2,.25,0,-.25,-2],[4,-1,0,1,-4]])
|
961
|
+
dxdy = array([[40,-25,0,25,-40],[-26,16.25,0,-16.25,26],
|
962
|
+
[-8,5,0,-5,8],[22,-13.75,0,13.75,-22],[-8,5,0,-5,8]])/6.
|
963
|
+
lut = RectBivariateSpline(x,y,z)
|
964
|
+
assert_array_almost_equal(lut(x,y,dx=1),dx)
|
965
|
+
assert_array_almost_equal(lut(x,y,dy=1),dy)
|
966
|
+
assert_array_almost_equal(lut(x,y,dx=1,dy=1),dxdy)
|
967
|
+
|
968
|
+
def test_derivatives(self):
|
969
|
+
x = array([1,2,3,4,5])
|
970
|
+
y = array([1,2,3,4,5])
|
971
|
+
z = array([[1,2,1,2,1],[1,2,1,2,1],[1,2,3,2,1],[1,2,2,2,1],[1,2,1,2,1]])
|
972
|
+
dx = array([0,0,2./3,0,0])
|
973
|
+
dy = array([4,-1,0,-.25,-4])
|
974
|
+
dxdy = array([160,65,0,55,32])/24.
|
975
|
+
lut = RectBivariateSpline(x,y,z)
|
976
|
+
assert_array_almost_equal(lut(x,y,dx=1,grid=False),dx)
|
977
|
+
assert_array_almost_equal(lut(x,y,dy=1,grid=False),dy)
|
978
|
+
assert_array_almost_equal(lut(x,y,dx=1,dy=1,grid=False),dxdy)
|
979
|
+
|
980
|
+
def test_partial_derivative_method_grid(self):
|
981
|
+
x = array([1, 2, 3, 4, 5])
|
982
|
+
y = array([1, 2, 3, 4, 5])
|
983
|
+
z = array([[1, 2, 1, 2, 1],
|
984
|
+
[1, 2, 1, 2, 1],
|
985
|
+
[1, 2, 3, 2, 1],
|
986
|
+
[1, 2, 2, 2, 1],
|
987
|
+
[1, 2, 1, 2, 1]])
|
988
|
+
dx = array([[0, 0, -20, 0, 0],
|
989
|
+
[0, 0, 13, 0, 0],
|
990
|
+
[0, 0, 4, 0, 0],
|
991
|
+
[0, 0, -11, 0, 0],
|
992
|
+
[0, 0, 4, 0, 0]]) / 6.
|
993
|
+
dy = array([[4, -1, 0, 1, -4],
|
994
|
+
[4, -1, 0, 1, -4],
|
995
|
+
[0, 1.5, 0, -1.5, 0],
|
996
|
+
[2, .25, 0, -.25, -2],
|
997
|
+
[4, -1, 0, 1, -4]])
|
998
|
+
dxdy = array([[40, -25, 0, 25, -40],
|
999
|
+
[-26, 16.25, 0, -16.25, 26],
|
1000
|
+
[-8, 5, 0, -5, 8],
|
1001
|
+
[22, -13.75, 0, 13.75, -22],
|
1002
|
+
[-8, 5, 0, -5, 8]]) / 6.
|
1003
|
+
lut = RectBivariateSpline(x, y, z)
|
1004
|
+
assert_array_almost_equal(lut.partial_derivative(1, 0)(x, y), dx)
|
1005
|
+
assert_array_almost_equal(lut.partial_derivative(0, 1)(x, y), dy)
|
1006
|
+
assert_array_almost_equal(lut.partial_derivative(1, 1)(x, y), dxdy)
|
1007
|
+
|
1008
|
+
def test_partial_derivative_method(self):
|
1009
|
+
x = array([1, 2, 3, 4, 5])
|
1010
|
+
y = array([1, 2, 3, 4, 5])
|
1011
|
+
z = array([[1, 2, 1, 2, 1],
|
1012
|
+
[1, 2, 1, 2, 1],
|
1013
|
+
[1, 2, 3, 2, 1],
|
1014
|
+
[1, 2, 2, 2, 1],
|
1015
|
+
[1, 2, 1, 2, 1]])
|
1016
|
+
dx = array([0, 0, 2./3, 0, 0])
|
1017
|
+
dy = array([4, -1, 0, -.25, -4])
|
1018
|
+
dxdy = array([160, 65, 0, 55, 32]) / 24.
|
1019
|
+
lut = RectBivariateSpline(x, y, z)
|
1020
|
+
assert_array_almost_equal(lut.partial_derivative(1, 0)(x, y,
|
1021
|
+
grid=False),
|
1022
|
+
dx)
|
1023
|
+
assert_array_almost_equal(lut.partial_derivative(0, 1)(x, y,
|
1024
|
+
grid=False),
|
1025
|
+
dy)
|
1026
|
+
assert_array_almost_equal(lut.partial_derivative(1, 1)(x, y,
|
1027
|
+
grid=False),
|
1028
|
+
dxdy)
|
1029
|
+
|
1030
|
+
def test_partial_derivative_order_too_large(self):
|
1031
|
+
x = array([0, 1, 2, 3, 4], dtype=float)
|
1032
|
+
y = x.copy()
|
1033
|
+
z = ones((x.size, y.size))
|
1034
|
+
lut = RectBivariateSpline(x, y, z)
|
1035
|
+
with assert_raises(ValueError):
|
1036
|
+
lut.partial_derivative(4, 1)
|
1037
|
+
|
1038
|
+
def test_broadcast(self):
|
1039
|
+
x = array([1,2,3,4,5])
|
1040
|
+
y = array([1,2,3,4,5])
|
1041
|
+
z = array([[1,2,1,2,1],[1,2,1,2,1],[1,2,3,2,1],[1,2,2,2,1],[1,2,1,2,1]])
|
1042
|
+
lut = RectBivariateSpline(x,y,z)
|
1043
|
+
xp_assert_close(lut(x, y), lut(x[:,None], y[None,:], grid=False))
|
1044
|
+
|
1045
|
+
def test_invalid_input(self):
|
1046
|
+
|
1047
|
+
with assert_raises(ValueError) as info:
|
1048
|
+
x = array([6, 2, 3, 4, 5])
|
1049
|
+
y = array([1, 2, 3, 4, 5])
|
1050
|
+
z = array([[1, 2, 1, 2, 1], [1, 2, 1, 2, 1], [1, 2, 3, 2, 1],
|
1051
|
+
[1, 2, 2, 2, 1], [1, 2, 1, 2, 1]])
|
1052
|
+
RectBivariateSpline(x, y, z)
|
1053
|
+
assert "x must be strictly increasing" in str(info.value)
|
1054
|
+
|
1055
|
+
with assert_raises(ValueError) as info:
|
1056
|
+
x = array([1, 2, 3, 4, 5])
|
1057
|
+
y = array([2, 2, 3, 4, 5])
|
1058
|
+
z = array([[1, 2, 1, 2, 1], [1, 2, 1, 2, 1], [1, 2, 3, 2, 1],
|
1059
|
+
[1, 2, 2, 2, 1], [1, 2, 1, 2, 1]])
|
1060
|
+
RectBivariateSpline(x, y, z)
|
1061
|
+
assert "y must be strictly increasing" in str(info.value)
|
1062
|
+
|
1063
|
+
with assert_raises(ValueError) as info:
|
1064
|
+
x = array([1, 2, 3, 4, 5])
|
1065
|
+
y = array([1, 2, 3, 4, 5])
|
1066
|
+
z = array([[1, 2, 1, 2, 1], [1, 2, 1, 2, 1], [1, 2, 3, 2, 1],
|
1067
|
+
[1, 2, 2, 2, 1]])
|
1068
|
+
RectBivariateSpline(x, y, z)
|
1069
|
+
assert "x dimension of z must have same number of elements as x"\
|
1070
|
+
in str(info.value)
|
1071
|
+
|
1072
|
+
with assert_raises(ValueError) as info:
|
1073
|
+
x = array([1, 2, 3, 4, 5])
|
1074
|
+
y = array([1, 2, 3, 4, 5])
|
1075
|
+
z = array([[1, 2, 1, 2], [1, 2, 1, 2], [1, 2, 3, 2],
|
1076
|
+
[1, 2, 2, 2], [1, 2, 1, 2]])
|
1077
|
+
RectBivariateSpline(x, y, z)
|
1078
|
+
assert "y dimension of z must have same number of elements as y"\
|
1079
|
+
in str(info.value)
|
1080
|
+
|
1081
|
+
with assert_raises(ValueError) as info:
|
1082
|
+
x = array([1, 2, 3, 4, 5])
|
1083
|
+
y = array([1, 2, 3, 4, 5])
|
1084
|
+
z = array([[1, 2, 1, 2, 1], [1, 2, 1, 2, 1], [1, 2, 3, 2, 1],
|
1085
|
+
[1, 2, 2, 2, 1], [1, 2, 1, 2, 1]])
|
1086
|
+
bbox = (-100, 100, -100)
|
1087
|
+
RectBivariateSpline(x, y, z, bbox=bbox)
|
1088
|
+
assert "bbox shape should be (4,)" in str(info.value)
|
1089
|
+
|
1090
|
+
with assert_raises(ValueError) as info:
|
1091
|
+
RectBivariateSpline(x, y, z, s=-1.0)
|
1092
|
+
assert "s should be s >= 0.0" in str(info.value)
|
1093
|
+
|
1094
|
+
def test_array_like_input(self):
|
1095
|
+
x = array([1, 2, 3, 4, 5])
|
1096
|
+
y = array([1, 2, 3, 4, 5])
|
1097
|
+
z = array([[1, 2, 1, 2, 1], [1, 2, 1, 2, 1], [1, 2, 3, 2, 1],
|
1098
|
+
[1, 2, 2, 2, 1], [1, 2, 1, 2, 1]])
|
1099
|
+
bbox = array([1, 5, 1, 5])
|
1100
|
+
|
1101
|
+
spl1 = RectBivariateSpline(x, y, z, bbox=bbox)
|
1102
|
+
spl2 = RectBivariateSpline(x.tolist(), y.tolist(), z.tolist(),
|
1103
|
+
bbox=bbox.tolist())
|
1104
|
+
assert_array_almost_equal(spl1(1.0, 1.0), spl2(1.0, 1.0))
|
1105
|
+
|
1106
|
+
def test_not_increasing_input(self):
|
1107
|
+
# gh-8565
|
1108
|
+
NSamp = 20
|
1109
|
+
Theta = np.random.uniform(0, np.pi, NSamp)
|
1110
|
+
Phi = np.random.uniform(0, 2 * np.pi, NSamp)
|
1111
|
+
Data = np.ones(NSamp)
|
1112
|
+
|
1113
|
+
Interpolator = SmoothSphereBivariateSpline(Theta, Phi, Data, s=3.5)
|
1114
|
+
|
1115
|
+
NLon = 6
|
1116
|
+
NLat = 3
|
1117
|
+
GridPosLats = np.arange(NLat) / NLat * np.pi
|
1118
|
+
GridPosLons = np.arange(NLon) / NLon * 2 * np.pi
|
1119
|
+
|
1120
|
+
# No error
|
1121
|
+
Interpolator(GridPosLats, GridPosLons)
|
1122
|
+
|
1123
|
+
nonGridPosLats = GridPosLats.copy()
|
1124
|
+
nonGridPosLats[2] = 0.001
|
1125
|
+
with assert_raises(ValueError) as exc_info:
|
1126
|
+
Interpolator(nonGridPosLats, GridPosLons)
|
1127
|
+
assert "x must be strictly increasing" in str(exc_info.value)
|
1128
|
+
|
1129
|
+
nonGridPosLons = GridPosLons.copy()
|
1130
|
+
nonGridPosLons[2] = 0.001
|
1131
|
+
with assert_raises(ValueError) as exc_info:
|
1132
|
+
Interpolator(GridPosLats, nonGridPosLons)
|
1133
|
+
assert "y must be strictly increasing" in str(exc_info.value)
|
1134
|
+
|
1135
|
+
def _sample_large_2d_data(self, nx, ny):
|
1136
|
+
rng = np.random.default_rng(1)
|
1137
|
+
x = np.arange(nx)
|
1138
|
+
y = np.arange(ny)
|
1139
|
+
z = rng.integers(0, 100, (nx, ny))
|
1140
|
+
|
1141
|
+
return x, y, z.astype(np.float64)
|
1142
|
+
|
1143
|
+
@pytest.mark.slow()
|
1144
|
+
@pytest.mark.parametrize('shape', [(350, 850), (2000, 170)])
|
1145
|
+
@pytest.mark.parametrize('s_tols', [(0, 1e-12, 1e-7),
|
1146
|
+
(1, 7e-3, 1e-4),
|
1147
|
+
(3, 2e-2, 1e-4)])
|
1148
|
+
def test_spline_large_2d(self, shape, s_tols):
|
1149
|
+
# Reference - https://github.com/scipy/scipy/issues/17787
|
1150
|
+
nx, ny = shape
|
1151
|
+
s, atol, rtol = s_tols
|
1152
|
+
x, y, z = self._sample_large_2d_data(nx, ny)
|
1153
|
+
|
1154
|
+
spl = RectBivariateSpline(x, y, z, s=s)
|
1155
|
+
z_spl = spl(x, y)
|
1156
|
+
assert(not np.isnan(z_spl).any())
|
1157
|
+
xp_assert_close(z_spl, z, atol=atol, rtol=rtol)
|
1158
|
+
|
1159
|
+
@pytest.mark.slow()
|
1160
|
+
@pytest.mark.skipif(sys.maxsize <= 2**32, reason="Segfaults on 32-bit system "
|
1161
|
+
"due to large input data")
|
1162
|
+
def test_spline_large_2d_maxit(self):
|
1163
|
+
# Reference - for https://github.com/scipy/scipy/issues/17787
|
1164
|
+
nx, ny = 1000, 1700
|
1165
|
+
s, atol, rtol = 2, 2e-2, 1e-12
|
1166
|
+
x, y, z = self._sample_large_2d_data(nx, ny)
|
1167
|
+
|
1168
|
+
spl = RectBivariateSpline(x, y, z, s=s, maxit=25)
|
1169
|
+
z_spl = spl(x, y)
|
1170
|
+
assert(not np.isnan(z_spl).any())
|
1171
|
+
xp_assert_close(z_spl, z, atol=atol, rtol=rtol)
|
1172
|
+
|
1173
|
+
|
1174
|
+
class TestRectSphereBivariateSpline:
|
1175
|
+
def test_defaults(self):
|
1176
|
+
y = linspace(0.01, 2*pi-0.01, 7)
|
1177
|
+
x = linspace(0.01, pi-0.01, 7)
|
1178
|
+
z = array([[1,2,1,2,1,2,1],[1,2,1,2,1,2,1],[1,2,3,2,1,2,1],
|
1179
|
+
[1,2,2,2,1,2,1],[1,2,1,2,1,2,1],[1,2,2,2,1,2,1],
|
1180
|
+
[1,2,1,2,1,2,1]])
|
1181
|
+
lut = RectSphereBivariateSpline(x,y,z)
|
1182
|
+
assert_array_almost_equal(lut(x,y),z)
|
1183
|
+
|
1184
|
+
def test_evaluate(self):
|
1185
|
+
y = linspace(0.01, 2*pi-0.01, 7)
|
1186
|
+
x = linspace(0.01, pi-0.01, 7)
|
1187
|
+
z = array([[1,2,1,2,1,2,1],[1,2,1,2,1,2,1],[1,2,3,2,1,2,1],
|
1188
|
+
[1,2,2,2,1,2,1],[1,2,1,2,1,2,1],[1,2,2,2,1,2,1],
|
1189
|
+
[1,2,1,2,1,2,1]])
|
1190
|
+
lut = RectSphereBivariateSpline(x,y,z)
|
1191
|
+
yi = [0.2, 1, 2.3, 2.35, 3.0, 3.99, 5.25]
|
1192
|
+
xi = [1.5, 0.4, 1.1, 0.45, 0.2345, 1., 0.0001]
|
1193
|
+
zi = lut.ev(xi, yi)
|
1194
|
+
zi2 = array([lut(xp, yp)[0,0] for xp, yp in zip(xi, yi)])
|
1195
|
+
assert_almost_equal(zi, zi2)
|
1196
|
+
|
1197
|
+
def test_invalid_input(self):
|
1198
|
+
data = np.dot(np.atleast_2d(90. - np.linspace(-80., 80., 18)).T,
|
1199
|
+
np.atleast_2d(180. - np.abs(np.linspace(0., 350., 9)))).T
|
1200
|
+
|
1201
|
+
with assert_raises(ValueError) as exc_info:
|
1202
|
+
lats = np.linspace(-1, 170, 9) * np.pi / 180.
|
1203
|
+
lons = np.linspace(0, 350, 18) * np.pi / 180.
|
1204
|
+
RectSphereBivariateSpline(lats, lons, data)
|
1205
|
+
assert "u should be between (0, pi)" in str(exc_info.value)
|
1206
|
+
|
1207
|
+
with assert_raises(ValueError) as exc_info:
|
1208
|
+
lats = np.linspace(10, 181, 9) * np.pi / 180.
|
1209
|
+
lons = np.linspace(0, 350, 18) * np.pi / 180.
|
1210
|
+
RectSphereBivariateSpline(lats, lons, data)
|
1211
|
+
assert "u should be between (0, pi)" in str(exc_info.value)
|
1212
|
+
|
1213
|
+
with assert_raises(ValueError) as exc_info:
|
1214
|
+
lats = np.linspace(10, 170, 9) * np.pi / 180.
|
1215
|
+
lons = np.linspace(-181, 10, 18) * np.pi / 180.
|
1216
|
+
RectSphereBivariateSpline(lats, lons, data)
|
1217
|
+
assert "v[0] should be between [-pi, pi)" in str(exc_info.value)
|
1218
|
+
|
1219
|
+
with assert_raises(ValueError) as exc_info:
|
1220
|
+
lats = np.linspace(10, 170, 9) * np.pi / 180.
|
1221
|
+
lons = np.linspace(-10, 360, 18) * np.pi / 180.
|
1222
|
+
RectSphereBivariateSpline(lats, lons, data)
|
1223
|
+
assert "v[-1] should be v[0] + 2pi or less" in str(exc_info.value)
|
1224
|
+
|
1225
|
+
with assert_raises(ValueError) as exc_info:
|
1226
|
+
lats = np.linspace(10, 170, 9) * np.pi / 180.
|
1227
|
+
lons = np.linspace(10, 350, 18) * np.pi / 180.
|
1228
|
+
RectSphereBivariateSpline(lats, lons, data, s=-1)
|
1229
|
+
assert "s should be positive" in str(exc_info.value)
|
1230
|
+
|
1231
|
+
def test_derivatives_grid(self):
|
1232
|
+
y = linspace(0.01, 2*pi-0.01, 7)
|
1233
|
+
x = linspace(0.01, pi-0.01, 7)
|
1234
|
+
z = array([[1,2,1,2,1,2,1],[1,2,1,2,1,2,1],[1,2,3,2,1,2,1],
|
1235
|
+
[1,2,2,2,1,2,1],[1,2,1,2,1,2,1],[1,2,2,2,1,2,1],
|
1236
|
+
[1,2,1,2,1,2,1]])
|
1237
|
+
|
1238
|
+
lut = RectSphereBivariateSpline(x,y,z)
|
1239
|
+
|
1240
|
+
y = linspace(0.02, 2*pi-0.02, 7)
|
1241
|
+
x = linspace(0.02, pi-0.02, 7)
|
1242
|
+
|
1243
|
+
xp_assert_close(lut(x, y, dtheta=1), _numdiff_2d(lut, x, y, dx=1),
|
1244
|
+
rtol=1e-4, atol=1e-4)
|
1245
|
+
xp_assert_close(lut(x, y, dphi=1), _numdiff_2d(lut, x, y, dy=1),
|
1246
|
+
rtol=1e-4, atol=1e-4)
|
1247
|
+
xp_assert_close(lut(x, y, dtheta=1, dphi=1),
|
1248
|
+
_numdiff_2d(lut, x, y, dx=1, dy=1, eps=1e-6),
|
1249
|
+
rtol=1e-3, atol=1e-3)
|
1250
|
+
|
1251
|
+
xp_assert_equal(lut(x, y, dtheta=1),
|
1252
|
+
lut.partial_derivative(1, 0)(x, y))
|
1253
|
+
xp_assert_equal(lut(x, y, dphi=1),
|
1254
|
+
lut.partial_derivative(0, 1)(x, y))
|
1255
|
+
xp_assert_equal(lut(x, y, dtheta=1, dphi=1),
|
1256
|
+
lut.partial_derivative(1, 1)(x, y))
|
1257
|
+
|
1258
|
+
xp_assert_equal(lut(x, y, dtheta=1, grid=False),
|
1259
|
+
lut.partial_derivative(1, 0)(x, y, grid=False))
|
1260
|
+
xp_assert_equal(lut(x, y, dphi=1, grid=False),
|
1261
|
+
lut.partial_derivative(0, 1)(x, y, grid=False))
|
1262
|
+
xp_assert_equal(lut(x, y, dtheta=1, dphi=1, grid=False),
|
1263
|
+
lut.partial_derivative(1, 1)(x, y, grid=False))
|
1264
|
+
|
1265
|
+
def test_derivatives(self):
|
1266
|
+
y = linspace(0.01, 2*pi-0.01, 7)
|
1267
|
+
x = linspace(0.01, pi-0.01, 7)
|
1268
|
+
z = array([[1,2,1,2,1,2,1],[1,2,1,2,1,2,1],[1,2,3,2,1,2,1],
|
1269
|
+
[1,2,2,2,1,2,1],[1,2,1,2,1,2,1],[1,2,2,2,1,2,1],
|
1270
|
+
[1,2,1,2,1,2,1]])
|
1271
|
+
|
1272
|
+
lut = RectSphereBivariateSpline(x,y,z)
|
1273
|
+
|
1274
|
+
y = linspace(0.02, 2*pi-0.02, 7)
|
1275
|
+
x = linspace(0.02, pi-0.02, 7)
|
1276
|
+
|
1277
|
+
assert lut(x, y, dtheta=1, grid=False).shape == x.shape
|
1278
|
+
xp_assert_close(lut(x, y, dtheta=1, grid=False),
|
1279
|
+
_numdiff_2d(lambda x,y: lut(x,y,grid=False), x, y, dx=1),
|
1280
|
+
rtol=1e-4, atol=1e-4)
|
1281
|
+
xp_assert_close(lut(x, y, dphi=1, grid=False),
|
1282
|
+
_numdiff_2d(lambda x,y: lut(x,y,grid=False), x, y, dy=1),
|
1283
|
+
rtol=1e-4, atol=1e-4)
|
1284
|
+
xp_assert_close(lut(x, y, dtheta=1, dphi=1, grid=False),
|
1285
|
+
_numdiff_2d(lambda x,y: lut(x,y,grid=False),
|
1286
|
+
x, y, dx=1, dy=1, eps=1e-6),
|
1287
|
+
rtol=1e-3, atol=1e-3)
|
1288
|
+
|
1289
|
+
def test_invalid_input_2(self):
|
1290
|
+
data = np.dot(np.atleast_2d(90. - np.linspace(-80., 80., 18)).T,
|
1291
|
+
np.atleast_2d(180. - np.abs(np.linspace(0., 350., 9)))).T
|
1292
|
+
|
1293
|
+
with assert_raises(ValueError) as exc_info:
|
1294
|
+
lats = np.linspace(0, 170, 9) * np.pi / 180.
|
1295
|
+
lons = np.linspace(0, 350, 18) * np.pi / 180.
|
1296
|
+
RectSphereBivariateSpline(lats, lons, data)
|
1297
|
+
assert "u should be between (0, pi)" in str(exc_info.value)
|
1298
|
+
|
1299
|
+
with assert_raises(ValueError) as exc_info:
|
1300
|
+
lats = np.linspace(10, 180, 9) * np.pi / 180.
|
1301
|
+
lons = np.linspace(0, 350, 18) * np.pi / 180.
|
1302
|
+
RectSphereBivariateSpline(lats, lons, data)
|
1303
|
+
assert "u should be between (0, pi)" in str(exc_info.value)
|
1304
|
+
|
1305
|
+
with assert_raises(ValueError) as exc_info:
|
1306
|
+
lats = np.linspace(10, 170, 9) * np.pi / 180.
|
1307
|
+
lons = np.linspace(-181, 10, 18) * np.pi / 180.
|
1308
|
+
RectSphereBivariateSpline(lats, lons, data)
|
1309
|
+
assert "v[0] should be between [-pi, pi)" in str(exc_info.value)
|
1310
|
+
|
1311
|
+
with assert_raises(ValueError) as exc_info:
|
1312
|
+
lats = np.linspace(10, 170, 9) * np.pi / 180.
|
1313
|
+
lons = np.linspace(-10, 360, 18) * np.pi / 180.
|
1314
|
+
RectSphereBivariateSpline(lats, lons, data)
|
1315
|
+
assert "v[-1] should be v[0] + 2pi or less" in str(exc_info.value)
|
1316
|
+
|
1317
|
+
with assert_raises(ValueError) as exc_info:
|
1318
|
+
lats = np.linspace(10, 170, 9) * np.pi / 180.
|
1319
|
+
lons = np.linspace(10, 350, 18) * np.pi / 180.
|
1320
|
+
RectSphereBivariateSpline(lats, lons, data, s=-1)
|
1321
|
+
assert "s should be positive" in str(exc_info.value)
|
1322
|
+
|
1323
|
+
def test_array_like_input(self):
|
1324
|
+
y = linspace(0.01, 2 * pi - 0.01, 7)
|
1325
|
+
x = linspace(0.01, pi - 0.01, 7)
|
1326
|
+
z = array([[1, 2, 1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2, 1],
|
1327
|
+
[1, 2, 3, 2, 1, 2, 1],
|
1328
|
+
[1, 2, 2, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2, 1],
|
1329
|
+
[1, 2, 2, 2, 1, 2, 1],
|
1330
|
+
[1, 2, 1, 2, 1, 2, 1]])
|
1331
|
+
# np.array input
|
1332
|
+
spl1 = RectSphereBivariateSpline(x, y, z)
|
1333
|
+
# list input
|
1334
|
+
spl2 = RectSphereBivariateSpline(x.tolist(), y.tolist(), z.tolist())
|
1335
|
+
assert_array_almost_equal(spl1(x, y), spl2(x, y))
|
1336
|
+
|
1337
|
+
def test_negative_evaluation(self):
|
1338
|
+
lats = np.array([25, 30, 35, 40, 45])
|
1339
|
+
lons = np.array([-90, -85, -80, -75, 70])
|
1340
|
+
mesh = np.meshgrid(lats, lons)
|
1341
|
+
data = mesh[0] + mesh[1] # lon + lat value
|
1342
|
+
lat_r = np.radians(lats)
|
1343
|
+
lon_r = np.radians(lons)
|
1344
|
+
interpolator = RectSphereBivariateSpline(lat_r, lon_r, data)
|
1345
|
+
query_lat = np.radians(np.array([35, 37.5]))
|
1346
|
+
query_lon = np.radians(np.array([-80, -77.5]))
|
1347
|
+
data_interp = interpolator(query_lat, query_lon)
|
1348
|
+
ans = np.array([[-45.0, -42.480862],
|
1349
|
+
[-49.0625, -46.54315]])
|
1350
|
+
assert_array_almost_equal(data_interp, ans)
|
1351
|
+
|
1352
|
+
def test_pole_continuity_gh_14591(self):
|
1353
|
+
# regression test for https://github.com/scipy/scipy/issues/14591
|
1354
|
+
# with pole_continuty=(True, True), the internal work array size
|
1355
|
+
# was too small, leading to a FITPACK data validation error.
|
1356
|
+
|
1357
|
+
# The reproducer in gh-14591 was using a NetCDF4 file with
|
1358
|
+
# 361x507 arrays, so here we trivialize array sizes to a minimum
|
1359
|
+
# which still demonstrates the issue.
|
1360
|
+
u = np.arange(1, 10) * np.pi / 10
|
1361
|
+
v = np.arange(1, 10) * np.pi / 10
|
1362
|
+
r = np.zeros((9, 9))
|
1363
|
+
for p in [(True, True), (True, False), (False, False)]:
|
1364
|
+
RectSphereBivariateSpline(u, v, r, s=0, pole_continuity=p)
|
1365
|
+
|
1366
|
+
|
1367
|
+
def _numdiff_2d(func, x, y, dx=0, dy=0, eps=1e-8):
|
1368
|
+
if dx == 0 and dy == 0:
|
1369
|
+
return func(x, y)
|
1370
|
+
elif dx == 1 and dy == 0:
|
1371
|
+
return (func(x + eps, y) - func(x - eps, y)) / (2*eps)
|
1372
|
+
elif dx == 0 and dy == 1:
|
1373
|
+
return (func(x, y + eps) - func(x, y - eps)) / (2*eps)
|
1374
|
+
elif dx == 1 and dy == 1:
|
1375
|
+
return (func(x + eps, y + eps) - func(x - eps, y + eps)
|
1376
|
+
- func(x + eps, y - eps) + func(x - eps, y - eps)) / (2*eps)**2
|
1377
|
+
else:
|
1378
|
+
raise ValueError("invalid derivative order")
|
1379
|
+
|
1380
|
+
|
1381
|
+
class Test_DerivedBivariateSpline:
|
1382
|
+
"""Test the creation, usage, and attribute access of the (private)
|
1383
|
+
_DerivedBivariateSpline class.
|
1384
|
+
"""
|
1385
|
+
def setup_method(self):
|
1386
|
+
x = np.concatenate(list(zip(range(10), range(10))))
|
1387
|
+
y = np.concatenate(list(zip(range(10), range(1, 11))))
|
1388
|
+
z = np.concatenate((np.linspace(3, 1, 10), np.linspace(1, 3, 10)))
|
1389
|
+
with suppress_warnings() as sup:
|
1390
|
+
sup.record(UserWarning, "\nThe coefficients of the spline")
|
1391
|
+
self.lut_lsq = LSQBivariateSpline(x, y, z,
|
1392
|
+
linspace(0.5, 19.5, 4),
|
1393
|
+
linspace(1.5, 20.5, 4),
|
1394
|
+
eps=1e-2)
|
1395
|
+
self.lut_smooth = SmoothBivariateSpline(x, y, z)
|
1396
|
+
xx = linspace(0, 1, 20)
|
1397
|
+
yy = xx + 1.0
|
1398
|
+
zz = array([np.roll(z, i) for i in range(z.size)])
|
1399
|
+
self.lut_rect = RectBivariateSpline(xx, yy, zz)
|
1400
|
+
self.orders = list(itertools.product(range(3), range(3)))
|
1401
|
+
|
1402
|
+
def test_creation_from_LSQ(self):
|
1403
|
+
for nux, nuy in self.orders:
|
1404
|
+
lut_der = self.lut_lsq.partial_derivative(nux, nuy)
|
1405
|
+
a = lut_der(3.5, 3.5, grid=False)
|
1406
|
+
b = self.lut_lsq(3.5, 3.5, dx=nux, dy=nuy, grid=False)
|
1407
|
+
assert a == b
|
1408
|
+
|
1409
|
+
def test_creation_from_Smooth(self):
|
1410
|
+
for nux, nuy in self.orders:
|
1411
|
+
lut_der = self.lut_smooth.partial_derivative(nux, nuy)
|
1412
|
+
a = lut_der(5.5, 5.5, grid=False)
|
1413
|
+
b = self.lut_smooth(5.5, 5.5, dx=nux, dy=nuy, grid=False)
|
1414
|
+
assert a == b
|
1415
|
+
|
1416
|
+
def test_creation_from_Rect(self):
|
1417
|
+
for nux, nuy in self.orders:
|
1418
|
+
lut_der = self.lut_rect.partial_derivative(nux, nuy)
|
1419
|
+
a = lut_der(0.5, 1.5, grid=False)
|
1420
|
+
b = self.lut_rect(0.5, 1.5, dx=nux, dy=nuy, grid=False)
|
1421
|
+
assert a == b
|
1422
|
+
|
1423
|
+
def test_invalid_attribute_fp(self):
|
1424
|
+
der = self.lut_rect.partial_derivative(1, 1)
|
1425
|
+
with assert_raises(AttributeError):
|
1426
|
+
der.fp
|
1427
|
+
|
1428
|
+
def test_invalid_attribute_get_residual(self):
|
1429
|
+
der = self.lut_smooth.partial_derivative(1, 1)
|
1430
|
+
with assert_raises(AttributeError):
|
1431
|
+
der.get_residual()
|