Pioreactor / pioreactor

Hardware and software for accessible, extensible, and scalable bioreactors. Built on Raspberry Pi.
https://pioreactor.com
MIT License
102 stars 9 forks source link

Temperature compensation #143

Closed CamDavidsonPilon closed 3 years ago

CamDavidsonPilon commented 3 years ago
CamDavidsonPilon commented 3 years ago

This can be done globally (i.e. pioreactor software provides values), but can also be done locally, per unit. If the user supplies a static media (something that will not change with time or temperature... tbd), then the Pioreactor unit can gradually increase temperature and record OD, and save those values locally.

CamDavidsonPilon commented 3 years ago

If/When users to a local compensation, this is useful data for Pioreactor to receive, to improve a global model. Introduce sharing.

CamDavidsonPilon commented 3 years ago

Some possible routines:

  1. Turn on OD Reading. Turn on TempControl, and starting measuring temps every 10m (as usual). Slowly increase the duty cycle over time to get a range of temperatures. When a new temp is logged, take average OD Reading. At the end, we would have a map of {temp: od_reading}. This can be normalized using the od reading at (estimated) 30C?

Question:

  1. Interpolation is easy, but we will have problems with extrapolation.
  2. How correct is a linear model between temp and od_reading?
CamDavidsonPilon commented 3 years ago

4trials.csv

Using IR333-A LED

from bambi import Model
model = Model("log_od ~ temp + (1|source) + 1", df)
results = model.fit(draws=2000, chains=2, init="adapt_diag")
                    mean        sd    hdi_3%   hdi_97%  mcse_mean   mcse_sd     ess_bulk     ess_tail     r_hat
Intercept      -3.095768  0.072997 -3.244607 -2.956281   0.002095  0.001482  1244.973771  1642.084603  1.000763
temp           -0.006380  0.000218 -0.006786 -0.005954   0.000004  0.000003  3656.849208  3121.194924  1.001106
1|source_sigma  0.143413  0.066029  0.051725  0.268497   0.001790  0.001281  1417.849654  1821.041181  1.000614
1|source[0]     0.088855  0.072714 -0.041376  0.246096   0.002095  0.001482  1230.038712  1635.812337  1.001559
1|source[1]     0.088599  0.072661 -0.041612  0.246671   0.002097  0.001483  1225.475762  1664.932659  1.001707
1|source[2]    -0.085214  0.072645 -0.214420  0.074809   0.002096  0.001483  1225.899973  1654.467393  1.001444
1|source[3]    -0.082030  0.072663 -0.211901  0.077328   0.002094  0.001481  1230.227416  1682.288652  1.001636
log_od_sigma    0.008340  0.000859  0.006754  0.009886   0.000016  0.000011  2953.323681  2446.749514  1.002163
Screen Shot 2021-07-23 at 10 03 22 AM

The important parameter is temp, -0.006380. This relates the reduction in OD to temperature, via an exponential. Ex:

If OD at 25 is 2.0, then OD at 30 is 2.0 exp(-0.006380 5) = 1.9372

CamDavidsonPilon commented 3 years ago

This entire routine is obsolete now that we are measuring the LED output