Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
46558fd
init
selmanozleyen Mar 2, 2026
b64ebc9
rng can't be none inside test
selmanozleyen Mar 2, 2026
2fb875c
update img references
selmanozleyen Mar 2, 2026
60972af
root_seed can't be none
selmanozleyen Mar 2, 2026
7a12160
undo ligrec rng to rs again
selmanozleyen Mar 2, 2026
7a652ea
checkout images from main
selmanozleyen Mar 2, 2026
01fc831
update reprod test pickle
selmanozleyen Mar 2, 2026
5951a79
undo no_numba changes
selmanozleyen Mar 2, 2026
b4a2b58
Merge branch 'main' into feat/ligrec-rng-threading
selmanozleyen Mar 8, 2026
6230aed
refactor ligrec: replace parallelize with threading + numba nogil
selmanozleyen Mar 11, 2026
2de8fd5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 11, 2026
fc62c07
Merge branch 'main' into feat/remove-ligrec-parallelize
selmanozleyen Mar 11, 2026
4cdf709
undo extract_adata
selmanozleyen Mar 11, 2026
6ec9571
undo changes
selmanozleyen Mar 11, 2026
d6324d5
checkout main
selmanozleyen Mar 11, 2026
df46993
remove old test
selmanozleyen Mar 11, 2026
2f999dc
also deprecate backend
selmanozleyen Mar 11, 2026
c7c775e
Merge branch 'main' into feat/remove-ligrec-parallelize
selmanozleyen Mar 16, 2026
3a62d7d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 16, 2026
8f8a192
update conf
selmanozleyen Mar 16, 2026
0c1add0
use _get_n_cores
selmanozleyen Mar 16, 2026
d8dc655
use thread_map
selmanozleyen Mar 16, 2026
fb5c2e7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 16, 2026
165544d
update threadmap
selmanozleyen Mar 16, 2026
e331774
Merge branch 'main' into feat/ligrec-rng-threading
selmanozleyen Mar 26, 2026
59b3472
Merge branch 'main' into feat/remove-ligrec-parallelize
selmanozleyen Mar 26, 2026
b73f78d
Merge branch 'main' into feat/remove-ligrec-parallelize
selmanozleyen Apr 2, 2026
288010d
Merge branch 'main' into feat/remove-ligrec-parallelize
selmanozleyen Apr 9, 2026
c2d660a
Merge branch 'main' into feat/ligrec-rng-threading
selmanozleyen Apr 13, 2026
0e74c3c
Merge branch 'main' into feat/remove-ligrec-parallelize
selmanozleyen May 12, 2026
c1c6df2
Merge branch 'main' into feat/ligrec-rng-threading
selmanozleyen Jun 19, 2026
9728526
upload reference as anndata
selmanozleyen Jun 19, 2026
0bc5c7a
Merge branch 'main' into feat/remove-ligrec-parallelize
selmanozleyen Jun 19, 2026
ab77f29
undo changes
selmanozleyen Jun 19, 2026
811438f
Merge branch 'feat/ligrec-rng-threading' into feat/remove-ligrec-para…
selmanozleyen Jun 19, 2026
ed1c9a1
remove pickle file
selmanozleyen Jun 19, 2026
b7eb787
remove pickle loader
selmanozleyen Jun 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
numpy=("https://numpy.org/doc/stable", None),
statsmodels=("https://www.statsmodels.org/stable", None),
scipy=("https://docs.scipy.org/doc/scipy", None),
pandas=("https://pandas.pydata.org/pandas-docs/stable", None),
pandas=("https://pandas.pydata.org/docs", None),
anndata=("https://anndata.readthedocs.io/en/stable", None),
scanpy=("https://scanpy.readthedocs.io/en/stable", None),
matplotlib=("https://matplotlib.org/stable", None),
Expand Down
41 changes: 41 additions & 0 deletions src/squidpy/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import numpy as np
import xarray as xr
from spatialdata.models import Image2DModel, Labels2DModel
from tqdm.auto import tqdm

__all__ = ["singledispatchmethod", "Signal", "SigQueue", "NDArray", "NDArrayA"]

Expand Down Expand Up @@ -228,6 +229,46 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
return wrapper


def thread_map(
fn: Callable[..., Any],
items: Iterable[Any],
*,
n_jobs: int = 1,
show_progress_bar: bool = False,
unit: str = "item",
total: int | None = None,
) -> list[Any]:
"""Map *fn* over *items* using a thread pool with an optional progress bar.

Parameters
----------
fn
Callable applied to each element of *items*.
items
Iterable of inputs passed one-by-one to *fn*.
n_jobs
Number of worker threads. ``1`` runs sequentially (no pool overhead).
show_progress_bar
Whether to display a ``tqdm`` progress bar.
unit
Label shown next to the ``tqdm`` counter.
total
Length hint passed to ``tqdm`` when *items* has no ``__len__``.

Returns
-------
list
Results in the same order as *items*.
"""
from concurrent.futures import ThreadPoolExecutor

with ThreadPoolExecutor(max_workers=n_jobs) as pool:
it = pool.map(fn, items)
if show_progress_bar and tqdm is not None:
it = tqdm(it, total=len(items), unit=unit)
return list(it)


def _get_n_cores(n_cores: int | None) -> int:
"""
Make number of cores a positive integer.
Expand Down
Loading
Loading