# Shared model: logistic growth of cells in a well. N(t) = K / (1 + (K/N0 - 1) exp(-r t)); early growth is
# exponential at rate r (doubling time ln2 / r), and growth slows as the well approaches confluence K.
# Each independent experiment has its own rate (SD 0.003 per hour around the line's rate); wells within an
# experiment differ by 8% counting noise.
import numpy as np
TIMES = np.array([0, 24, 48, 72, 96])
def experiment(rng, r_line, n_wells=3, n0=1e4, K=4e5):
    r = r_line + rng.normal(0, 0.003)
    n = K / (1 + (K / n0 - 1) * np.exp(-r * TIMES))
    return n[None, :] * np.exp(rng.normal(0, 0.08, (n_wells, len(TIMES))))
