def test_log1p_chunked(): A = np.random.rand(200, 10) ad = AnnData(A) ad2 = AnnData(A) ad3 = AnnData(A) ad3.filename = 'test.h5ad' sc.pp.log1p(ad) sc.pp.log1p(ad2, chunked=True) assert np.allclose(ad2.X, ad.X) sc.pp.log1p(ad3, chunked=True) assert np.allclose(ad3.X, ad.X)
def test_log1p(tmp_path): A = np.random.rand(200, 10) A_l = np.log1p(A) ad = AnnData(A) ad2 = AnnData(A) ad3 = AnnData(A) ad3.filename = tmp_path / 'test.h5ad' sc.pp.log1p(ad) assert np.allclose(ad.X, A_l) sc.pp.log1p(ad2, chunked=True) assert np.allclose(ad2.X, ad.X) sc.pp.log1p(ad3, chunked=True) assert np.allclose(ad3.X, ad.X) # Test base ad4 = AnnData(A) sc.pp.log1p(ad4, base=2) assert np.allclose(ad4.X, A_l / np.log(2))