scanpy.pp.log1p(data, *, base=None, copy=False, chunked=None, chunk_size=None, layer=None, obsm=None)[source]#

Logarithmize the data matrix.

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

data AnnData | ndarray | spmatrix

The (annotated) data matrix of shape n_obs × n_vars. Rows correspond to cells and columns to genes.

base Number | None (default: None)

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

copy bool (default: False)

If an AnnData is passed, determines whether a copy is returned.

chunked bool | None (default: None)

Process the data matrix in chunks, which will save memory. Applies only to AnnData.

chunk_size int | None (default: None)

n_obs of the chunks to process the data in.

layer str | None (default: None)

Entry of layers to transform.

obsm str | None (default: None)

Entry of obsm to transform.

Return type:

AnnData | ndarray | spmatrix | None


Returns or updates data, depending on copy.