def test_estimate_parameters(self, timestamps, measurements): from colonyscanalyser.utilities import round_tuple_floats assert GrowthCurveModel.estimate_parameters(timestamps, list()) == (0, 0, 0) assert GrowthCurveModel.estimate_parameters( timestamps, measurements, window=len(timestamps) + 1) == (0, 0, 0) with pytest.raises(ValueError): GrowthCurveModel.estimate_parameters(timestamps, [0]) assert round_tuple_floats( GrowthCurveModel.estimate_parameters(timestamps, measurements), 1) == (0.5, 1, 1) assert GrowthCurveModel.estimate_parameters( [0, 0, 0, 0, 0, 0], [0, 1, 3, 6, 10, 15], window=3) == (0, 5, 16.414213562373096)
def test_init_model(self): with pytest.raises(ValueError): GrowthCurveModel(self)
def test_curve_fit(self): params = list(range(10)) assert GrowthCurveModel._fit_curve( lambda x, y: x * y, params, list( reversed(params)), maxfev=1) is None
def test_gompertz(self): assert GrowthCurveModel._gompertz(1, 1, 1, 1, 1) == 1.6583785030111096 assert GrowthCurveModel._gompertz(1, 1, 1, 1, 0) == 0