# Data-generating model shared by make_data.py and simulation.py. Python 3.13, NumPy.
import numpy as np
S = np.array([2, 3, 5, 7.5, 10, 15, 25, 50.0])     # substrate (uM): 0.2 to 5 x the wild-type Km
WELLS = 2                                          # duplicate wells per concentration (technical replicates)
SD_RATE = 3.0                                      # well-to-well SD of the rate (nmol/min/mg)

def experiment(rng, km_wt, km_mut, vmax=100.0, sd_day=0.10, sd_prep=0.10, sd_vmax=0.15):
    """One independent experiment: fresh preparations of both enzymes, assayed side by side on one day."""
    day = rng.normal(0, sd_day)                     # shared day effect on log Km (buffer, temperature)
    rows = []
    for enz, km in (("WT", km_wt), ("mutant", km_mut)):
        k = km * np.exp(day + rng.normal(0, sd_prep))   # preparation-specific Km
        v = vmax * np.exp(rng.normal(0, sd_vmax))       # preparation-specific Vmax (active enzyme amount)
        for s in S:
            for w in range(WELLS):
                rows.append((enz, s, w + 1, v * s / (k + s) + rng.normal(0, SD_RATE)))
    return rows
