Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dingo/PolytopeSampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def generate_steady_states(
parallel_mmcs -- a boolean flag to request the parallel mmcs
num_threads -- the number of threads to use for parallel mmcs
"""
if not isinstance(ess, int) or ess < 10:
raise ValueError("The effective sample size (ess) must be an integer greater than or equal to 10.")

self.get_polytope()

Expand Down
8 changes: 8 additions & 0 deletions tests/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ def test_sample_sbml(self):

self.assertTrue( steady_states.shape[0] == 95 )
self.assertTrue( abs( steady_states[12].mean() - 2.504 ) < 1e-02 )

def test_invalid_ess(self):
input_file_json = os.getcwd() + "/ext_data/e_coli_core.json"
model = MetabolicNetwork.from_json(input_file_json)
sampler = PolytopeSampler(model)

with self.assertRaises(ValueError):
sampler.generate_steady_states(ess=5)



Expand Down