rapids_singlecell.pp.scale#
- rapids_singlecell.pp.scale(adata, *, zero_center=True, max_value=None, copy=False, layer=None, obsm=None, mask_obs=None, inplace=True)[source]#
Scales matrix to unit variance and clips values
- Parameters:
- adata AnnData
AnnData object
- zero_center bool (default:
True
) If
False
, omit zero-centering variables, which allows to handle sparse input efficiently.- max_value float | None (default:
None
) Clip (truncate) to this value after scaling. If
None
, do not clip.- copy bool (default:
False
) Whether this function should be performed inplace. If an AnnData object is passed, this also determines if a copy is returned.
- layer str | None (default:
None
) If provided, which element of layers to scale.
- obsm str | None (default:
None
) If provided, which element of obsm to scale.
- mask_obs np.ndarray | str | None (default:
None
) Restrict both the derivation of scaling parameters and the scaling itself to a certain set of observations. The mask is specified as a boolean array or a string referring to an array in
obs
. If the matrix is in csc format and a mask is provided, the matrix will be transformed to csr format.- inplace bool (default:
True
) If True, update AnnData with results. Otherwise, return results. See below for details of what is returned.
- Return type:
None | cp.ndarray
- Returns:
Returns a scaled copy or updates
adata
with a scaled version of the originaladata.X
andadata.layers['layer']
, depending oninplace
.