It's common to want a feature to turn off, or more generally change behaviour, when a sensitive optical density reading is taken. For example, if running a air bubbler, you may want to turn if off before an OD reading is taken, and then turn if back on after.
This behaviour is so common, we've added a helper class to take care of it for you. In
pioreactor.background_jobs.base is the class
BackgroundJobWithDodgingContrib that implements most of the "dodging" behaviour for you. you'll only need to do three things:
- Inherit from
BackgroundJobWithDodgingContrib, instead of
from pioreactor.background_jobs.base import BackgroundJobWithDodgingContrib
- Fill in what to do before, and after, an OD reading takes place by implementing method
- We also want some "buffer" time before and after an OD reading. For example, if using a bubbler, we want the bubbles to dissipate before taking an OD reading. To set these times, add the following to your config.ini:
enable_dodging_od=1 # 1 if you want the behaviour, 0 to disable it.
And you're done!