Skip to content

Commit

Permalink
Fix test_norm_power_group
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Heumos <[email protected]>
  • Loading branch information
Zethson committed Jan 31, 2025
1 parent 76e598a commit c8f5a12
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/preprocessing/test_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,13 @@ def test_norm_power_group(array_type, adata_mini):
with pytest.raises(KeyError):
ep.pp.power_norm(adata_mini_casted, group_key="invalid_key", copy=True)

ep.pp.power_norm(
adata_mini_norm = ep.pp.power_norm(
adata_mini_casted,
vars=["sys_bp_entry", "dia_bp_entry"],
group_key="disease",
copy=True,
)
np.array(
col1_norm = np.array(
[
-1.34266204,
-0.44618949,
Expand All @@ -623,7 +623,7 @@ def test_norm_power_group(array_type, adata_mini):
],
dtype=np.float32,
)
np.array(
col2_norm = np.array(
[
[
-1.3650659,
Expand All @@ -638,11 +638,11 @@ def test_norm_power_group(array_type, adata_mini):
],
dtype=np.float32,
)
# The tests are disabled because depending on weird dependency versions they currently give different results
assert adata_mini.X.dtype.kind == "f"
# assert np.allclose(adata_mini_norm.X[:, 0], adata_mini_casted.X[:, 0], rtol=1e-02, atol=1e-02)
# assert np.allclose(adata_mini_norm.X[:, 1], col1_norm, rtol=1e-02, atol=1e-02)
# assert np.allclose(adata_mini_norm.X[:, 2], col2_norm, rtol=1e-02, atol=1e-02)
# The tests are disabled (= tolerance set to 1)
# because depending on weird dependency versions they currently give different results
assert np.allclose(adata_mini_norm.X[:, 0], adata_mini_casted.X[:, 0], rtol=1, atol=1)
assert np.allclose(adata_mini_norm.X[:, 1], col1_norm, rtol=1, atol=1)
assert np.allclose(adata_mini_norm.X[:, 2], col2_norm, rtol=1, atol=1)


@pytest.mark.parametrize(
Expand Down

0 comments on commit c8f5a12

Please sign in to comment.