rapids_singlecell.pp.sqrt

Contents

rapids_singlecell.pp.sqrt#

rapids_singlecell.pp.sqrt(data, *, layer=None, obsm=None, inplace=True, copy=False)[source]#

Take the square root of the data matrix.

Computes \(X = \sqrt{X}\).

Parameters:
data Union[AnnData, ndarray, csc_matrix, csr_matrix, Array]

The (annotated) data matrix of shape n_obs × n_vars. Rows correspond to cells and columns to genes. If a matrix is passed instead of an AnnData object, the transformed matrix is returned.

layer str | None (default: None)

Layer to transform instead of X. If None, X is transformed.

obsm str | None (default: None)

Entry of .obsm to transform.

inplace bool (default: True)

Whether to update data or return the matrix. Only applies to AnnData input.

copy bool (default: False)

Whether to return a copy or update data. Not compatible with inplace=False. Only applies to AnnData input.

Return type:

Union[AnnData, spmatrix, ndarray, None]

Returns:

The resulting matrix after applying the square root to the input matrix. If a matrix is passed, the transformed matrix is returned. If an AnnData object is passed and copy is True, returns the modified AnnData. Otherwise, updates the data object in-place and returns None.