Metadata-Version: 2.4
Name: fast-array-utils
Version: 1.2.2
Summary: Fast array utilities with minimal dependencies.
Project-URL: Documentation, https://icb-fast-array-utils.readthedocs-hosted.com/
Project-URL: Issue Tracker, https://github.com/scverse/fast-array-utils/issues
Project-URL: Source Code, https://github.com/scverse/fast-array-utils
Author-email: "Philipp A." <flying-sheep@web.de>
License-Expression: MPL-2.0
License-File: LICENSE.rst
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: numpy>=1.25.2
Provides-Extra: accel
Requires-Dist: numba>=0.57; extra == 'accel'
Provides-Extra: doc
Requires-Dist: furo>=2024.8.6; extra == 'doc'
Requires-Dist: pytest>=8.4; extra == 'doc'
Requires-Dist: scanpydoc>=0.15.4; extra == 'doc'
Requires-Dist: sphinx-autodoc-typehints>=3.2; extra == 'doc'
Requires-Dist: sphinx-autofixture>=0.4.1; extra == 'doc'
Requires-Dist: sphinx>=8.2.3; extra == 'doc'
Provides-Extra: full
Requires-Dist: dask; extra == 'full'
Requires-Dist: h5py; extra == 'full'
Requires-Dist: numba>=0.57; extra == 'full'
Requires-Dist: scipy>=1.11; extra == 'full'
Requires-Dist: zarr; extra == 'full'
Provides-Extra: min-reqs
Requires-Dist: numpy==1.25.2; extra == 'min-reqs'
Provides-Extra: sparse
Requires-Dist: scipy>=1.11; extra == 'sparse'
Provides-Extra: test
Requires-Dist: anndata; extra == 'test'
Requires-Dist: coverage[toml]; extra == 'test'
Requires-Dist: numba>=0.57; extra == 'test'
Requires-Dist: numcodecs<0.16; extra == 'test'
Requires-Dist: packaging; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-codspeed; extra == 'test'
Requires-Dist: pytest-doctestplus; extra == 'test'
Requires-Dist: scipy>=1.11; extra == 'test'
Requires-Dist: zarr<3; extra == 'test'
Provides-Extra: test-min
Requires-Dist: coverage[toml]; extra == 'test-min'
Requires-Dist: packaging; extra == 'test-min'
Requires-Dist: pytest; extra == 'test-min'
Requires-Dist: pytest-codspeed; extra == 'test-min'
Requires-Dist: pytest-doctestplus; extra == 'test-min'
Requires-Dist: scipy>=1.11; extra == 'test-min'
Provides-Extra: testing
Requires-Dist: packaging; extra == 'testing'
Description-Content-Type: text/x-rst



usage
-----

``fast-array-utils`` supports the following array types:

- ``numpy.ndarray``
- ``scipy.sparse.cs{rc}_{array,matrix}``
- ``cupy.ndarray`` and ``cupyx.scipy.sparse.cs{rc}_matrix``
- ``dask.array.Array``
- ``h5py.Dataset`` and ``zarr.Array``
- ``anndata.abc.CS{CR}Dataset`` (only supported by ``.conv.to_dense`` at the moment)

Use ``fast_array_utils.conv.to_dense`` to densify arrays and optionally move them to CPU memory:

.. code:: python

   from fast_array_utils.conv import to_dense

   numpy_arr = to_dense(sparse_arr_or_mat)
   numpy_arr = to_dense(dask_or_cuda_arr, to_cpu_memory=True)
   dense_dask_arr = to_dense(dask_arr)
   dense_cupy_arr = to_dense(sparse_cupy_mat)

Use ``fast_array_utils.conv.*`` to calculate statistics across one or both axes of a 2D array.
All of them support an `axis` and `dtype` parameter:

.. code:: python

   from fast_array_utils import stats

   all_equal = stats.is_constant(arr_2d)
   col_sums = stats.sum(arr_2d, axis=0)
   mean = stats.mean(arr_2d)
   row_means, row_vars = stats.mean_var(arr_2d, axis=1)

installation
------------

To use ``fast_array_utils.stats`` or ``fast_array_utils.conv``:

.. code:: bash

   (uv) pip install 'fast-array-utils[accel]'

To use ``testing.fast_array_utils``:

.. code:: bash

   (uv) pip install 'fast-array-utils[testing]'
