diff --git a/examples/1_basic_tutorial.ipynb b/examples/1_basic_tutorial.ipynb index 4953a13..dcb7531 100755 --- a/examples/1_basic_tutorial.ipynb +++ b/examples/1_basic_tutorial.ipynb @@ -42,7 +42,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Using matplotlib backend: \n" + "Using matplotlib backend: \n" ] } ], @@ -79,7 +79,15 @@ "execution_count": 5, "id": "db044f07", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Torch not compiled with CUDA enabled\n" + ] + } + ], "source": [ "device = \"cpu\"\n", "try:\n", diff --git a/tests/test_alternative_input.py b/tests/test_alternative_input.py index 7b1f5a0..19663f3 100644 --- a/tests/test_alternative_input.py +++ b/tests/test_alternative_input.py @@ -16,8 +16,6 @@ def test_from_adata(pandas_input): mask = pandas_input["masks"][view_idx] cov = pandas_input["covariates"] - n_factors = mask.shape[0] - adata = ad.AnnData(obs) adata.obsm["X_np"] = obs.iloc[:, : (obs.shape[1] // 2)].values adata.obsm["X_pd"] = obs.iloc[:, : (obs.shape[1] // 2)] @@ -41,9 +39,11 @@ def test_from_adata(pandas_input): if obs_key_val == "": obs_key_val = None + n_factors = 0 prior_mask_key_val = prior_mask_key if prior_mask_key_val == "": prior_mask_key_val = None + n_factors = mask.shape[0] covariate_key_val = covariate_key if covariate_key_val == "": @@ -69,8 +69,6 @@ def test_from_adata(pandas_input): def test_from_mdata(pandas_input): - n_factors = pandas_input["masks"][0].shape[0] - adata_dict = {} for view_idx, view_obs in enumerate(pandas_input["observations"]): @@ -101,9 +99,11 @@ def test_from_mdata(pandas_input): if obs_key_val == "": obs_key_val = None + n_factors = 0 prior_mask_key_val = prior_mask_key if prior_mask_key_val == "": prior_mask_key_val = None + n_factors = pandas_input["masks"][0].shape[0] covariate_key_val = covariate_key if covariate_key_val == "": diff --git a/tests/test_prior.py b/tests/test_prior.py index b52ed10..801395c 100755 --- a/tests/test_prior.py +++ b/tests/test_prior.py @@ -1,36 +1,23 @@ from muvi import MuVI -def test_fewer_n_factors(pandas_input): - model = MuVI( - pandas_input["observations"], - pandas_input["masks"], - pandas_input["covariates"], - n_factors=pandas_input["n_factors"] - 2, - view_names=pandas_input["view_names"], - device="cpu", - ) - - assert model.n_factors == pandas_input["n_factors"] - - def test_more_n_factors(pandas_input): - n_dense = 2 + n_factors = 2 model = MuVI( pandas_input["observations"], pandas_input["masks"], pandas_input["covariates"], - n_factors=pandas_input["n_factors"] + n_dense, + n_factors=n_factors, view_names=pandas_input["view_names"], device="cpu", ) - assert model.n_factors == pandas_input["n_factors"] + n_dense + assert model.n_factors == pandas_input["n_factors"] + n_factors assert ( - model.factor_names[-n_dense:] == [f"dense_{k}" for k in range(n_dense)] + model.factor_names[-n_factors:] == [f"dense_{k}" for k in range(n_factors)] ).all() for prior_mask in model.get_prior_masks().values(): assert prior_mask.shape[0] == model.n_factors - assert prior_mask[-n_dense:, :].all() + assert prior_mask[-n_factors:, :].all()