{
 "about": "OD600 from paired calibration data: blank-corrected mean OD per density, a free-intercept least-squares line, read back only inside the densities measured, times the dilution; eight refusal codes. Exact rational arithmetic; `exact` holds each number as a fraction.",
 "oracle": {
  "name": "Python fractions",
  "version": "Python 3.13.16 fractions",
  "script": "pipeline/lab-calculators/od600_calibration_reference.py",
  "scriptSha256": "278d2952dc6f84ee70d33e6aaeb179d2742c43934124adf39018634c28cb09f6",
  "command": "python3 pipeline/lab-calculators/od600_calibration_reference.py"
 },
 "method": "od600-calibration@1.1.0",
 "tolerance": "numbers relative 1e-9; R² absolute 1e-9; refusals exact by problem code",
 "recordedOn": "2026-10-21",
 "count": 18,
 "refusals": 11,
 "cases": [
  {
   "name": "exact-line",
   "about": "Three densities on an exact line through the origin: the reading 0.3 gives 3e8 per mL",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": true,
    "slope": 1e-09,
    "intercept": 0.0,
    "measuredPerML": 300000000.0,
    "estimatePerML": 300000000.0,
    "blank": 0.0,
    "rSquared": 1.0,
    "densityRange": [
     100000000.0,
     400000000.0
    ],
    "basis": "cells",
    "exact": {
     "slope": "3602879701896397/3602879701896396800000000",
     "intercept": "0/1",
     "measuredPerML": "1080863910568919000000000/3602879701896397",
     "estimatePerML": "1080863910568919000000000/3602879701896397",
     "blank": "0/1"
    }
   }
  },
  {
   "name": "dilution",
   "about": "The same reading taken at a 1:10 dilution: the estimate is ten times the measured density",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 10,
    "basis": "cells"
   },
   "expected": {
    "ok": true,
    "slope": 1e-09,
    "intercept": 0.0,
    "measuredPerML": 300000000.0,
    "estimatePerML": 2999999999.9999995,
    "blank": 0.0,
    "rSquared": 1.0,
    "densityRange": [
     100000000.0,
     400000000.0
    ],
    "basis": "cells",
    "exact": {
     "slope": "3602879701896397/3602879701896396800000000",
     "intercept": "0/1",
     "measuredPerML": "1080863910568919000000000/3602879701896397",
     "estimatePerML": "10808639105689190000000000/3602879701896397",
     "blank": "0/1"
    }
   }
  },
  {
   "name": "blanks",
   "about": "Two blanks (mean 0.05) subtracted from every reading, sample included",
   "input": {
    "pairs": [
     {
      "od": 0.15,
      "count": 100000000.0
     },
     {
      "od": 0.25,
      "count": 200000000.0
     },
     {
      "od": 0.45,
      "count": 400000000.0
     }
    ],
    "blanks": [
     0.04,
     0.06
    ],
    "reading": 0.35,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": true,
    "slope": 1e-09,
    "intercept": -1.0408340855860843e-17,
    "measuredPerML": 300000000.0,
    "estimatePerML": 300000000.0,
    "blank": 0.05,
    "rSquared": 1.0,
    "densityRange": [
     100000000.0,
     400000000.0
    ],
    "basis": "cells",
    "exact": {
     "slope": "3602879701896397/3602879701896396800000000",
     "intercept": "-3/288230376151711744",
     "measuredPerML": "1080863910568919000000000/3602879701896397",
     "estimatePerML": "1080863910568919000000000/3602879701896397",
     "blank": "14411518807585587/288230376151711744"
    }
   }
  },
  {
   "name": "replicates",
   "about": "Two readings at one density are averaged before the fit, so that density counts once",
   "input": {
    "pairs": [
     {
      "od": 0.09,
      "count": 100000000.0
     },
     {
      "od": 0.11,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": true,
    "slope": 1e-09,
    "intercept": -6.938893903907228e-18,
    "measuredPerML": 300000000.0,
    "estimatePerML": 300000000.0,
    "blank": 0.0,
    "rSquared": 1.0,
    "densityRange": [
     100000000.0,
     400000000.0
    ],
    "basis": "cells",
    "exact": {
     "slope": "50440315826549559/50440315826549555200000000",
     "intercept": "-1/144115188075855872",
     "measuredPerML": "5044031582654955450000000/16813438608849853",
     "estimatePerML": "5044031582654955450000000/16813438608849853",
     "blank": "0/1"
    }
   }
  },
  {
   "name": "free-intercept",
   "about": "A line with an intercept and scatter: least squares on the mean ODs, R² below 1",
   "input": {
    "pairs": [
     {
      "od": 0.12,
      "count": 100000000.0
     },
     {
      "od": 0.19,
      "count": 200000000.0
     },
     {
      "od": 0.33,
      "count": 300000000.0
     },
     {
      "od": 0.41,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.25,
    "dilution": 1,
    "basis": "cfu"
   },
   "expected": {
    "ok": true,
    "slope": 1.01e-09,
    "intercept": 0.010000000000000009,
    "measuredPerML": 237623762.37623763,
    "estimatePerML": 237623762.37623763,
    "blank": 0.0,
    "rSquared": 0.9832289156626506,
    "densityRange": [
     100000000.0,
     400000000.0
    ],
    "basis": "cfu",
    "exact": {
     "slope": "18194542494576803/18014398509481984000000000",
     "intercept": "45035996273705/4503599627370496",
     "measuredPerML": "4323455642275676000000000/18194542494576803",
     "estimatePerML": "4323455642275676000000000/18194542494576803",
     "blank": "0/1"
    }
   }
  },
  {
   "name": "at-lowest-density",
   "about": "A reading exactly on the line at the lowest density is inside the range",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.1,
    "dilution": 1,
    "basis": "microspheres"
   },
   "expected": {
    "ok": true,
    "slope": 1e-09,
    "intercept": 0.0,
    "measuredPerML": 100000000.0,
    "estimatePerML": 100000000.0,
    "blank": 0.0,
    "rSquared": 1.0,
    "densityRange": [
     100000000.0,
     400000000.0
    ],
    "basis": "microspheres",
    "exact": {
     "slope": "3602879701896397/3602879701896396800000000",
     "intercept": "0/1",
     "measuredPerML": "100000000/1",
     "estimatePerML": "100000000/1",
     "blank": "0/1"
    }
   }
  },
  {
   "name": "at-highest-density",
   "about": "A reading exactly on the line at the highest density is inside the range",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.4,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": true,
    "slope": 1e-09,
    "intercept": 0.0,
    "measuredPerML": 400000000.0,
    "estimatePerML": 400000000.0,
    "blank": 0.0,
    "rSquared": 1.0,
    "densityRange": [
     100000000.0,
     400000000.0
    ],
    "basis": "cells",
    "exact": {
     "slope": "3602879701896397/3602879701896396800000000",
     "intercept": "0/1",
     "measuredPerML": "400000000/1",
     "estimatePerML": "400000000/1",
     "blank": "0/1"
    }
   }
  },
  {
   "name": "below-range",
   "about": "A reading below the line's value at the lowest density is refused, not extrapolated",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.05,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-below-range"
   }
  },
  {
   "name": "above-range",
   "about": "A reading above the line's value at the highest density is refused, not extrapolated",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.5,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-above-range"
   }
  },
  {
   "name": "flat",
   "about": "Every density reads the same OD: no line, refused",
   "input": {
    "pairs": [
     {
      "od": 0.2,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.2,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-flat"
   }
  },
  {
   "name": "reversed",
   "about": "OD falls as density rises: a negative slope is refused",
   "input": {
    "pairs": [
     {
      "od": 0.4,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.1,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-reversed"
   }
  },
  {
   "name": "two-densities",
   "about": "Three pairs but only two distinct densities: refused",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.11,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-pairs"
   }
  },
  {
   "name": "half-pair",
   "about": "A pair with the count missing: refused, never dropped",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     },
     {
      "od": 0.3,
      "count": null
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-pairs"
   }
  },
  {
   "name": "negative-count",
   "about": "A negative count: refused",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": -100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-pairs"
   }
  },
  {
   "name": "no-basis",
   "about": "No basis chosen: refused before anything is fitted",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 1,
    "basis": null
   },
   "expected": {
    "ok": false,
    "problem": "od-basis"
   }
  },
  {
   "name": "no-reading",
   "about": "No sample reading: refused",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": null,
    "dilution": 1,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-reading"
   }
  },
  {
   "name": "dilution-below-one",
   "about": "A dilution below 1 is refused",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": 0.5,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-dilution"
   }
  },
  {
   "name": "no-dilution",
   "about": "A missing dilution is refused",
   "input": {
    "pairs": [
     {
      "od": 0.1,
      "count": 100000000.0
     },
     {
      "od": 0.2,
      "count": 200000000.0
     },
     {
      "od": 0.4,
      "count": 400000000.0
     }
    ],
    "blanks": [],
    "reading": 0.3,
    "dilution": null,
    "basis": "cells"
   },
   "expected": {
    "ok": false,
    "problem": "od-dilution"
   }
  }
 ]
}
