scipy 1.16.2__cp312-cp312-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.cp312-win_arm64.lib +0 -0
- scipy/_cyutility.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/_lib/_ccallback_c.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/_lib/_fpumode.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/_lib/_test_ccallback.cp312-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_call.cp312-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_call.cp312-win_arm64.pyd +0 -0
- scipy/_lib/_test_deprecation_def.cp312-win_arm64.lib +0 -0
- scipy/_lib/_test_deprecation_def.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/_lib/_uarray/_uarray.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/_lib/messagestream.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/cluster/_hierarchy.cp312-win_arm64.pyd +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp312-win_arm64.lib +0 -0
- scipy/cluster/_optimal_leaf_ordering.cp312-win_arm64.pyd +0 -0
- scipy/cluster/_vq.cp312-win_arm64.lib +0 -0
- scipy/cluster/_vq.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/fft/_pocketfft/pypocketfft.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/fftpack/convolve.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/integrate/_dop.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/integrate/_lsoda.cp312-win_arm64.pyd +0 -0
- scipy/integrate/_ode.py +1395 -0
- scipy/integrate/_odepack.cp312-win_arm64.lib +0 -0
- scipy/integrate/_odepack.cp312-win_arm64.pyd +0 -0
- scipy/integrate/_odepack_py.py +273 -0
- scipy/integrate/_quad_vec.py +674 -0
- scipy/integrate/_quadpack.cp312-win_arm64.lib +0 -0
- scipy/integrate/_quadpack.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/integrate/_test_multivariate.cp312-win_arm64.pyd +0 -0
- scipy/integrate/_test_odeint_banded.cp312-win_arm64.lib +0 -0
- scipy/integrate/_test_odeint_banded.cp312-win_arm64.pyd +0 -0
- scipy/integrate/_vode.cp312-win_arm64.lib +0 -0
- scipy/integrate/_vode.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/interpolate/_dfitpack.cp312-win_arm64.pyd +0 -0
- scipy/interpolate/_dierckx.cp312-win_arm64.lib +0 -0
- scipy/interpolate/_dierckx.cp312-win_arm64.pyd +0 -0
- scipy/interpolate/_fitpack.cp312-win_arm64.lib +0 -0
- scipy/interpolate/_fitpack.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/interpolate/_interpnd.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/interpolate/_ppoly.cp312-win_arm64.pyd +0 -0
- scipy/interpolate/_rbf.py +290 -0
- scipy/interpolate/_rbfinterp.py +550 -0
- scipy/interpolate/_rbfinterp_pythran.cp312-win_arm64.lib +0 -0
- scipy/interpolate/_rbfinterp_pythran.cp312-win_arm64.pyd +0 -0
- scipy/interpolate/_rgi.py +764 -0
- scipy/interpolate/_rgi_cython.cp312-win_arm64.lib +0 -0
- scipy/interpolate/_rgi_cython.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/io/_fast_matrix_market/_fmm_core.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/io/_test_fortran.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/io/matlab/_mio5_utils.cp312-win_arm64.pyd +0 -0
- scipy/io/matlab/_mio_utils.cp312-win_arm64.lib +0 -0
- scipy/io/matlab/_mio_utils.cp312-win_arm64.pyd +0 -0
- scipy/io/matlab/_miobase.py +435 -0
- scipy/io/matlab/_streams.cp312-win_arm64.lib +0 -0
- scipy/io/matlab/_streams.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/linalg/_cythonized_array_utils.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/linalg/_decomp_interpolative.cp312-win_arm64.pyd +0 -0
- scipy/linalg/_decomp_ldl.py +356 -0
- scipy/linalg/_decomp_lu.py +401 -0
- scipy/linalg/_decomp_lu_cython.cp312-win_arm64.lib +0 -0
- scipy/linalg/_decomp_lu_cython.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/linalg/_decomp_update.cp312-win_arm64.pyd +0 -0
- scipy/linalg/_expm_frechet.py +417 -0
- scipy/linalg/_fblas.cp312-win_arm64.lib +0 -0
- scipy/linalg/_fblas.cp312-win_arm64.pyd +0 -0
- scipy/linalg/_flapack.cp312-win_arm64.lib +0 -0
- scipy/linalg/_flapack.cp312-win_arm64.pyd +0 -0
- scipy/linalg/_lapack_subroutines.h +1521 -0
- scipy/linalg/_linalg_pythran.cp312-win_arm64.lib +0 -0
- scipy/linalg/_linalg_pythran.cp312-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs.py +1050 -0
- scipy/linalg/_matfuncs_expm.cp312-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_expm.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_schur_sqrtm.cp312-win_arm64.pyd +0 -0
- scipy/linalg/_matfuncs_sqrtm.py +107 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp312-win_arm64.lib +0 -0
- scipy/linalg/_matfuncs_sqrtm_triu.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/linalg/_solve_toeplitz.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/linalg/cython_blas.cp312-win_arm64.pyd +0 -0
- scipy/linalg/cython_blas.pxd +169 -0
- scipy/linalg/cython_blas.pyx +1432 -0
- scipy/linalg/cython_lapack.cp312-win_arm64.lib +0 -0
- scipy/linalg/cython_lapack.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/ndimage/_ctest.cp312-win_arm64.pyd +0 -0
- scipy/ndimage/_cytest.cp312-win_arm64.lib +0 -0
- scipy/ndimage/_cytest.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/ndimage/_nd_image.cp312-win_arm64.pyd +0 -0
- scipy/ndimage/_ndimage_api.py +16 -0
- scipy/ndimage/_ni_docstrings.py +214 -0
- scipy/ndimage/_ni_label.cp312-win_arm64.lib +0 -0
- scipy/ndimage/_ni_label.cp312-win_arm64.pyd +0 -0
- scipy/ndimage/_ni_support.py +139 -0
- scipy/ndimage/_rank_filter_1d.cp312-win_arm64.lib +0 -0
- scipy/ndimage/_rank_filter_1d.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/odr/__odrpack.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_bglu_dense.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_direct.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_group_columns.cp312-win_arm64.pyd +0 -0
- scipy/optimize/_hessian_update_strategy.py +479 -0
- scipy/optimize/_highspy/__init__.py +0 -0
- scipy/optimize/_highspy/_core.cp312-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_core.cp312-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_options.cp312-win_arm64.lib +0 -0
- scipy/optimize/_highspy/_highs_options.cp312-win_arm64.pyd +0 -0
- scipy/optimize/_highspy/_highs_wrapper.py +338 -0
- scipy/optimize/_isotonic.py +157 -0
- scipy/optimize/_lbfgsb.cp312-win_arm64.lib +0 -0
- scipy/optimize/_lbfgsb.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_lsap.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_lsq/givens_elimination.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_minpack.cp312-win_arm64.pyd +0 -0
- scipy/optimize/_minpack_py.py +1178 -0
- scipy/optimize/_moduleTNC.cp312-win_arm64.lib +0 -0
- scipy/optimize/_moduleTNC.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_pava_pybind.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_slsqplib.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_trlib/_trlib.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/_zeros.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/optimize/cython_optimize/_zeros.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/signal/_max_len_seq_inner.cp312-win_arm64.pyd +0 -0
- scipy/signal/_peak_finding.py +1310 -0
- scipy/signal/_peak_finding_utils.cp312-win_arm64.lib +0 -0
- scipy/signal/_peak_finding_utils.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/signal/_sigtools.cp312-win_arm64.pyd +0 -0
- scipy/signal/_sosfilt.cp312-win_arm64.lib +0 -0
- scipy/signal/_sosfilt.cp312-win_arm64.pyd +0 -0
- scipy/signal/_spectral_py.py +2471 -0
- scipy/signal/_spline.cp312-win_arm64.lib +0 -0
- scipy/signal/_spline.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/signal/_upfirdn_apply.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/sparse/_csparsetools.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/sparse/_sparsetools.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_flow.cp312-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_laplacian.py +563 -0
- scipy/sparse/csgraph/_matching.cp312-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_matching.cp312-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp312-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_min_spanning_tree.cp312-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_reordering.cp312-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_reordering.cp312-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_shortest_path.cp312-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_shortest_path.cp312-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_tools.cp312-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_tools.cp312-win_arm64.pyd +0 -0
- scipy/sparse/csgraph/_traversal.cp312-win_arm64.lib +0 -0
- scipy/sparse/csgraph/_traversal.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/sparse/linalg/_dsolve/_superlu.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/sparse/linalg/_eigen/arpack/_arpack.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_cpropack.cp312-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp312-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_dpropack.cp312-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp312-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_spropack.cp312-win_arm64.pyd +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp312-win_arm64.lib +0 -0
- scipy/sparse/linalg/_propack/_zpropack.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/spatial/_ckdtree.cp312-win_arm64.pyd +0 -0
- scipy/spatial/_distance_pybind.cp312-win_arm64.lib +0 -0
- scipy/spatial/_distance_pybind.cp312-win_arm64.pyd +0 -0
- scipy/spatial/_distance_wrap.cp312-win_arm64.lib +0 -0
- scipy/spatial/_distance_wrap.cp312-win_arm64.pyd +0 -0
- scipy/spatial/_geometric_slerp.py +238 -0
- scipy/spatial/_hausdorff.cp312-win_arm64.lib +0 -0
- scipy/spatial/_hausdorff.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/spatial/_qhull.cp312-win_arm64.pyd +0 -0
- scipy/spatial/_qhull.pyi +213 -0
- scipy/spatial/_spherical_voronoi.py +341 -0
- scipy/spatial/_voronoi.cp312-win_arm64.lib +0 -0
- scipy/spatial/_voronoi.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/spatial/transform/_rigid_transform.cp312-win_arm64.pyd +0 -0
- scipy/spatial/transform/_rotation.cp312-win_arm64.lib +0 -0
- scipy/spatial/transform/_rotation.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/special/_comb.cp312-win_arm64.pyd +0 -0
- scipy/special/_ellip_harm.py +214 -0
- scipy/special/_ellip_harm_2.cp312-win_arm64.lib +0 -0
- scipy/special/_ellip_harm_2.cp312-win_arm64.pyd +0 -0
- scipy/special/_gufuncs.cp312-win_arm64.lib +0 -0
- scipy/special/_gufuncs.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/special/_specfun.cp312-win_arm64.pyd +0 -0
- scipy/special/_special_ufuncs.cp312-win_arm64.lib +0 -0
- scipy/special/_special_ufuncs.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/special/_test_internal.cp312-win_arm64.pyd +0 -0
- scipy/special/_test_internal.pyi +9 -0
- scipy/special/_testutils.py +321 -0
- scipy/special/_ufuncs.cp312-win_arm64.lib +0 -0
- scipy/special/_ufuncs.cp312-win_arm64.pyd +0 -0
- scipy/special/_ufuncs.pyi +522 -0
- scipy/special/_ufuncs.pyx +13173 -0
- scipy/special/_ufuncs_cxx.cp312-win_arm64.lib +0 -0
- scipy/special/_ufuncs_cxx.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/special/cython_special.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/stats/_ansari_swilk_statistics.cp312-win_arm64.pyd +0 -0
- scipy/stats/_axis_nan_policy.py +692 -0
- scipy/stats/_biasedurn.cp312-win_arm64.lib +0 -0
- scipy/stats/_biasedurn.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/stats/_levy_stable/levyst.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/stats/_qmc_cy.cp312-win_arm64.pyd +0 -0
- scipy/stats/_qmc_cy.pyi +54 -0
- scipy/stats/_qmvnt.py +454 -0
- scipy/stats/_qmvnt_cy.cp312-win_arm64.lib +0 -0
- scipy/stats/_qmvnt_cy.cp312-win_arm64.pyd +0 -0
- scipy/stats/_quantile.py +335 -0
- scipy/stats/_rcont/__init__.py +4 -0
- scipy/stats/_rcont/rcont.cp312-win_arm64.lib +0 -0
- scipy/stats/_rcont/rcont.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/stats/_sobol.cp312-win_arm64.pyd +0 -0
- scipy/stats/_sobol.pyi +54 -0
- scipy/stats/_sobol_direction_numbers.npz +0 -0
- scipy/stats/_stats.cp312-win_arm64.lib +0 -0
- scipy/stats/_stats.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/stats/_stats_pythran.cp312-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.cp312-win_arm64.lib +0 -0
- scipy/stats/_unuran/unuran_wrapper.cp312-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,1689 @@
|
|
1
|
+
# Copyright (C) 2003-2005 Peter J. Verveer
|
2
|
+
#
|
3
|
+
# Redistribution and use in source and binary forms, with or without
|
4
|
+
# modification, are permitted provided that the following conditions
|
5
|
+
# are met:
|
6
|
+
#
|
7
|
+
# 1. Redistributions of source code must retain the above copyright
|
8
|
+
# notice, this list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# 2. Redistributions in binary form must reproduce the above
|
11
|
+
# copyright notice, this list of conditions and the following
|
12
|
+
# disclaimer in the documentation and/or other materials provided
|
13
|
+
# with the distribution.
|
14
|
+
#
|
15
|
+
# 3. The name of the author may not be used to endorse or promote
|
16
|
+
# products derived from this software without specific prior
|
17
|
+
# written permission.
|
18
|
+
#
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
20
|
+
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
23
|
+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
25
|
+
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
27
|
+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
28
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
import numpy as np
|
32
|
+
from . import _ni_support
|
33
|
+
from . import _ni_label
|
34
|
+
from . import _nd_image
|
35
|
+
from . import _morphology
|
36
|
+
|
37
|
+
__all__ = ['label', 'find_objects', 'labeled_comprehension', 'sum', 'mean',
|
38
|
+
'variance', 'standard_deviation', 'minimum', 'maximum', 'median',
|
39
|
+
'minimum_position', 'maximum_position', 'extrema', 'center_of_mass',
|
40
|
+
'histogram', 'watershed_ift', 'sum_labels', 'value_indices']
|
41
|
+
|
42
|
+
|
43
|
+
def label(input, structure=None, output=None):
|
44
|
+
"""
|
45
|
+
Label features in an array.
|
46
|
+
|
47
|
+
Parameters
|
48
|
+
----------
|
49
|
+
input : array_like
|
50
|
+
An array-like object to be labeled. Any non-zero values in `input` are
|
51
|
+
counted as features and zero values are considered the background.
|
52
|
+
structure : array_like, optional
|
53
|
+
A structuring element that defines feature connections.
|
54
|
+
`structure` must be centrosymmetric
|
55
|
+
(see Notes).
|
56
|
+
If no structuring element is provided,
|
57
|
+
one is automatically generated with a squared connectivity equal to
|
58
|
+
one. That is, for a 2-D `input` array, the default structuring element
|
59
|
+
is::
|
60
|
+
|
61
|
+
[[0,1,0],
|
62
|
+
[1,1,1],
|
63
|
+
[0,1,0]]
|
64
|
+
|
65
|
+
output : (None, data-type, array_like), optional
|
66
|
+
If `output` is a data type, it specifies the type of the resulting
|
67
|
+
labeled feature array.
|
68
|
+
If `output` is an array-like object, then `output` will be updated
|
69
|
+
with the labeled features from this function. This function can
|
70
|
+
operate in-place, by passing output=input.
|
71
|
+
Note that the output must be able to store the largest label, or this
|
72
|
+
function will raise an Exception.
|
73
|
+
|
74
|
+
Returns
|
75
|
+
-------
|
76
|
+
label : ndarray or int
|
77
|
+
An integer ndarray where each unique feature in `input` has a unique
|
78
|
+
label in the returned array.
|
79
|
+
num_features : int
|
80
|
+
How many objects were found.
|
81
|
+
|
82
|
+
If `output` is None, this function returns a tuple of
|
83
|
+
(`labeled_array`, `num_features`).
|
84
|
+
|
85
|
+
If `output` is a ndarray, then it will be updated with values in
|
86
|
+
`labeled_array` and only `num_features` will be returned by this
|
87
|
+
function.
|
88
|
+
|
89
|
+
See Also
|
90
|
+
--------
|
91
|
+
find_objects : generate a list of slices for the labeled features (or
|
92
|
+
objects); useful for finding features' position or
|
93
|
+
dimensions
|
94
|
+
|
95
|
+
Notes
|
96
|
+
-----
|
97
|
+
A centrosymmetric matrix is a matrix that is symmetric about the center.
|
98
|
+
See [1]_ for more information.
|
99
|
+
|
100
|
+
The `structure` matrix must be centrosymmetric to ensure
|
101
|
+
two-way connections.
|
102
|
+
For instance, if the `structure` matrix is not centrosymmetric
|
103
|
+
and is defined as::
|
104
|
+
|
105
|
+
[[0,1,0],
|
106
|
+
[1,1,0],
|
107
|
+
[0,0,0]]
|
108
|
+
|
109
|
+
and the `input` is::
|
110
|
+
|
111
|
+
[[1,2],
|
112
|
+
[0,3]]
|
113
|
+
|
114
|
+
then the structure matrix would indicate the
|
115
|
+
entry 2 in the input is connected to 1,
|
116
|
+
but 1 is not connected to 2.
|
117
|
+
|
118
|
+
References
|
119
|
+
----------
|
120
|
+
.. [1] James R. Weaver, "Centrosymmetric (cross-symmetric)
|
121
|
+
matrices, their basic properties, eigenvalues, and
|
122
|
+
eigenvectors." The American Mathematical Monthly 92.10
|
123
|
+
(1985): 711-717.
|
124
|
+
|
125
|
+
Examples
|
126
|
+
--------
|
127
|
+
Create an image with some features, then label it using the default
|
128
|
+
(cross-shaped) structuring element:
|
129
|
+
|
130
|
+
>>> from scipy.ndimage import label, generate_binary_structure
|
131
|
+
>>> import numpy as np
|
132
|
+
>>> a = np.array([[0,0,1,1,0,0],
|
133
|
+
... [0,0,0,1,0,0],
|
134
|
+
... [1,1,0,0,1,0],
|
135
|
+
... [0,0,0,1,0,0]])
|
136
|
+
>>> labeled_array, num_features = label(a)
|
137
|
+
|
138
|
+
Each of the 4 features are labeled with a different integer:
|
139
|
+
|
140
|
+
>>> num_features
|
141
|
+
4
|
142
|
+
>>> labeled_array
|
143
|
+
array([[0, 0, 1, 1, 0, 0],
|
144
|
+
[0, 0, 0, 1, 0, 0],
|
145
|
+
[2, 2, 0, 0, 3, 0],
|
146
|
+
[0, 0, 0, 4, 0, 0]], dtype=int32)
|
147
|
+
|
148
|
+
Generate a structuring element that will consider features connected even
|
149
|
+
if they touch diagonally:
|
150
|
+
|
151
|
+
>>> s = generate_binary_structure(2,2)
|
152
|
+
|
153
|
+
or,
|
154
|
+
|
155
|
+
>>> s = [[1,1,1],
|
156
|
+
... [1,1,1],
|
157
|
+
... [1,1,1]]
|
158
|
+
|
159
|
+
Label the image using the new structuring element:
|
160
|
+
|
161
|
+
>>> labeled_array, num_features = label(a, structure=s)
|
162
|
+
|
163
|
+
Show the 2 labeled features (note that features 1, 3, and 4 from above are
|
164
|
+
now considered a single feature):
|
165
|
+
|
166
|
+
>>> num_features
|
167
|
+
2
|
168
|
+
>>> labeled_array
|
169
|
+
array([[0, 0, 1, 1, 0, 0],
|
170
|
+
[0, 0, 0, 1, 0, 0],
|
171
|
+
[2, 2, 0, 0, 1, 0],
|
172
|
+
[0, 0, 0, 1, 0, 0]], dtype=int32)
|
173
|
+
|
174
|
+
"""
|
175
|
+
input = np.asarray(input)
|
176
|
+
if np.iscomplexobj(input):
|
177
|
+
raise TypeError('Complex type not supported')
|
178
|
+
if structure is None:
|
179
|
+
structure = _morphology.generate_binary_structure(input.ndim, 1)
|
180
|
+
structure = np.asarray(structure, dtype=bool)
|
181
|
+
if structure.ndim != input.ndim:
|
182
|
+
raise RuntimeError('structure and input must have equal rank')
|
183
|
+
for ii in structure.shape:
|
184
|
+
if ii != 3:
|
185
|
+
raise ValueError('structure dimensions must be equal to 3')
|
186
|
+
|
187
|
+
# Use 32 bits if it's large enough for this image.
|
188
|
+
# _ni_label.label() needs two entries for background and
|
189
|
+
# foreground tracking
|
190
|
+
need_64bits = input.size >= (2**31 - 2)
|
191
|
+
|
192
|
+
if isinstance(output, np.ndarray):
|
193
|
+
if output.shape != input.shape:
|
194
|
+
raise ValueError("output shape not correct")
|
195
|
+
caller_provided_output = True
|
196
|
+
else:
|
197
|
+
caller_provided_output = False
|
198
|
+
if output is None:
|
199
|
+
output = np.empty(input.shape, np.intp if need_64bits else np.int32)
|
200
|
+
else:
|
201
|
+
output = np.empty(input.shape, output)
|
202
|
+
|
203
|
+
# handle scalars, 0-D arrays
|
204
|
+
if input.ndim == 0 or input.size == 0:
|
205
|
+
if input.ndim == 0:
|
206
|
+
# scalar
|
207
|
+
maxlabel = 1 if (input != 0) else 0
|
208
|
+
output[...] = maxlabel
|
209
|
+
else:
|
210
|
+
# 0-D
|
211
|
+
maxlabel = 0
|
212
|
+
if caller_provided_output:
|
213
|
+
return maxlabel
|
214
|
+
else:
|
215
|
+
return output, maxlabel
|
216
|
+
|
217
|
+
try:
|
218
|
+
max_label = _ni_label._label(input, structure, output)
|
219
|
+
except _ni_label.NeedMoreBits as e:
|
220
|
+
# Make another attempt with enough bits, then try to cast to the
|
221
|
+
# new type.
|
222
|
+
tmp_output = np.empty(input.shape, np.intp if need_64bits else np.int32)
|
223
|
+
max_label = _ni_label._label(input, structure, tmp_output)
|
224
|
+
output[...] = tmp_output[...]
|
225
|
+
if not np.all(output == tmp_output):
|
226
|
+
# refuse to return bad results
|
227
|
+
raise RuntimeError(
|
228
|
+
"insufficient bit-depth in requested output type"
|
229
|
+
) from e
|
230
|
+
|
231
|
+
if caller_provided_output:
|
232
|
+
# result was written in-place
|
233
|
+
return max_label
|
234
|
+
else:
|
235
|
+
return output, max_label
|
236
|
+
|
237
|
+
|
238
|
+
def find_objects(input, max_label=0):
|
239
|
+
"""
|
240
|
+
Find objects in a labeled array.
|
241
|
+
|
242
|
+
Parameters
|
243
|
+
----------
|
244
|
+
input : ndarray of ints
|
245
|
+
Array containing objects defined by different labels. Labels with
|
246
|
+
value 0 are ignored.
|
247
|
+
max_label : int, optional
|
248
|
+
Maximum label to be searched for in `input`. If max_label is not
|
249
|
+
given, the positions of all objects are returned.
|
250
|
+
|
251
|
+
Returns
|
252
|
+
-------
|
253
|
+
object_slices : list of tuples
|
254
|
+
A list of tuples, with each tuple containing N slices (with N the
|
255
|
+
dimension of the input array). Slices correspond to the minimal
|
256
|
+
parallelepiped that contains the object. If a number is missing,
|
257
|
+
None is returned instead of a slice. The label ``l`` corresponds to
|
258
|
+
the index ``l-1`` in the returned list.
|
259
|
+
|
260
|
+
See Also
|
261
|
+
--------
|
262
|
+
label, center_of_mass
|
263
|
+
|
264
|
+
Notes
|
265
|
+
-----
|
266
|
+
This function is very useful for isolating a volume of interest inside
|
267
|
+
a 3-D array, that cannot be "seen through".
|
268
|
+
|
269
|
+
Examples
|
270
|
+
--------
|
271
|
+
>>> from scipy import ndimage
|
272
|
+
>>> import numpy as np
|
273
|
+
>>> a = np.zeros((6,6), dtype=int)
|
274
|
+
>>> a[2:4, 2:4] = 1
|
275
|
+
>>> a[4, 4] = 1
|
276
|
+
>>> a[:2, :3] = 2
|
277
|
+
>>> a[0, 5] = 3
|
278
|
+
>>> a
|
279
|
+
array([[2, 2, 2, 0, 0, 3],
|
280
|
+
[2, 2, 2, 0, 0, 0],
|
281
|
+
[0, 0, 1, 1, 0, 0],
|
282
|
+
[0, 0, 1, 1, 0, 0],
|
283
|
+
[0, 0, 0, 0, 1, 0],
|
284
|
+
[0, 0, 0, 0, 0, 0]])
|
285
|
+
>>> ndimage.find_objects(a)
|
286
|
+
[(slice(2, 5, None), slice(2, 5, None)),
|
287
|
+
(slice(0, 2, None), slice(0, 3, None)),
|
288
|
+
(slice(0, 1, None), slice(5, 6, None))]
|
289
|
+
>>> ndimage.find_objects(a, max_label=2)
|
290
|
+
[(slice(2, 5, None), slice(2, 5, None)), (slice(0, 2, None), slice(0, 3, None))]
|
291
|
+
>>> ndimage.find_objects(a == 1, max_label=2)
|
292
|
+
[(slice(2, 5, None), slice(2, 5, None)), None]
|
293
|
+
|
294
|
+
>>> loc = ndimage.find_objects(a)[0]
|
295
|
+
>>> a[loc]
|
296
|
+
array([[1, 1, 0],
|
297
|
+
[1, 1, 0],
|
298
|
+
[0, 0, 1]])
|
299
|
+
|
300
|
+
"""
|
301
|
+
input = np.asarray(input)
|
302
|
+
if np.iscomplexobj(input):
|
303
|
+
raise TypeError('Complex type not supported')
|
304
|
+
|
305
|
+
if max_label < 1:
|
306
|
+
max_label = input.max()
|
307
|
+
|
308
|
+
return _nd_image.find_objects(input, max_label)
|
309
|
+
|
310
|
+
|
311
|
+
def value_indices(arr, *, ignore_value=None):
|
312
|
+
"""
|
313
|
+
Find indices of each distinct value in given array.
|
314
|
+
|
315
|
+
Parameters
|
316
|
+
----------
|
317
|
+
arr : ndarray of ints
|
318
|
+
Array containing integer values.
|
319
|
+
ignore_value : int, optional
|
320
|
+
This value will be ignored in searching the `arr` array. If not
|
321
|
+
given, all values found will be included in output. Default
|
322
|
+
is None.
|
323
|
+
|
324
|
+
Returns
|
325
|
+
-------
|
326
|
+
indices : dictionary
|
327
|
+
A Python dictionary of array indices for each distinct value. The
|
328
|
+
dictionary is keyed by the distinct values, the entries are array
|
329
|
+
index tuples covering all occurrences of the value within the
|
330
|
+
array.
|
331
|
+
|
332
|
+
This dictionary can occupy significant memory, usually several times
|
333
|
+
the size of the input array.
|
334
|
+
|
335
|
+
See Also
|
336
|
+
--------
|
337
|
+
label, maximum, median, minimum_position, extrema, sum, mean, variance,
|
338
|
+
standard_deviation, numpy.where, numpy.unique
|
339
|
+
|
340
|
+
Notes
|
341
|
+
-----
|
342
|
+
For a small array with few distinct values, one might use
|
343
|
+
`numpy.unique()` to find all possible values, and ``(arr == val)`` to
|
344
|
+
locate each value within that array. However, for large arrays,
|
345
|
+
with many distinct values, this can become extremely inefficient,
|
346
|
+
as locating each value would require a new search through the entire
|
347
|
+
array. Using this function, there is essentially one search, with
|
348
|
+
the indices saved for all distinct values.
|
349
|
+
|
350
|
+
This is useful when matching a categorical image (e.g. a segmentation
|
351
|
+
or classification) to an associated image of other data, allowing
|
352
|
+
any per-class statistic(s) to then be calculated. Provides a
|
353
|
+
more flexible alternative to functions like ``scipy.ndimage.mean()``
|
354
|
+
and ``scipy.ndimage.variance()``.
|
355
|
+
|
356
|
+
Some other closely related functionality, with different strengths and
|
357
|
+
weaknesses, can also be found in ``scipy.stats.binned_statistic()`` and
|
358
|
+
the `scikit-image <https://scikit-image.org/>`_ function
|
359
|
+
``skimage.measure.regionprops()``.
|
360
|
+
|
361
|
+
Note for IDL users: this provides functionality equivalent to IDL's
|
362
|
+
REVERSE_INDICES option (as per the IDL documentation for the
|
363
|
+
`HISTOGRAM <https://www.l3harrisgeospatial.com/docs/histogram.html>`_
|
364
|
+
function).
|
365
|
+
|
366
|
+
.. versionadded:: 1.10.0
|
367
|
+
|
368
|
+
Examples
|
369
|
+
--------
|
370
|
+
>>> import numpy as np
|
371
|
+
>>> from scipy import ndimage
|
372
|
+
>>> a = np.zeros((6, 6), dtype=int)
|
373
|
+
>>> a[2:4, 2:4] = 1
|
374
|
+
>>> a[4, 4] = 1
|
375
|
+
>>> a[:2, :3] = 2
|
376
|
+
>>> a[0, 5] = 3
|
377
|
+
>>> a
|
378
|
+
array([[2, 2, 2, 0, 0, 3],
|
379
|
+
[2, 2, 2, 0, 0, 0],
|
380
|
+
[0, 0, 1, 1, 0, 0],
|
381
|
+
[0, 0, 1, 1, 0, 0],
|
382
|
+
[0, 0, 0, 0, 1, 0],
|
383
|
+
[0, 0, 0, 0, 0, 0]])
|
384
|
+
>>> val_indices = ndimage.value_indices(a)
|
385
|
+
|
386
|
+
The dictionary `val_indices` will have an entry for each distinct
|
387
|
+
value in the input array.
|
388
|
+
|
389
|
+
>>> val_indices.keys()
|
390
|
+
dict_keys([np.int64(0), np.int64(1), np.int64(2), np.int64(3)])
|
391
|
+
|
392
|
+
The entry for each value is an index tuple, locating the elements
|
393
|
+
with that value.
|
394
|
+
|
395
|
+
>>> ndx1 = val_indices[1]
|
396
|
+
>>> ndx1
|
397
|
+
(array([2, 2, 3, 3, 4]), array([2, 3, 2, 3, 4]))
|
398
|
+
|
399
|
+
This can be used to index into the original array, or any other
|
400
|
+
array with the same shape.
|
401
|
+
|
402
|
+
>>> a[ndx1]
|
403
|
+
array([1, 1, 1, 1, 1])
|
404
|
+
|
405
|
+
If the zeros were to be ignored, then the resulting dictionary
|
406
|
+
would no longer have an entry for zero.
|
407
|
+
|
408
|
+
>>> val_indices = ndimage.value_indices(a, ignore_value=0)
|
409
|
+
>>> val_indices.keys()
|
410
|
+
dict_keys([np.int64(1), np.int64(2), np.int64(3)])
|
411
|
+
|
412
|
+
"""
|
413
|
+
# Cope with ignore_value being None, without too much extra complexity
|
414
|
+
# in the C code. If not None, the value is passed in as a numpy array
|
415
|
+
# with the same dtype as arr.
|
416
|
+
arr = np.asarray(arr)
|
417
|
+
ignore_value_arr = np.zeros((1,), dtype=arr.dtype)
|
418
|
+
ignoreIsNone = (ignore_value is None)
|
419
|
+
if not ignoreIsNone:
|
420
|
+
ignore_value_arr[0] = ignore_value_arr.dtype.type(ignore_value)
|
421
|
+
|
422
|
+
val_indices = _nd_image.value_indices(arr, ignoreIsNone, ignore_value_arr)
|
423
|
+
return val_indices
|
424
|
+
|
425
|
+
|
426
|
+
def labeled_comprehension(input, labels, index, func, out_dtype, default,
|
427
|
+
pass_positions=False):
|
428
|
+
"""
|
429
|
+
Roughly equivalent to [func(input[labels == i]) for i in index].
|
430
|
+
|
431
|
+
Sequentially applies an arbitrary function (that works on array_like input)
|
432
|
+
to subsets of an N-D image array specified by `labels` and `index`.
|
433
|
+
The option exists to provide the function with positional parameters as the
|
434
|
+
second argument.
|
435
|
+
|
436
|
+
Parameters
|
437
|
+
----------
|
438
|
+
input : array_like
|
439
|
+
Data from which to select `labels` to process.
|
440
|
+
labels : array_like or None
|
441
|
+
Labels to objects in `input`.
|
442
|
+
If not None, array must be same shape as `input`.
|
443
|
+
If None, `func` is applied to raveled `input`.
|
444
|
+
index : int, sequence of ints or None
|
445
|
+
Subset of `labels` to which to apply `func`.
|
446
|
+
If a scalar, a single value is returned.
|
447
|
+
If None, `func` is applied to all non-zero values of `labels`.
|
448
|
+
func : callable
|
449
|
+
Python function to apply to `labels` from `input`.
|
450
|
+
out_dtype : dtype
|
451
|
+
Dtype to use for `result`.
|
452
|
+
default : int, float or None
|
453
|
+
Default return value when a element of `index` does not exist
|
454
|
+
in `labels`.
|
455
|
+
pass_positions : bool, optional
|
456
|
+
If True, pass linear indices to `func` as a second argument.
|
457
|
+
Default is False.
|
458
|
+
|
459
|
+
Returns
|
460
|
+
-------
|
461
|
+
result : ndarray
|
462
|
+
Result of applying `func` to each of `labels` to `input` in `index`.
|
463
|
+
|
464
|
+
Examples
|
465
|
+
--------
|
466
|
+
>>> import numpy as np
|
467
|
+
>>> a = np.array([[1, 2, 0, 0],
|
468
|
+
... [5, 3, 0, 4],
|
469
|
+
... [0, 0, 0, 7],
|
470
|
+
... [9, 3, 0, 0]])
|
471
|
+
>>> from scipy import ndimage
|
472
|
+
>>> lbl, nlbl = ndimage.label(a)
|
473
|
+
>>> lbls = np.arange(1, nlbl+1)
|
474
|
+
>>> ndimage.labeled_comprehension(a, lbl, lbls, np.mean, float, 0)
|
475
|
+
array([ 2.75, 5.5 , 6. ])
|
476
|
+
|
477
|
+
Falling back to `default`:
|
478
|
+
|
479
|
+
>>> lbls = np.arange(1, nlbl+2)
|
480
|
+
>>> ndimage.labeled_comprehension(a, lbl, lbls, np.mean, float, -1)
|
481
|
+
array([ 2.75, 5.5 , 6. , -1. ])
|
482
|
+
|
483
|
+
Passing positions:
|
484
|
+
|
485
|
+
>>> def fn(val, pos):
|
486
|
+
... print("fn says: %s : %s" % (val, pos))
|
487
|
+
... return (val.sum()) if (pos.sum() % 2 == 0) else (-val.sum())
|
488
|
+
...
|
489
|
+
>>> ndimage.labeled_comprehension(a, lbl, lbls, fn, float, 0, True)
|
490
|
+
fn says: [1 2 5 3] : [0 1 4 5]
|
491
|
+
fn says: [4 7] : [ 7 11]
|
492
|
+
fn says: [9 3] : [12 13]
|
493
|
+
array([ 11., 11., -12., 0.])
|
494
|
+
|
495
|
+
"""
|
496
|
+
|
497
|
+
as_scalar = np.isscalar(index)
|
498
|
+
input = np.asarray(input)
|
499
|
+
|
500
|
+
if pass_positions:
|
501
|
+
positions = np.arange(input.size).reshape(input.shape)
|
502
|
+
|
503
|
+
if labels is None:
|
504
|
+
if index is not None:
|
505
|
+
raise ValueError("index without defined labels")
|
506
|
+
if not pass_positions:
|
507
|
+
return func(input.ravel())
|
508
|
+
else:
|
509
|
+
return func(input.ravel(), positions.ravel())
|
510
|
+
|
511
|
+
labels = np.asarray(labels)
|
512
|
+
|
513
|
+
try:
|
514
|
+
input, labels = np.broadcast_arrays(input, labels)
|
515
|
+
except ValueError as e:
|
516
|
+
raise ValueError("input and labels must have the same shape "
|
517
|
+
"(excepting dimensions with width 1)") from e
|
518
|
+
|
519
|
+
if index is None:
|
520
|
+
if not pass_positions:
|
521
|
+
return func(input[labels > 0])
|
522
|
+
else:
|
523
|
+
return func(input[labels > 0], positions[labels > 0])
|
524
|
+
|
525
|
+
index = np.atleast_1d(index)
|
526
|
+
if np.any(index.astype(labels.dtype).astype(index.dtype) != index):
|
527
|
+
raise ValueError(f"Cannot convert index values from <{index.dtype}> to "
|
528
|
+
f"<{labels.dtype}> (labels' type) without loss of precision")
|
529
|
+
|
530
|
+
index = index.astype(labels.dtype)
|
531
|
+
|
532
|
+
# optimization: find min/max in index,
|
533
|
+
# and select those parts of labels, input, and positions
|
534
|
+
lo = index.min()
|
535
|
+
hi = index.max()
|
536
|
+
mask = (labels >= lo) & (labels <= hi)
|
537
|
+
|
538
|
+
# this also ravels the arrays
|
539
|
+
labels = labels[mask]
|
540
|
+
input = input[mask]
|
541
|
+
if pass_positions:
|
542
|
+
positions = positions[mask]
|
543
|
+
|
544
|
+
# sort everything by labels
|
545
|
+
label_order = labels.argsort()
|
546
|
+
labels = labels[label_order]
|
547
|
+
input = input[label_order]
|
548
|
+
if pass_positions:
|
549
|
+
positions = positions[label_order]
|
550
|
+
|
551
|
+
index_order = index.argsort()
|
552
|
+
sorted_index = index[index_order]
|
553
|
+
|
554
|
+
def do_map(inputs, output):
|
555
|
+
"""labels must be sorted"""
|
556
|
+
nidx = sorted_index.size
|
557
|
+
|
558
|
+
# Find boundaries for each stretch of constant labels
|
559
|
+
# This could be faster, but we already paid N log N to sort labels.
|
560
|
+
lo = np.searchsorted(labels, sorted_index, side='left')
|
561
|
+
hi = np.searchsorted(labels, sorted_index, side='right')
|
562
|
+
|
563
|
+
for i, l, h in zip(range(nidx), lo, hi):
|
564
|
+
if l == h:
|
565
|
+
continue
|
566
|
+
output[i] = func(*[inp[l:h] for inp in inputs])
|
567
|
+
|
568
|
+
temp = np.empty(index.shape, out_dtype)
|
569
|
+
temp[:] = default
|
570
|
+
if not pass_positions:
|
571
|
+
do_map([input], temp)
|
572
|
+
else:
|
573
|
+
do_map([input, positions], temp)
|
574
|
+
|
575
|
+
output = np.zeros(index.shape, out_dtype)
|
576
|
+
output[index_order] = temp
|
577
|
+
if as_scalar:
|
578
|
+
output = output[0]
|
579
|
+
|
580
|
+
return output
|
581
|
+
|
582
|
+
|
583
|
+
def _safely_castable_to_int(dt):
|
584
|
+
"""Test whether the NumPy data type `dt` can be safely cast to an int."""
|
585
|
+
int_size = np.dtype(int).itemsize
|
586
|
+
safe = ((np.issubdtype(dt, np.signedinteger) and dt.itemsize <= int_size) or
|
587
|
+
(np.issubdtype(dt, np.unsignedinteger) and dt.itemsize < int_size))
|
588
|
+
return safe
|
589
|
+
|
590
|
+
|
591
|
+
def _stats(input, labels=None, index=None, centered=False):
|
592
|
+
"""Count, sum, and optionally compute (sum - centre)^2 of input by label
|
593
|
+
|
594
|
+
Parameters
|
595
|
+
----------
|
596
|
+
input : array_like, N-D
|
597
|
+
The input data to be analyzed.
|
598
|
+
labels : array_like (N-D), optional
|
599
|
+
The labels of the data in `input`. This array must be broadcast
|
600
|
+
compatible with `input`; typically, it is the same shape as `input`.
|
601
|
+
If `labels` is None, all nonzero values in `input` are treated as
|
602
|
+
the single labeled group.
|
603
|
+
index : label or sequence of labels, optional
|
604
|
+
These are the labels of the groups for which the stats are computed.
|
605
|
+
If `index` is None, the stats are computed for the single group where
|
606
|
+
`labels` is greater than 0.
|
607
|
+
centered : bool, optional
|
608
|
+
If True, the centered sum of squares for each labeled group is
|
609
|
+
also returned. Default is False.
|
610
|
+
|
611
|
+
Returns
|
612
|
+
-------
|
613
|
+
counts : int or ndarray of ints
|
614
|
+
The number of elements in each labeled group.
|
615
|
+
sums : scalar or ndarray of scalars
|
616
|
+
The sums of the values in each labeled group.
|
617
|
+
sums_c : scalar or ndarray of scalars, optional
|
618
|
+
The sums of mean-centered squares of the values in each labeled group.
|
619
|
+
This is only returned if `centered` is True.
|
620
|
+
|
621
|
+
"""
|
622
|
+
def single_group(vals):
|
623
|
+
if centered:
|
624
|
+
vals_c = vals - vals.mean()
|
625
|
+
return vals.size, vals.sum(), (vals_c * vals_c.conjugate()).sum()
|
626
|
+
else:
|
627
|
+
return vals.size, vals.sum()
|
628
|
+
|
629
|
+
input = np.asarray(input)
|
630
|
+
if labels is None:
|
631
|
+
return single_group(input)
|
632
|
+
|
633
|
+
labels = np.asarray(labels)
|
634
|
+
# ensure input and labels match sizes
|
635
|
+
input, labels = np.broadcast_arrays(input, labels)
|
636
|
+
|
637
|
+
if index is None:
|
638
|
+
return single_group(input[labels > 0])
|
639
|
+
|
640
|
+
if np.isscalar(index):
|
641
|
+
return single_group(input[labels == index])
|
642
|
+
|
643
|
+
def _sum_centered(labels):
|
644
|
+
# `labels` is expected to be an ndarray with the same shape as `input`.
|
645
|
+
# It must contain the label indices (which are not necessarily the labels
|
646
|
+
# themselves).
|
647
|
+
means = sums / counts
|
648
|
+
centered_input = input - means[labels]
|
649
|
+
# bincount expects 1-D inputs, so we ravel the arguments.
|
650
|
+
bc = np.bincount(labels.ravel(),
|
651
|
+
weights=(centered_input *
|
652
|
+
centered_input.conjugate()).ravel())
|
653
|
+
return bc
|
654
|
+
|
655
|
+
# Remap labels to unique integers if necessary, or if the largest
|
656
|
+
# label is larger than the number of values.
|
657
|
+
|
658
|
+
if (not _safely_castable_to_int(labels.dtype) or
|
659
|
+
labels.min() < 0 or labels.max() > labels.size):
|
660
|
+
# Use np.unique to generate the label indices. `new_labels` will
|
661
|
+
# be 1-D, but it should be interpreted as the flattened N-D array of
|
662
|
+
# label indices.
|
663
|
+
unique_labels, new_labels = np.unique(labels, return_inverse=True)
|
664
|
+
new_labels = np.reshape(new_labels, (-1,)) # flatten, since it may be >1-D
|
665
|
+
counts = np.bincount(new_labels)
|
666
|
+
sums = np.bincount(new_labels, weights=input.ravel())
|
667
|
+
if centered:
|
668
|
+
# Compute the sum of the mean-centered squares.
|
669
|
+
# We must reshape new_labels to the N-D shape of `input` before
|
670
|
+
# passing it _sum_centered.
|
671
|
+
sums_c = _sum_centered(new_labels.reshape(labels.shape))
|
672
|
+
idxs = np.searchsorted(unique_labels, index)
|
673
|
+
# make all of idxs valid
|
674
|
+
idxs[idxs >= unique_labels.size] = 0
|
675
|
+
found = (unique_labels[idxs] == index)
|
676
|
+
else:
|
677
|
+
# labels are an integer type allowed by bincount, and there aren't too
|
678
|
+
# many, so call bincount directly.
|
679
|
+
counts = np.bincount(labels.ravel())
|
680
|
+
sums = np.bincount(labels.ravel(), weights=input.ravel())
|
681
|
+
if centered:
|
682
|
+
sums_c = _sum_centered(labels)
|
683
|
+
# make sure all index values are valid
|
684
|
+
idxs = np.asanyarray(index, np.int_).copy()
|
685
|
+
found = (idxs >= 0) & (idxs < counts.size)
|
686
|
+
idxs[~found] = 0
|
687
|
+
|
688
|
+
counts = counts[idxs]
|
689
|
+
counts[~found] = 0
|
690
|
+
sums = sums[idxs]
|
691
|
+
sums[~found] = 0
|
692
|
+
|
693
|
+
if not centered:
|
694
|
+
return (counts, sums)
|
695
|
+
else:
|
696
|
+
sums_c = sums_c[idxs]
|
697
|
+
sums_c[~found] = 0
|
698
|
+
return (counts, sums, sums_c)
|
699
|
+
|
700
|
+
|
701
|
+
def sum(input, labels=None, index=None):
|
702
|
+
"""
|
703
|
+
Calculate the sum of the values of the array.
|
704
|
+
|
705
|
+
Notes
|
706
|
+
-----
|
707
|
+
This is an alias for `ndimage.sum_labels` kept for backwards compatibility
|
708
|
+
reasons, for new code please prefer `sum_labels`. See the `sum_labels`
|
709
|
+
docstring for more details.
|
710
|
+
|
711
|
+
"""
|
712
|
+
return sum_labels(input, labels, index)
|
713
|
+
|
714
|
+
|
715
|
+
def sum_labels(input, labels=None, index=None):
|
716
|
+
"""
|
717
|
+
Calculate the sum of the values of the array.
|
718
|
+
|
719
|
+
Parameters
|
720
|
+
----------
|
721
|
+
input : array_like
|
722
|
+
Values of `input` inside the regions defined by `labels`
|
723
|
+
are summed together.
|
724
|
+
labels : array_like of ints, optional
|
725
|
+
Assign labels to the values of the array. Has to have the same shape as
|
726
|
+
`input`.
|
727
|
+
index : array_like, optional
|
728
|
+
A single label number or a sequence of label numbers of
|
729
|
+
the objects to be measured.
|
730
|
+
|
731
|
+
Returns
|
732
|
+
-------
|
733
|
+
sum : ndarray or scalar
|
734
|
+
An array of the sums of values of `input` inside the regions defined
|
735
|
+
by `labels` with the same shape as `index`. If 'index' is None or scalar,
|
736
|
+
a scalar is returned.
|
737
|
+
|
738
|
+
See Also
|
739
|
+
--------
|
740
|
+
mean, median
|
741
|
+
|
742
|
+
Examples
|
743
|
+
--------
|
744
|
+
>>> from scipy import ndimage
|
745
|
+
>>> input = [0,1,2,3]
|
746
|
+
>>> labels = [1,1,2,2]
|
747
|
+
>>> ndimage.sum_labels(input, labels, index=[1,2])
|
748
|
+
[1.0, 5.0]
|
749
|
+
>>> ndimage.sum_labels(input, labels, index=1)
|
750
|
+
1
|
751
|
+
>>> ndimage.sum_labels(input, labels)
|
752
|
+
6
|
753
|
+
|
754
|
+
|
755
|
+
"""
|
756
|
+
count, sum = _stats(input, labels, index)
|
757
|
+
return sum
|
758
|
+
|
759
|
+
|
760
|
+
def mean(input, labels=None, index=None):
|
761
|
+
"""
|
762
|
+
Calculate the mean of the values of an array at labels.
|
763
|
+
|
764
|
+
Parameters
|
765
|
+
----------
|
766
|
+
input : array_like
|
767
|
+
Array on which to compute the mean of elements over distinct
|
768
|
+
regions.
|
769
|
+
labels : array_like, optional
|
770
|
+
Array of labels of same shape, or broadcastable to the same shape as
|
771
|
+
`input`. All elements sharing the same label form one region over
|
772
|
+
which the mean of the elements is computed.
|
773
|
+
index : int or sequence of ints, optional
|
774
|
+
Labels of the objects over which the mean is to be computed.
|
775
|
+
Default is None, in which case the mean for all values where label is
|
776
|
+
greater than 0 is calculated.
|
777
|
+
|
778
|
+
Returns
|
779
|
+
-------
|
780
|
+
out : list
|
781
|
+
Sequence of same length as `index`, with the mean of the different
|
782
|
+
regions labeled by the labels in `index`.
|
783
|
+
|
784
|
+
See Also
|
785
|
+
--------
|
786
|
+
variance, standard_deviation, minimum, maximum, sum, label
|
787
|
+
|
788
|
+
Examples
|
789
|
+
--------
|
790
|
+
>>> from scipy import ndimage
|
791
|
+
>>> import numpy as np
|
792
|
+
>>> a = np.arange(25).reshape((5,5))
|
793
|
+
>>> labels = np.zeros_like(a)
|
794
|
+
>>> labels[3:5,3:5] = 1
|
795
|
+
>>> index = np.unique(labels)
|
796
|
+
>>> labels
|
797
|
+
array([[0, 0, 0, 0, 0],
|
798
|
+
[0, 0, 0, 0, 0],
|
799
|
+
[0, 0, 0, 0, 0],
|
800
|
+
[0, 0, 0, 1, 1],
|
801
|
+
[0, 0, 0, 1, 1]])
|
802
|
+
>>> index
|
803
|
+
array([0, 1])
|
804
|
+
>>> ndimage.mean(a, labels=labels, index=index)
|
805
|
+
[10.285714285714286, 21.0]
|
806
|
+
|
807
|
+
"""
|
808
|
+
|
809
|
+
count, sum = _stats(input, labels, index)
|
810
|
+
return sum / np.asanyarray(count).astype(np.float64)
|
811
|
+
|
812
|
+
|
813
|
+
def variance(input, labels=None, index=None):
|
814
|
+
"""
|
815
|
+
Calculate the variance of the values of an N-D image array, optionally at
|
816
|
+
specified sub-regions.
|
817
|
+
|
818
|
+
Parameters
|
819
|
+
----------
|
820
|
+
input : array_like
|
821
|
+
Nd-image data to process.
|
822
|
+
labels : array_like, optional
|
823
|
+
Labels defining sub-regions in `input`.
|
824
|
+
If not None, must be same shape as `input`.
|
825
|
+
index : int or sequence of ints, optional
|
826
|
+
`labels` to include in output. If None (default), all values where
|
827
|
+
`labels` is non-zero are used.
|
828
|
+
|
829
|
+
Returns
|
830
|
+
-------
|
831
|
+
variance : float or ndarray
|
832
|
+
Values of variance, for each sub-region if `labels` and `index` are
|
833
|
+
specified.
|
834
|
+
|
835
|
+
See Also
|
836
|
+
--------
|
837
|
+
label, standard_deviation, maximum, minimum, extrema
|
838
|
+
|
839
|
+
Examples
|
840
|
+
--------
|
841
|
+
>>> import numpy as np
|
842
|
+
>>> a = np.array([[1, 2, 0, 0],
|
843
|
+
... [5, 3, 0, 4],
|
844
|
+
... [0, 0, 0, 7],
|
845
|
+
... [9, 3, 0, 0]])
|
846
|
+
>>> from scipy import ndimage
|
847
|
+
>>> ndimage.variance(a)
|
848
|
+
7.609375
|
849
|
+
|
850
|
+
Features to process can be specified using `labels` and `index`:
|
851
|
+
|
852
|
+
>>> lbl, nlbl = ndimage.label(a)
|
853
|
+
>>> ndimage.variance(a, lbl, index=np.arange(1, nlbl+1))
|
854
|
+
array([ 2.1875, 2.25 , 9. ])
|
855
|
+
|
856
|
+
If no index is given, all non-zero `labels` are processed:
|
857
|
+
|
858
|
+
>>> ndimage.variance(a, lbl)
|
859
|
+
6.1875
|
860
|
+
|
861
|
+
"""
|
862
|
+
count, sum, sum_c_sq = _stats(input, labels, index, centered=True)
|
863
|
+
return sum_c_sq / np.asanyarray(count).astype(float)
|
864
|
+
|
865
|
+
|
866
|
+
def standard_deviation(input, labels=None, index=None):
|
867
|
+
"""
|
868
|
+
Calculate the standard deviation of the values of an N-D image array,
|
869
|
+
optionally at specified sub-regions.
|
870
|
+
|
871
|
+
Parameters
|
872
|
+
----------
|
873
|
+
input : array_like
|
874
|
+
N-D image data to process.
|
875
|
+
labels : array_like, optional
|
876
|
+
Labels to identify sub-regions in `input`.
|
877
|
+
If not None, must be same shape as `input`.
|
878
|
+
index : int or sequence of ints, optional
|
879
|
+
`labels` to include in output. If None (default), all values where
|
880
|
+
`labels` is non-zero are used.
|
881
|
+
|
882
|
+
Returns
|
883
|
+
-------
|
884
|
+
standard_deviation : float or ndarray
|
885
|
+
Values of standard deviation, for each sub-region if `labels` and
|
886
|
+
`index` are specified.
|
887
|
+
|
888
|
+
See Also
|
889
|
+
--------
|
890
|
+
label, variance, maximum, minimum, extrema
|
891
|
+
|
892
|
+
Examples
|
893
|
+
--------
|
894
|
+
>>> import numpy as np
|
895
|
+
>>> a = np.array([[1, 2, 0, 0],
|
896
|
+
... [5, 3, 0, 4],
|
897
|
+
... [0, 0, 0, 7],
|
898
|
+
... [9, 3, 0, 0]])
|
899
|
+
>>> from scipy import ndimage
|
900
|
+
>>> ndimage.standard_deviation(a)
|
901
|
+
2.7585095613392387
|
902
|
+
|
903
|
+
Features to process can be specified using `labels` and `index`:
|
904
|
+
|
905
|
+
>>> lbl, nlbl = ndimage.label(a)
|
906
|
+
>>> ndimage.standard_deviation(a, lbl, index=np.arange(1, nlbl+1))
|
907
|
+
array([ 1.479, 1.5 , 3. ])
|
908
|
+
|
909
|
+
If no index is given, non-zero `labels` are processed:
|
910
|
+
|
911
|
+
>>> ndimage.standard_deviation(a, lbl)
|
912
|
+
2.4874685927665499
|
913
|
+
|
914
|
+
"""
|
915
|
+
return np.sqrt(variance(input, labels, index))
|
916
|
+
|
917
|
+
|
918
|
+
def _select(input, labels=None, index=None, find_min=False, find_max=False,
|
919
|
+
find_min_positions=False, find_max_positions=False,
|
920
|
+
find_median=False):
|
921
|
+
"""Returns min, max, or both, plus their positions (if requested), and
|
922
|
+
median."""
|
923
|
+
|
924
|
+
input = np.asanyarray(input)
|
925
|
+
|
926
|
+
find_positions = find_min_positions or find_max_positions
|
927
|
+
positions = None
|
928
|
+
if find_positions:
|
929
|
+
positions = np.arange(input.size).reshape(input.shape)
|
930
|
+
|
931
|
+
def single_group(vals, positions):
|
932
|
+
result = []
|
933
|
+
if find_min:
|
934
|
+
result += [vals.min()]
|
935
|
+
if find_min_positions:
|
936
|
+
result += [positions[vals == vals.min()][0]]
|
937
|
+
if find_max:
|
938
|
+
result += [vals.max()]
|
939
|
+
if find_max_positions:
|
940
|
+
result += [positions[vals == vals.max()][0]]
|
941
|
+
if find_median:
|
942
|
+
result += [np.median(vals)]
|
943
|
+
return result
|
944
|
+
|
945
|
+
if labels is None:
|
946
|
+
return single_group(input, positions)
|
947
|
+
|
948
|
+
labels = np.asarray(labels)
|
949
|
+
# ensure input and labels match sizes
|
950
|
+
input, labels = np.broadcast_arrays(input, labels)
|
951
|
+
|
952
|
+
if index is None:
|
953
|
+
mask = (labels > 0)
|
954
|
+
masked_positions = None
|
955
|
+
if find_positions:
|
956
|
+
masked_positions = positions[mask]
|
957
|
+
return single_group(input[mask], masked_positions)
|
958
|
+
|
959
|
+
if np.isscalar(index):
|
960
|
+
mask = (labels == index)
|
961
|
+
masked_positions = None
|
962
|
+
if find_positions:
|
963
|
+
masked_positions = positions[mask]
|
964
|
+
return single_group(input[mask], masked_positions)
|
965
|
+
|
966
|
+
index = np.asarray(index)
|
967
|
+
|
968
|
+
# remap labels to unique integers if necessary, or if the largest
|
969
|
+
# label is larger than the number of values.
|
970
|
+
if (not _safely_castable_to_int(labels.dtype) or
|
971
|
+
labels.min() < 0 or labels.max() > labels.size):
|
972
|
+
# remap labels, and indexes
|
973
|
+
unique_labels, labels = np.unique(labels, return_inverse=True)
|
974
|
+
idxs = np.searchsorted(unique_labels, index)
|
975
|
+
|
976
|
+
# make all of idxs valid
|
977
|
+
idxs[idxs >= unique_labels.size] = 0
|
978
|
+
found = (unique_labels[idxs] == index)
|
979
|
+
else:
|
980
|
+
# labels are an integer type, and there aren't too many
|
981
|
+
idxs = np.asanyarray(index, np.int_).copy()
|
982
|
+
found = (idxs >= 0) & (idxs <= labels.max())
|
983
|
+
|
984
|
+
idxs[~ found] = labels.max() + 1
|
985
|
+
|
986
|
+
if find_median:
|
987
|
+
order = np.lexsort((input.ravel(), labels.ravel()))
|
988
|
+
else:
|
989
|
+
order = input.ravel().argsort()
|
990
|
+
input = input.ravel()[order]
|
991
|
+
labels = labels.ravel()[order]
|
992
|
+
if find_positions:
|
993
|
+
positions = positions.ravel()[order]
|
994
|
+
|
995
|
+
result = []
|
996
|
+
if find_min:
|
997
|
+
mins = np.zeros(labels.max() + 2, input.dtype)
|
998
|
+
mins[labels[::-1]] = input[::-1]
|
999
|
+
result += [mins[idxs]]
|
1000
|
+
if find_min_positions:
|
1001
|
+
minpos = np.zeros(labels.max() + 2, int)
|
1002
|
+
minpos[labels[::-1]] = positions[::-1]
|
1003
|
+
result += [minpos[idxs]]
|
1004
|
+
if find_max:
|
1005
|
+
maxs = np.zeros(labels.max() + 2, input.dtype)
|
1006
|
+
maxs[labels] = input
|
1007
|
+
result += [maxs[idxs]]
|
1008
|
+
if find_max_positions:
|
1009
|
+
maxpos = np.zeros(labels.max() + 2, int)
|
1010
|
+
maxpos[labels] = positions
|
1011
|
+
result += [maxpos[idxs]]
|
1012
|
+
if find_median:
|
1013
|
+
locs = np.arange(len(labels))
|
1014
|
+
lo = np.zeros(labels.max() + 2, np.int_)
|
1015
|
+
lo[labels[::-1]] = locs[::-1]
|
1016
|
+
hi = np.zeros(labels.max() + 2, np.int_)
|
1017
|
+
hi[labels] = locs
|
1018
|
+
lo = lo[idxs]
|
1019
|
+
hi = hi[idxs]
|
1020
|
+
# lo is an index to the lowest value in input for each label,
|
1021
|
+
# hi is an index to the largest value.
|
1022
|
+
# move them to be either the same ((hi - lo) % 2 == 0) or next
|
1023
|
+
# to each other ((hi - lo) % 2 == 1), then average.
|
1024
|
+
step = (hi - lo) // 2
|
1025
|
+
lo += step
|
1026
|
+
hi -= step
|
1027
|
+
if (np.issubdtype(input.dtype, np.integer)
|
1028
|
+
or np.issubdtype(input.dtype, np.bool_)):
|
1029
|
+
# avoid integer overflow or boolean addition (gh-12836)
|
1030
|
+
result += [(input[lo].astype('d') + input[hi].astype('d')) / 2.0]
|
1031
|
+
else:
|
1032
|
+
result += [(input[lo] + input[hi]) / 2.0]
|
1033
|
+
|
1034
|
+
return result
|
1035
|
+
|
1036
|
+
|
1037
|
+
def minimum(input, labels=None, index=None):
|
1038
|
+
"""
|
1039
|
+
Calculate the minimum of the values of an array over labeled regions.
|
1040
|
+
|
1041
|
+
Parameters
|
1042
|
+
----------
|
1043
|
+
input : array_like
|
1044
|
+
Array_like of values. For each region specified by `labels`, the
|
1045
|
+
minimal values of `input` over the region is computed.
|
1046
|
+
labels : array_like, optional
|
1047
|
+
An array_like of integers marking different regions over which the
|
1048
|
+
minimum value of `input` is to be computed. `labels` must have the
|
1049
|
+
same shape as `input`. If `labels` is not specified, the minimum
|
1050
|
+
over the whole array is returned.
|
1051
|
+
index : array_like, optional
|
1052
|
+
A list of region labels that are taken into account for computing the
|
1053
|
+
minima. If index is None, the minimum over all elements where `labels`
|
1054
|
+
is non-zero is returned.
|
1055
|
+
|
1056
|
+
Returns
|
1057
|
+
-------
|
1058
|
+
output : a scalar or list of integers or floats based on input type.
|
1059
|
+
List of minima of `input` over the regions determined by `labels` and
|
1060
|
+
whose index is in `index`. If `index` or `labels` are not specified, a
|
1061
|
+
float is returned: the minimal value of `input` if `labels` is None,
|
1062
|
+
and the minimal value of elements where `labels` is greater than zero
|
1063
|
+
if `index` is None.
|
1064
|
+
|
1065
|
+
See Also
|
1066
|
+
--------
|
1067
|
+
label, maximum, median, minimum_position, extrema, sum, mean, variance,
|
1068
|
+
standard_deviation
|
1069
|
+
|
1070
|
+
Notes
|
1071
|
+
-----
|
1072
|
+
The function returns a Python list and not a NumPy array, use
|
1073
|
+
`np.array` to convert the list to an array.
|
1074
|
+
|
1075
|
+
Examples
|
1076
|
+
--------
|
1077
|
+
>>> from scipy import ndimage
|
1078
|
+
>>> import numpy as np
|
1079
|
+
>>> a = np.array([[1, 2, 0, 0],
|
1080
|
+
... [5, 3, 0, 4],
|
1081
|
+
... [0, 0, 0, 7],
|
1082
|
+
... [9, 3, 0, 0]])
|
1083
|
+
>>> labels, labels_nb = ndimage.label(a)
|
1084
|
+
>>> labels
|
1085
|
+
array([[1, 1, 0, 0],
|
1086
|
+
[1, 1, 0, 2],
|
1087
|
+
[0, 0, 0, 2],
|
1088
|
+
[3, 3, 0, 0]], dtype=int32)
|
1089
|
+
>>> ndimage.minimum(a, labels=labels, index=np.arange(1, labels_nb + 1))
|
1090
|
+
[1, 4, 3]
|
1091
|
+
>>> ndimage.minimum(a)
|
1092
|
+
0
|
1093
|
+
>>> ndimage.minimum(a, labels=labels)
|
1094
|
+
1
|
1095
|
+
|
1096
|
+
"""
|
1097
|
+
return _select(input, labels, index, find_min=True)[0]
|
1098
|
+
|
1099
|
+
|
1100
|
+
def maximum(input, labels=None, index=None):
|
1101
|
+
"""
|
1102
|
+
Calculate the maximum of the values of an array over labeled regions.
|
1103
|
+
|
1104
|
+
Parameters
|
1105
|
+
----------
|
1106
|
+
input : array_like
|
1107
|
+
Array_like of values. For each region specified by `labels`, the
|
1108
|
+
maximal values of `input` over the region is computed.
|
1109
|
+
labels : array_like, optional
|
1110
|
+
An array of integers marking different regions over which the
|
1111
|
+
maximum value of `input` is to be computed. `labels` must have the
|
1112
|
+
same shape as `input`. If `labels` is not specified, the maximum
|
1113
|
+
over the whole array is returned.
|
1114
|
+
index : array_like, optional
|
1115
|
+
A list of region labels that are taken into account for computing the
|
1116
|
+
maxima. If index is None, the maximum over all elements where `labels`
|
1117
|
+
is non-zero is returned.
|
1118
|
+
|
1119
|
+
Returns
|
1120
|
+
-------
|
1121
|
+
output : a scalar or list of integers or floats based on input type.
|
1122
|
+
List of maxima of `input` over the regions determined by `labels` and
|
1123
|
+
whose index is in `index`. If `index` or `labels` are not specified, a
|
1124
|
+
float is returned: the maximal value of `input` if `labels` is None,
|
1125
|
+
and the maximal value of elements where `labels` is greater than zero
|
1126
|
+
if `index` is None.
|
1127
|
+
|
1128
|
+
See Also
|
1129
|
+
--------
|
1130
|
+
label, minimum, median, maximum_position, extrema, sum, mean, variance,
|
1131
|
+
standard_deviation
|
1132
|
+
|
1133
|
+
Notes
|
1134
|
+
-----
|
1135
|
+
The function returns a Python list and not a NumPy array, use
|
1136
|
+
`np.array` to convert the list to an array.
|
1137
|
+
|
1138
|
+
Examples
|
1139
|
+
--------
|
1140
|
+
>>> import numpy as np
|
1141
|
+
>>> a = np.arange(16).reshape((4,4))
|
1142
|
+
>>> a
|
1143
|
+
array([[ 0, 1, 2, 3],
|
1144
|
+
[ 4, 5, 6, 7],
|
1145
|
+
[ 8, 9, 10, 11],
|
1146
|
+
[12, 13, 14, 15]])
|
1147
|
+
>>> labels = np.zeros_like(a)
|
1148
|
+
>>> labels[:2,:2] = 1
|
1149
|
+
>>> labels[2:, 1:3] = 2
|
1150
|
+
>>> labels
|
1151
|
+
array([[1, 1, 0, 0],
|
1152
|
+
[1, 1, 0, 0],
|
1153
|
+
[0, 2, 2, 0],
|
1154
|
+
[0, 2, 2, 0]])
|
1155
|
+
>>> from scipy import ndimage
|
1156
|
+
>>> ndimage.maximum(a)
|
1157
|
+
15
|
1158
|
+
>>> ndimage.maximum(a, labels=labels, index=[1,2])
|
1159
|
+
[5, 14]
|
1160
|
+
>>> ndimage.maximum(a, labels=labels)
|
1161
|
+
14
|
1162
|
+
|
1163
|
+
>>> b = np.array([[1, 2, 0, 0],
|
1164
|
+
... [5, 3, 0, 4],
|
1165
|
+
... [0, 0, 0, 7],
|
1166
|
+
... [9, 3, 0, 0]])
|
1167
|
+
>>> labels, labels_nb = ndimage.label(b)
|
1168
|
+
>>> labels
|
1169
|
+
array([[1, 1, 0, 0],
|
1170
|
+
[1, 1, 0, 2],
|
1171
|
+
[0, 0, 0, 2],
|
1172
|
+
[3, 3, 0, 0]], dtype=int32)
|
1173
|
+
>>> ndimage.maximum(b, labels=labels, index=np.arange(1, labels_nb + 1))
|
1174
|
+
[5, 7, 9]
|
1175
|
+
|
1176
|
+
"""
|
1177
|
+
return _select(input, labels, index, find_max=True)[0]
|
1178
|
+
|
1179
|
+
|
1180
|
+
def median(input, labels=None, index=None):
|
1181
|
+
"""
|
1182
|
+
Calculate the median of the values of an array over labeled regions.
|
1183
|
+
|
1184
|
+
Parameters
|
1185
|
+
----------
|
1186
|
+
input : array_like
|
1187
|
+
Array_like of values. For each region specified by `labels`, the
|
1188
|
+
median value of `input` over the region is computed.
|
1189
|
+
labels : array_like, optional
|
1190
|
+
An array_like of integers marking different regions over which the
|
1191
|
+
median value of `input` is to be computed. `labels` must have the
|
1192
|
+
same shape as `input`. If `labels` is not specified, the median
|
1193
|
+
over the whole array is returned.
|
1194
|
+
index : array_like, optional
|
1195
|
+
A list of region labels that are taken into account for computing the
|
1196
|
+
medians. If index is None, the median over all elements where `labels`
|
1197
|
+
is non-zero is returned.
|
1198
|
+
|
1199
|
+
Returns
|
1200
|
+
-------
|
1201
|
+
median : float or list of floats
|
1202
|
+
List of medians of `input` over the regions determined by `labels` and
|
1203
|
+
whose index is in `index`. If `index` or `labels` are not specified, a
|
1204
|
+
float is returned: the median value of `input` if `labels` is None,
|
1205
|
+
and the median value of elements where `labels` is greater than zero
|
1206
|
+
if `index` is None.
|
1207
|
+
|
1208
|
+
See Also
|
1209
|
+
--------
|
1210
|
+
label, minimum, maximum, extrema, sum, mean, variance, standard_deviation
|
1211
|
+
|
1212
|
+
Notes
|
1213
|
+
-----
|
1214
|
+
The function returns a Python list and not a NumPy array, use
|
1215
|
+
`np.array` to convert the list to an array.
|
1216
|
+
|
1217
|
+
Examples
|
1218
|
+
--------
|
1219
|
+
>>> from scipy import ndimage
|
1220
|
+
>>> import numpy as np
|
1221
|
+
>>> a = np.array([[1, 2, 0, 1],
|
1222
|
+
... [5, 3, 0, 4],
|
1223
|
+
... [0, 0, 0, 7],
|
1224
|
+
... [9, 3, 0, 0]])
|
1225
|
+
>>> labels, labels_nb = ndimage.label(a)
|
1226
|
+
>>> labels
|
1227
|
+
array([[1, 1, 0, 2],
|
1228
|
+
[1, 1, 0, 2],
|
1229
|
+
[0, 0, 0, 2],
|
1230
|
+
[3, 3, 0, 0]], dtype=int32)
|
1231
|
+
>>> ndimage.median(a, labels=labels, index=np.arange(1, labels_nb + 1))
|
1232
|
+
[2.5, 4.0, 6.0]
|
1233
|
+
>>> ndimage.median(a)
|
1234
|
+
1.0
|
1235
|
+
>>> ndimage.median(a, labels=labels)
|
1236
|
+
3.0
|
1237
|
+
|
1238
|
+
"""
|
1239
|
+
return _select(input, labels, index, find_median=True)[0]
|
1240
|
+
|
1241
|
+
|
1242
|
+
def minimum_position(input, labels=None, index=None):
|
1243
|
+
"""
|
1244
|
+
Find the positions of the minimums of the values of an array at labels.
|
1245
|
+
|
1246
|
+
Parameters
|
1247
|
+
----------
|
1248
|
+
input : array_like
|
1249
|
+
Array_like of values.
|
1250
|
+
labels : array_like, optional
|
1251
|
+
An array of integers marking different regions over which the
|
1252
|
+
position of the minimum value of `input` is to be computed.
|
1253
|
+
`labels` must have the same shape as `input`. If `labels` is not
|
1254
|
+
specified, the location of the first minimum over the whole
|
1255
|
+
array is returned.
|
1256
|
+
|
1257
|
+
The `labels` argument only works when `index` is specified.
|
1258
|
+
index : array_like, optional
|
1259
|
+
A list of region labels that are taken into account for finding the
|
1260
|
+
location of the minima. If `index` is None, the ``first`` minimum
|
1261
|
+
over all elements where `labels` is non-zero is returned.
|
1262
|
+
|
1263
|
+
The `index` argument only works when `labels` is specified.
|
1264
|
+
|
1265
|
+
Returns
|
1266
|
+
-------
|
1267
|
+
output : list of tuples of ints
|
1268
|
+
Tuple of ints or list of tuples of ints that specify the location
|
1269
|
+
of minima of `input` over the regions determined by `labels` and
|
1270
|
+
whose index is in `index`.
|
1271
|
+
|
1272
|
+
If `index` or `labels` are not specified, a tuple of ints is
|
1273
|
+
returned specifying the location of the first minimal value of `input`.
|
1274
|
+
|
1275
|
+
See Also
|
1276
|
+
--------
|
1277
|
+
label, minimum, median, maximum_position, extrema, sum, mean, variance,
|
1278
|
+
standard_deviation
|
1279
|
+
|
1280
|
+
Examples
|
1281
|
+
--------
|
1282
|
+
>>> import numpy as np
|
1283
|
+
>>> a = np.array([[10, 20, 30],
|
1284
|
+
... [40, 80, 100],
|
1285
|
+
... [1, 100, 200]])
|
1286
|
+
>>> b = np.array([[1, 2, 0, 1],
|
1287
|
+
... [5, 3, 0, 4],
|
1288
|
+
... [0, 0, 0, 7],
|
1289
|
+
... [9, 3, 0, 0]])
|
1290
|
+
|
1291
|
+
>>> from scipy import ndimage
|
1292
|
+
|
1293
|
+
>>> ndimage.minimum_position(a)
|
1294
|
+
(2, 0)
|
1295
|
+
>>> ndimage.minimum_position(b)
|
1296
|
+
(0, 2)
|
1297
|
+
|
1298
|
+
Features to process can be specified using `labels` and `index`:
|
1299
|
+
|
1300
|
+
>>> label, pos = ndimage.label(a)
|
1301
|
+
>>> ndimage.minimum_position(a, label, index=np.arange(1, pos+1))
|
1302
|
+
[(2, 0)]
|
1303
|
+
|
1304
|
+
>>> label, pos = ndimage.label(b)
|
1305
|
+
>>> ndimage.minimum_position(b, label, index=np.arange(1, pos+1))
|
1306
|
+
[(0, 0), (0, 3), (3, 1)]
|
1307
|
+
|
1308
|
+
"""
|
1309
|
+
dims = np.array(np.asarray(input).shape)
|
1310
|
+
# see np.unravel_index to understand this line.
|
1311
|
+
dim_prod = np.cumprod([1] + list(dims[:0:-1]))[::-1]
|
1312
|
+
|
1313
|
+
result = _select(input, labels, index, find_min_positions=True)[0]
|
1314
|
+
|
1315
|
+
if np.isscalar(result):
|
1316
|
+
return tuple((result // dim_prod) % dims)
|
1317
|
+
|
1318
|
+
return [tuple(v) for v in (result.reshape(-1, 1) // dim_prod) % dims]
|
1319
|
+
|
1320
|
+
|
1321
|
+
def maximum_position(input, labels=None, index=None):
|
1322
|
+
"""
|
1323
|
+
Find the positions of the maximums of the values of an array at labels.
|
1324
|
+
|
1325
|
+
For each region specified by `labels`, the position of the maximum
|
1326
|
+
value of `input` within the region is returned.
|
1327
|
+
|
1328
|
+
Parameters
|
1329
|
+
----------
|
1330
|
+
input : array_like
|
1331
|
+
Array_like of values.
|
1332
|
+
labels : array_like, optional
|
1333
|
+
An array of integers marking different regions over which the
|
1334
|
+
position of the maximum value of `input` is to be computed.
|
1335
|
+
`labels` must have the same shape as `input`. If `labels` is not
|
1336
|
+
specified, the location of the first maximum over the whole
|
1337
|
+
array is returned.
|
1338
|
+
|
1339
|
+
The `labels` argument only works when `index` is specified.
|
1340
|
+
index : array_like, optional
|
1341
|
+
A list of region labels that are taken into account for finding the
|
1342
|
+
location of the maxima. If `index` is None, the first maximum
|
1343
|
+
over all elements where `labels` is non-zero is returned.
|
1344
|
+
|
1345
|
+
The `index` argument only works when `labels` is specified.
|
1346
|
+
|
1347
|
+
Returns
|
1348
|
+
-------
|
1349
|
+
output : list of tuples of ints
|
1350
|
+
List of tuples of ints that specify the location of maxima of
|
1351
|
+
`input` over the regions determined by `labels` and whose index
|
1352
|
+
is in `index`.
|
1353
|
+
|
1354
|
+
If `index` or `labels` are not specified, a tuple of ints is
|
1355
|
+
returned specifying the location of the ``first`` maximal value
|
1356
|
+
of `input`.
|
1357
|
+
|
1358
|
+
See Also
|
1359
|
+
--------
|
1360
|
+
label, minimum, median, maximum_position, extrema, sum, mean, variance,
|
1361
|
+
standard_deviation
|
1362
|
+
|
1363
|
+
Examples
|
1364
|
+
--------
|
1365
|
+
>>> from scipy import ndimage
|
1366
|
+
>>> import numpy as np
|
1367
|
+
>>> a = np.array([[1, 2, 0, 0],
|
1368
|
+
... [5, 3, 0, 4],
|
1369
|
+
... [0, 0, 0, 7],
|
1370
|
+
... [9, 3, 0, 0]])
|
1371
|
+
>>> ndimage.maximum_position(a)
|
1372
|
+
(3, 0)
|
1373
|
+
|
1374
|
+
Features to process can be specified using `labels` and `index`:
|
1375
|
+
|
1376
|
+
>>> lbl = np.array([[0, 1, 2, 3],
|
1377
|
+
... [0, 1, 2, 3],
|
1378
|
+
... [0, 1, 2, 3],
|
1379
|
+
... [0, 1, 2, 3]])
|
1380
|
+
>>> ndimage.maximum_position(a, lbl, 1)
|
1381
|
+
(1, 1)
|
1382
|
+
|
1383
|
+
If no index is given, non-zero `labels` are processed:
|
1384
|
+
|
1385
|
+
>>> ndimage.maximum_position(a, lbl)
|
1386
|
+
(2, 3)
|
1387
|
+
|
1388
|
+
If there are no maxima, the position of the first element is returned:
|
1389
|
+
|
1390
|
+
>>> ndimage.maximum_position(a, lbl, 2)
|
1391
|
+
(0, 2)
|
1392
|
+
|
1393
|
+
"""
|
1394
|
+
dims = np.array(np.asarray(input).shape)
|
1395
|
+
# see np.unravel_index to understand this line.
|
1396
|
+
dim_prod = np.cumprod([1] + list(dims[:0:-1]))[::-1]
|
1397
|
+
|
1398
|
+
result = _select(input, labels, index, find_max_positions=True)[0]
|
1399
|
+
|
1400
|
+
if np.isscalar(result):
|
1401
|
+
return tuple((result // dim_prod) % dims)
|
1402
|
+
|
1403
|
+
return [tuple(v) for v in (result.reshape(-1, 1) // dim_prod) % dims]
|
1404
|
+
|
1405
|
+
|
1406
|
+
def extrema(input, labels=None, index=None):
|
1407
|
+
"""
|
1408
|
+
Calculate the minimums and maximums of the values of an array
|
1409
|
+
at labels, along with their positions.
|
1410
|
+
|
1411
|
+
Parameters
|
1412
|
+
----------
|
1413
|
+
input : ndarray
|
1414
|
+
N-D image data to process.
|
1415
|
+
labels : ndarray, optional
|
1416
|
+
Labels of features in input.
|
1417
|
+
If not None, must be same shape as `input`.
|
1418
|
+
index : int or sequence of ints, optional
|
1419
|
+
Labels to include in output. If None (default), all values where
|
1420
|
+
non-zero `labels` are used.
|
1421
|
+
|
1422
|
+
Returns
|
1423
|
+
-------
|
1424
|
+
minimums, maximums : int or ndarray
|
1425
|
+
Values of minimums and maximums in each feature.
|
1426
|
+
min_positions, max_positions : tuple or list of tuples
|
1427
|
+
Each tuple gives the N-D coordinates of the corresponding minimum
|
1428
|
+
or maximum.
|
1429
|
+
|
1430
|
+
See Also
|
1431
|
+
--------
|
1432
|
+
maximum, minimum, maximum_position, minimum_position, center_of_mass
|
1433
|
+
|
1434
|
+
Examples
|
1435
|
+
--------
|
1436
|
+
>>> import numpy as np
|
1437
|
+
>>> a = np.array([[1, 2, 0, 0],
|
1438
|
+
... [5, 3, 0, 4],
|
1439
|
+
... [0, 0, 0, 7],
|
1440
|
+
... [9, 3, 0, 0]])
|
1441
|
+
>>> from scipy import ndimage
|
1442
|
+
>>> ndimage.extrema(a)
|
1443
|
+
(0, 9, (0, 2), (3, 0))
|
1444
|
+
|
1445
|
+
Features to process can be specified using `labels` and `index`:
|
1446
|
+
|
1447
|
+
>>> lbl, nlbl = ndimage.label(a)
|
1448
|
+
>>> ndimage.extrema(a, lbl, index=np.arange(1, nlbl+1))
|
1449
|
+
(array([1, 4, 3]),
|
1450
|
+
array([5, 7, 9]),
|
1451
|
+
[(0, 0), (1, 3), (3, 1)],
|
1452
|
+
[(1, 0), (2, 3), (3, 0)])
|
1453
|
+
|
1454
|
+
If no index is given, non-zero `labels` are processed:
|
1455
|
+
|
1456
|
+
>>> ndimage.extrema(a, lbl)
|
1457
|
+
(1, 9, (0, 0), (3, 0))
|
1458
|
+
|
1459
|
+
"""
|
1460
|
+
dims = np.array(np.asarray(input).shape)
|
1461
|
+
# see np.unravel_index to understand this line.
|
1462
|
+
dim_prod = np.cumprod([1] + list(dims[:0:-1]))[::-1]
|
1463
|
+
|
1464
|
+
minimums, min_positions, maximums, max_positions = _select(input, labels,
|
1465
|
+
index,
|
1466
|
+
find_min=True,
|
1467
|
+
find_max=True,
|
1468
|
+
find_min_positions=True,
|
1469
|
+
find_max_positions=True)
|
1470
|
+
|
1471
|
+
if np.isscalar(minimums):
|
1472
|
+
return (minimums, maximums, tuple((min_positions // dim_prod) % dims),
|
1473
|
+
tuple((max_positions // dim_prod) % dims))
|
1474
|
+
|
1475
|
+
min_positions = [
|
1476
|
+
tuple(v) for v in (min_positions.reshape(-1, 1) // dim_prod) % dims
|
1477
|
+
]
|
1478
|
+
max_positions = [
|
1479
|
+
tuple(v) for v in (max_positions.reshape(-1, 1) // dim_prod) % dims
|
1480
|
+
]
|
1481
|
+
|
1482
|
+
return minimums, maximums, min_positions, max_positions
|
1483
|
+
|
1484
|
+
|
1485
|
+
def center_of_mass(input, labels=None, index=None):
|
1486
|
+
"""
|
1487
|
+
Calculate the center of mass of the values of an array at labels.
|
1488
|
+
|
1489
|
+
Parameters
|
1490
|
+
----------
|
1491
|
+
input : ndarray
|
1492
|
+
Data from which to calculate center-of-mass. The masses can either
|
1493
|
+
be positive or negative.
|
1494
|
+
labels : ndarray, optional
|
1495
|
+
Labels for objects in `input`, as generated by `ndimage.label`.
|
1496
|
+
Only used with `index`. Dimensions must be the same as `input`.
|
1497
|
+
index : int or sequence of ints, optional
|
1498
|
+
Labels for which to calculate centers-of-mass. If not specified,
|
1499
|
+
the combined center of mass of all labels greater than zero
|
1500
|
+
will be calculated. Only used with `labels`.
|
1501
|
+
|
1502
|
+
Returns
|
1503
|
+
-------
|
1504
|
+
center_of_mass : tuple, or list of tuples
|
1505
|
+
Coordinates of centers-of-mass.
|
1506
|
+
|
1507
|
+
Examples
|
1508
|
+
--------
|
1509
|
+
>>> import numpy as np
|
1510
|
+
>>> a = np.array(([0,0,0,0],
|
1511
|
+
... [0,1,1,0],
|
1512
|
+
... [0,1,1,0],
|
1513
|
+
... [0,1,1,0]))
|
1514
|
+
>>> from scipy import ndimage
|
1515
|
+
>>> ndimage.center_of_mass(a)
|
1516
|
+
(2.0, 1.5)
|
1517
|
+
|
1518
|
+
Calculation of multiple objects in an image
|
1519
|
+
|
1520
|
+
>>> b = np.array(([0,1,1,0],
|
1521
|
+
... [0,1,0,0],
|
1522
|
+
... [0,0,0,0],
|
1523
|
+
... [0,0,1,1],
|
1524
|
+
... [0,0,1,1]))
|
1525
|
+
>>> lbl = ndimage.label(b)[0]
|
1526
|
+
>>> ndimage.center_of_mass(b, lbl, [1,2])
|
1527
|
+
[(0.33333333333333331, 1.3333333333333333), (3.5, 2.5)]
|
1528
|
+
|
1529
|
+
Negative masses are also accepted, which can occur for example when
|
1530
|
+
bias is removed from measured data due to random noise.
|
1531
|
+
|
1532
|
+
>>> c = np.array(([-1,0,0,0],
|
1533
|
+
... [0,-1,-1,0],
|
1534
|
+
... [0,1,-1,0],
|
1535
|
+
... [0,1,1,0]))
|
1536
|
+
>>> ndimage.center_of_mass(c)
|
1537
|
+
(-4.0, 1.0)
|
1538
|
+
|
1539
|
+
If there are division by zero issues, the function does not raise an
|
1540
|
+
error but rather issues a RuntimeWarning before returning inf and/or NaN.
|
1541
|
+
|
1542
|
+
>>> d = np.array([-1, 1])
|
1543
|
+
>>> ndimage.center_of_mass(d)
|
1544
|
+
(inf,)
|
1545
|
+
"""
|
1546
|
+
input = np.asarray(input)
|
1547
|
+
normalizer = sum_labels(input, labels, index)
|
1548
|
+
grids = np.ogrid[[slice(0, i) for i in input.shape]]
|
1549
|
+
|
1550
|
+
results = [sum_labels(input * grids[dir].astype(float), labels, index) / normalizer
|
1551
|
+
for dir in range(input.ndim)]
|
1552
|
+
|
1553
|
+
if np.isscalar(results[0]):
|
1554
|
+
return tuple(results)
|
1555
|
+
|
1556
|
+
return [tuple(v) for v in np.array(results).T]
|
1557
|
+
|
1558
|
+
|
1559
|
+
def histogram(input, min, max, bins, labels=None, index=None):
|
1560
|
+
"""
|
1561
|
+
Calculate the histogram of the values of an array, optionally at labels.
|
1562
|
+
|
1563
|
+
Histogram calculates the frequency of values in an array within bins
|
1564
|
+
determined by `min`, `max`, and `bins`. The `labels` and `index`
|
1565
|
+
keywords can limit the scope of the histogram to specified sub-regions
|
1566
|
+
within the array.
|
1567
|
+
|
1568
|
+
Parameters
|
1569
|
+
----------
|
1570
|
+
input : array_like
|
1571
|
+
Data for which to calculate histogram.
|
1572
|
+
min, max : int
|
1573
|
+
Minimum and maximum values of range of histogram bins.
|
1574
|
+
bins : int
|
1575
|
+
Number of bins.
|
1576
|
+
labels : array_like, optional
|
1577
|
+
Labels for objects in `input`.
|
1578
|
+
If not None, must be same shape as `input`.
|
1579
|
+
index : int or sequence of ints, optional
|
1580
|
+
Label or labels for which to calculate histogram. If None, all values
|
1581
|
+
where label is greater than zero are used
|
1582
|
+
|
1583
|
+
Returns
|
1584
|
+
-------
|
1585
|
+
hist : ndarray
|
1586
|
+
Histogram counts.
|
1587
|
+
|
1588
|
+
Examples
|
1589
|
+
--------
|
1590
|
+
>>> import numpy as np
|
1591
|
+
>>> a = np.array([[ 0. , 0.2146, 0.5962, 0. ],
|
1592
|
+
... [ 0. , 0.7778, 0. , 0. ],
|
1593
|
+
... [ 0. , 0. , 0. , 0. ],
|
1594
|
+
... [ 0. , 0. , 0.7181, 0.2787],
|
1595
|
+
... [ 0. , 0. , 0.6573, 0.3094]])
|
1596
|
+
>>> from scipy import ndimage
|
1597
|
+
>>> ndimage.histogram(a, 0, 1, 10)
|
1598
|
+
array([13, 0, 2, 1, 0, 1, 1, 2, 0, 0])
|
1599
|
+
|
1600
|
+
With labels and no indices, non-zero elements are counted:
|
1601
|
+
|
1602
|
+
>>> lbl, nlbl = ndimage.label(a)
|
1603
|
+
>>> ndimage.histogram(a, 0, 1, 10, lbl)
|
1604
|
+
array([0, 0, 2, 1, 0, 1, 1, 2, 0, 0])
|
1605
|
+
|
1606
|
+
Indices can be used to count only certain objects:
|
1607
|
+
|
1608
|
+
>>> ndimage.histogram(a, 0, 1, 10, lbl, 2)
|
1609
|
+
array([0, 0, 1, 1, 0, 0, 1, 1, 0, 0])
|
1610
|
+
|
1611
|
+
"""
|
1612
|
+
_bins = np.linspace(min, max, bins + 1)
|
1613
|
+
|
1614
|
+
def _hist(vals):
|
1615
|
+
return np.histogram(vals, _bins)[0]
|
1616
|
+
|
1617
|
+
return labeled_comprehension(input, labels, index, _hist, object, None,
|
1618
|
+
pass_positions=False)
|
1619
|
+
|
1620
|
+
|
1621
|
+
def watershed_ift(input, markers, structure=None, output=None):
|
1622
|
+
"""
|
1623
|
+
Apply watershed from markers using image foresting transform algorithm.
|
1624
|
+
|
1625
|
+
Parameters
|
1626
|
+
----------
|
1627
|
+
input : array_like
|
1628
|
+
Input.
|
1629
|
+
markers : array_like
|
1630
|
+
Markers are points within each watershed that form the beginning
|
1631
|
+
of the process. Negative markers are considered background markers
|
1632
|
+
which are processed after the other markers.
|
1633
|
+
structure : structure element, optional
|
1634
|
+
A structuring element defining the connectivity of the object can be
|
1635
|
+
provided. If None, an element is generated with a squared
|
1636
|
+
connectivity equal to one.
|
1637
|
+
output : ndarray, optional
|
1638
|
+
An output array can optionally be provided. The same shape as input.
|
1639
|
+
|
1640
|
+
Returns
|
1641
|
+
-------
|
1642
|
+
watershed_ift : ndarray
|
1643
|
+
Output. Same shape as `input`.
|
1644
|
+
|
1645
|
+
References
|
1646
|
+
----------
|
1647
|
+
.. [1] A.X. Falcao, J. Stolfi and R. de Alencar Lotufo, "The image
|
1648
|
+
foresting transform: theory, algorithms, and applications",
|
1649
|
+
Pattern Analysis and Machine Intelligence, vol. 26, pp. 19-29, 2004.
|
1650
|
+
|
1651
|
+
"""
|
1652
|
+
input = np.asarray(input)
|
1653
|
+
if input.dtype.type not in [np.uint8, np.uint16]:
|
1654
|
+
raise TypeError('only 8 and 16 unsigned inputs are supported')
|
1655
|
+
|
1656
|
+
if structure is None:
|
1657
|
+
structure = _morphology.generate_binary_structure(input.ndim, 1)
|
1658
|
+
structure = np.asarray(structure, dtype=bool)
|
1659
|
+
if structure.ndim != input.ndim:
|
1660
|
+
raise RuntimeError('structure and input must have equal rank')
|
1661
|
+
for ii in structure.shape:
|
1662
|
+
if ii != 3:
|
1663
|
+
raise RuntimeError('structure dimensions must be equal to 3')
|
1664
|
+
|
1665
|
+
if not structure.flags.contiguous:
|
1666
|
+
structure = structure.copy()
|
1667
|
+
markers = np.asarray(markers)
|
1668
|
+
if input.shape != markers.shape:
|
1669
|
+
raise RuntimeError('input and markers must have equal shape')
|
1670
|
+
|
1671
|
+
integral_types = [np.int8,
|
1672
|
+
np.int16,
|
1673
|
+
np.int32,
|
1674
|
+
np.int64,
|
1675
|
+
np.intc,
|
1676
|
+
np.intp]
|
1677
|
+
|
1678
|
+
if markers.dtype.type not in integral_types:
|
1679
|
+
raise RuntimeError('marker should be of integer type')
|
1680
|
+
|
1681
|
+
if isinstance(output, np.ndarray):
|
1682
|
+
if output.dtype.type not in integral_types:
|
1683
|
+
raise RuntimeError('output should be of integer type')
|
1684
|
+
else:
|
1685
|
+
output = markers.dtype
|
1686
|
+
|
1687
|
+
output = _ni_support._get_output(output, input)
|
1688
|
+
_nd_image.watershed_ift(input, markers, structure, output)
|
1689
|
+
return output
|