Exemple #1
0
 def test_must_share(self, community, strategy):
     community.reactions.EX_glc__D_m.lower_bound = -5
     sol = community.optcom(strategy=strategy, min_growth=1.0)
     assert sol is None
     sol = community.optcom(strategy=strategy, min_growth=0.0)
     assert sol.growth_rate > 0.4
     assert (sol.members.growth_rate.dropna() > 0.4).any()
Exemple #2
0
 def test_conservation(self, community):
     community.solver = "glpk"
     community.reactions.EX_glc__D_m.lower_bound = -5
     sol = community.optcom(strategy="lmoma", fluxes=True)
     imports = sol["EX_glc__D_e"][0:4]
     total_influx = community.abundances.dot(imports)
     assert np.allclose(total_influx, -5)
Exemple #3
0
 def test_bad_mingrowth(self, community, f):
     community.solver = "glpk"
     with pytest.raises(ValueError):
         sol = community.optcom(strategy="lmoma", min_growth=f)
Exemple #4
0
 def test_good_mingrowth(self, community, f):
     community.solver = "glpk"
     sol = community.optcom(strategy="lmoma", min_growth=f)
     assert np.allclose(sol.growth_rate, 0.873922)
     assert np.allclose(sol.members.growth_rate.dropna().sum(),
                        4 * 0.873922)
Exemple #5
0
 def test_is_consistent(self, community, strategy):
     community.solver = "glpk"
     sol = community.optcom(strategy=strategy)
     assert np.allclose(sol.growth_rate, 0.873922)
     assert np.allclose(sol.members.growth_rate.dropna().sum(),
                        4 * 0.873922)