Skip to content

Commit

Permalink
Update src/rapids_singlecell/preprocessing/_scale.py
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp A. <[email protected]>
  • Loading branch information
Intron7 and flying-sheep authored Nov 12, 2024
1 parent c02b0e0 commit d2d2e45
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/rapids_singlecell/preprocessing/_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,24 +327,16 @@ def __dense(X_part):
dtype=X.dtype,
meta=_meta_dense(X.dtype),
)
return _scale_dask_array_zc(
X, mask_array=mask_array, mean=mean, std=std, max_value=max_value
)

scale = _scale_dask_array_zc
elif isinstance(X._meta, sparse.csr_matrix) and not zero_center:
return _scale_sparse_csr_dask(
X, mask_array=mask_array, mean=mean, std=std, max_value=max_value
)

scale = _scale_sparse_csr_dask
elif isinstance(X._meta, cp.ndarray) and zero_center:
return _scale_dask_array_zc(
X, mask_array=mask_array, mean=mean, std=std, max_value=max_value
)

scale = _scale_dask_array_zc
elif isinstance(X._meta, cp.ndarray) and not zero_center:
return _scale_dask_array_nzc(
X, mask_array=mask_array, mean=mean, std=std, max_value=max_value
)
scale = _scale_dask_array_nzc
else:
TODO # raise error
return scale(X, mask_array=mask_array, mean=mean, std=std, max_value=max_value)


def _scale_dask_array_zc(X, *, mask_array, mean, std, max_value):
Expand Down

0 comments on commit d2d2e45

Please sign in to comment.