rapids_singlecell.pp.log1p

Contents

rapids_singlecell.pp.log1p#

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

Logarithmize the data matrix.

Computes \(X = \log(X + 1)\), where \(log\) denotes the natural logarithm unless a different base is given.

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.

base float | None (default: None)

Base of the logarithm. Natural logarithm is used by default.

layer str | None (default: None)

Layer to normalize instead of X. If None, X is normalized.

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 logarithm of one plus 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.