Skip to content

Commit efa841e

Browse files
entered constraints into continous() arguments
1 parent 30e56bb commit efa841e

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

diffxpy/testing/tests.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,10 @@ def continuous_1d(
16451645
init_b: Union[np.ndarray, str] = "standard",
16461646
gene_names: Union[np.ndarray, list] = None,
16471647
sample_description=None,
1648+
dmat_loc: Union[patsy.design_info.DesignMatrix, xr.Dataset] = None,
1649+
dmat_scale: Union[patsy.design_info.DesignMatrix, xr.Dataset] = None,
1650+
constraints_loc: np.ndarray = None,
1651+
constraints_scale: np.ndarray = None,
16481652
noise_model: str = 'nb',
16491653
size_factors: np.ndarray = None,
16501654
batch_size: int = None,
@@ -1717,6 +1721,32 @@ def continuous_1d(
17171721
- np.ndarray: direct initialization of 'b'
17181722
:param gene_names: optional list/array of gene names which will be used if `data` does not implicitly store these
17191723
:param sample_description: optional pandas.DataFrame containing sample annotations
1724+
:param dmat_loc: Pre-built location model design matrix.
1725+
This over-rides formula_loc and sample description information given in
1726+
data or sample_description.
1727+
:param dmat_scale: Pre-built scale model design matrix.
1728+
This over-rides formula_scale and sample description information given in
1729+
data or sample_description.
1730+
:param constraints_loc: : Constraints for location model.
1731+
Array with constraints in rows and model parameters in columns.
1732+
Each constraint contains non-zero entries for the a of parameters that
1733+
has to sum to zero. This constraint is enforced by binding one parameter
1734+
to the negative sum of the other parameters, effectively representing that
1735+
parameter as a function of the other parameters. This dependent
1736+
parameter is indicated by a -1 in this array, the independent parameters
1737+
of that constraint (which may be dependent at an earlier constraint)
1738+
are indicated by a 1. It is highly recommended to only use this option
1739+
together with prebuilt design matrix for the location model, dmat_loc.
1740+
:param constraints_scale: : Constraints for scale model.
1741+
Array with constraints in rows and model parameters in columns.
1742+
Each constraint contains non-zero entries for the a of parameters that
1743+
has to sum to zero. This constraint is enforced by binding one parameter
1744+
to the negative sum of the other parameters, effectively representing that
1745+
parameter as a function of the other parameters. This dependent
1746+
parameter is indicated by a -1 in this array, the independent parameters
1747+
of that constraint (which may be dependent at an earlier constraint)
1748+
are indicated by a 1. It is highly recommended to only use this option
1749+
together with prebuilt design matrix for the scale model, dmat_scale.
17201750
:param noise_model: str, noise model to use in model-based unit_test. Possible options:
17211751
17221752
- 'nb': default
@@ -1901,6 +1931,6 @@ def continuous_1d(
19011931
spline_coefs=new_coefs
19021932
)
19031933
else:
1904-
raise ValueError('base.continuous(): Parameter `test` not recognized.')
1934+
raise ValueError('continuous(): Parameter `test` not recognized.')
19051935

19061936
return de_test

0 commit comments

Comments
 (0)