|
11 | 11 | from ..._docs import doc_rng |
12 | 12 | from ..._settings import settings |
13 | 13 | from ..._utils import _doc_params, _empty, get_literal_vals, is_backed_type |
14 | | -from ..._utils.random import ( |
15 | | - _accepts_legacy_random_state, |
16 | | - _legacy_random_state, |
17 | | - _LegacyRng, |
18 | | -) |
| 14 | +from ..._utils.random import _accepts_legacy_random_state, _legacy_random_state |
19 | 15 | from ...get import _check_mask, _get_obs_rep |
20 | 16 | from .._docs import doc_mask_var_hvg |
21 | 17 | from ._compat import _pca_compat_sparse |
@@ -207,7 +203,6 @@ def pca( # noqa: PLR0912, PLR0913, PLR0915 |
207 | 203 | """ |
208 | 204 | logg_start = logg.info("computing PCA") |
209 | 205 | rng = np.random.default_rng(rng) |
210 | | - rng_is_default = isinstance(rng, _LegacyRng) and rng.arg == 0 |
211 | 206 | if (layer is not None or obsm is not None) and chunked: |
212 | 207 | # Current chunking implementation relies on pca being called on X |
213 | 208 | msg = "Cannot use `layer`/`obsm` and `chunked` at the same time." |
@@ -247,7 +242,7 @@ def pca( # noqa: PLR0912, PLR0913, PLR0915 |
247 | 242 | raise NotImplementedError(msg) |
248 | 243 |
|
249 | 244 | if chunked: |
250 | | - if not zero_center or not rng_is_default or svd_solver not in {None, "arpack"}: |
| 245 | + if not zero_center or svd_solver not in {None, "arpack"}: |
251 | 246 | logg.debug("Ignoring zero_center, rng, svd_solver") |
252 | 247 |
|
253 | 248 | incremental_pca_kwargs = dict() |
@@ -296,14 +291,6 @@ def pca( # noqa: PLR0912, PLR0913, PLR0915 |
296 | 291 | elif isinstance(x._meta, CSBase) or svd_solver == "covariance_eigh": |
297 | 292 | from ._dask import PCAEighDask |
298 | 293 |
|
299 | | - if not rng_is_default: |
300 | | - dbg = ( |
301 | | - f"random_state={_legacy_random_state(rng)!r}" |
302 | | - if isinstance(rng, _LegacyRng) |
303 | | - else f"rng={rng!r}" |
304 | | - ) |
305 | | - msg = f"Ignoring {dbg} when using a sparse dask array" |
306 | | - warn(msg, UserWarning) |
307 | 294 | if svd_solver not in {None, "covariance_eigh"}: |
308 | 295 | msg = f"Ignoring {svd_solver=} when using a sparse dask array" |
309 | 296 | warn(msg, UserWarning) |
|
0 commit comments