def __init__(self, params_names: list): super(StochasticSEIRModel, self).__init__() self._parameters = se.SEIRParameters(params_names) # sets up n compartments, returns names of output variables # Define the names of the compartments to record - default all self._output_collector = se.StochasticOutputCollector( ['S', 'E', 'I', 'R'])
def __init__(self): super(DeterministicSEIRModel, self).__init__() # Assign default values self._output_collector = seirmo.SEIROutputCollector( ['S', 'E', 'I', 'R', 'Incidence']) self._parameters = seirmo.SEIRParameters( ['S0', 'E0', 'I0', 'R0', 'alpha', 'beta', 'gamma'])
def test_parameter_names(self): testSubject = se.SEIRParameters(['a', 'b']) self.assertEqual(['a', 'b'], testSubject.parameter_names())
def test_n_parameters(self): testSubject = se.SEIRParameters(['a', 'b']) self.assertEqual(2, testSubject.n_parameters())
def test__getitem__(self): testSubject = se.SEIRParameters(['a', 'b']) params = np.array([1, 2]) testSubject.configure_parameters(params) for i in range(params.shape[0]): self.assertEqual(params[i], testSubject[i])
def test_configureParametersError(self): testSubject = se.SEIRParameters(['a', 'b']) with self.assertRaises(AssertionError): testSubject.configure_parameters(np.array([1, 2, 3]))
def test_configureParameters(self): testSubject = se.SEIRParameters(['a', 'b']) testSubject.configure_parameters(np.zeros((2, )))
def test__init__(self): se.SEIRParameters([])