Skip to content

Commit

Permalink
allow random state in blobs (#2683)
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp A. <flying-sheep@web.de>
  • Loading branch information
eroell and flying-sheep committed Oct 16, 2023
1 parent 42e3c2a commit 27f6b56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/release-notes/1.10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
```{rubric} Features
```

* {func}`scanpy.datasets.blobs` now accepts a `random_state` argument {pr}`2683` {smaller}`E Roellin`
* {func}`scanpy.pp.pca` and {func}`scanpy.pp.regress_out` now accept a layer argument {pr}`2588` {smaller}`S Dicks`
* {func}`scanpy.pp.subsample` with `copy=True` can now be called in backed mode {pr}`2624` {smaller}`E Roellin`
* {func}`scanpy.pp.neighbors` now has a `transformer` argument allowing for more flexibility {pr}`2536` {smaller}`P Angerer`
Expand Down
6 changes: 5 additions & 1 deletion scanpy/datasets/_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from .._settings import settings
from ..readwrite import read, read_visium
from ._utils import check_datasetdir_exists, filter_oldformatwarning
from .._utils import AnyRandom

HERE = Path(__file__).parent

Expand All @@ -19,6 +20,7 @@ def blobs(
n_centers: int = 5,
cluster_std: float = 1.0,
n_observations: int = 640,
random_state: AnyRandom = 0,
) -> ad.AnnData:
"""\
Gaussian Blobs.
Expand All @@ -34,6 +36,8 @@ def blobs(
n_observations
Number of observations. By default, this is the same observation number
as in :func:`scanpy.datasets.krumsiek11`.
random_state
Determines random number generation for dataset creation.
Returns
-------
Expand All @@ -47,7 +51,7 @@ def blobs(
n_features=n_variables,
centers=n_centers,
cluster_std=cluster_std,
random_state=0,
random_state=random_state,
)
return ad.AnnData(X, obs=dict(blobs=y.astype(str)))

Expand Down

0 comments on commit 27f6b56

Please sign in to comment.