Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit b5a42c4

Browse files
committed
Fix TestConstrained
1 parent 8bda25d commit b5a42c4

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

diffxpy/unit_test/test_constrained.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,15 @@ def test_forfatal_from_string(self):
4545
dmat_est = pd.DataFrame(data=dmat, columns=coefficient_names)
4646

4747
dmat_est_loc, _ = de.utils.design_matrix(dmat=dmat_est, return_type="dataframe")
48-
dmat_est_scale, _ = de.utils.design_matrix(dmat=dmat_est, return_type="dataframe")
48+
dmat_est_scale, _ = de.utils.design_matrix(dmat=pd.DataFrame(dmat_est['intercept']), return_type="dataframe")
4949

5050
# Build constraints:
5151
constraints_loc = de.utils.constraint_matrix_from_string(
5252
dmat=dmat_est_loc.values,
5353
coef_names=dmat_est_loc.columns,
5454
constraints=["bio1+bio2=0", "bio3+bio4=0"]
5555
)
56-
constraints_scale = de.utils.constraint_matrix_from_string(
57-
dmat=dmat_est_scale.values,
58-
coef_names=dmat_est_scale.columns,
59-
constraints=["bio1+bio2=0", "bio3+bio4=0"]
60-
)
56+
constraints_scale = None
6157

6258
test = de.test.wald(
6359
data=model.x,
@@ -101,9 +97,9 @@ def test_forfatal_from_dict(self):
10197
gene_names=model.features,
10298
sample_description=sample_description,
10399
formula_loc="~1+cond+batch",
104-
formula_scale="~1+cond+batch",
100+
formula_scale="~1",
105101
constraints_loc={"batch": "cond"},
106-
constraints_scale={"batch": "cond"},
102+
constraints_scale=None,
107103
coef_to_test=["cond[T.cond1]"]
108104
)
109105
_ = test.summary()
@@ -144,9 +140,9 @@ def test_null_distribution_wald_constrained(self, n_genes: int = 100):
144140
gene_names=model.features,
145141
sample_description=sample_description,
146142
formula_loc="~1+cond+batch",
147-
formula_scale="~1+cond+batch",
143+
formula_scale="~1",
148144
constraints_loc={"batch": "cond"},
149-
constraints_scale={"batch": "cond"},
145+
constraints_scale=None,
150146
coef_to_test=["cond[T.cond1]"]
151147
)
152148
_ = test.summary()

0 commit comments

Comments
 (0)