def test_estimate_with_fixed(self, jhu_data, population_data, country): # Dataset population = population_data.value(country) record_df = jhu_data.subset(country, population=population) # Setting unit = PhaseUnit("27May2020", "27Jun2020", population) unit.set_ode(model=SIR, tau=360, rho=0.01) # Parameter estimation unit.estimate(record_df=record_df) assert unit.tau == unit.to_dict()[Term.TAU] == 360 assert unit.to_dict()["rho"] == 0.01
def test_estimate(self, jhu_data, population_data, country): # Dataset population = population_data.value(country) record_df = jhu_data.subset(country, population=population) # Parameter estimation unit = PhaseUnit("27May2020", "27Jun2020", population) with pytest.raises(NameError): unit.estimate() unit.set_ode(model=SIR) with pytest.raises(ValueError): unit.estimate() unit.record_df = record_df assert set(unit.record_df.columns) == set(Term.SUB_COLUMNS) unit.estimate(timeout=20) # Check results assert isinstance(unit.estimator, Estimator) assert set(SIR.PARAMETERS).issubset(unit.to_dict()) assert set(SIR.DAY_PARAMETERS).issubset(unit.to_dict()) assert None not in unit.to_dict().values()