pagetitle |
---|
ABC |
Some background information will go here.
The logistic model looks like:
where C(t) is the population of cells at time
-
Create a python file
abc_rejction.py
. -
Write a function with the following signature that will simulate a time-course from the logistic model above:
def logistic(t, r, k, s):
Where
$t$ is expected to be a numpy array of time points (for instance, fromnp.linspace(0, 10, 100)
),$r$ is expected to be a positive real number representing the population growth rate,$k$ is a positive real number representing the carrying capacity, and$s$ is a small positive real number representing the scale of the normal noise term.This function should return a numpy array, the same length as
$t$ , where the logistic function above has been evaluated at teach of the time points. -
Using
matplotlib
, plot a simulated time course from your logistic model:import matplotlib.pyplot as plt import numpy as np t = np.linspace(0, 10, 100) c = logistic(t, 1.23, 24.5, 0.345) plt.plot(t, c) plt.show()
-
Create a python file
test_abc.py
. -
Write a function with the following signature that will test your logistic function:
def test_logistic():
-
Check that, with
$t=0$ and no noise, your logistic model returns$C_0$ :t = np.array(0.0) assert logistic(t, 1.23, 2.34, 0.0) == C0
-
Add as many more checks as you can think of, to assure yourself that your logistic function is implemented correctly.