Use raw data to blank instead of calculated OD#23
Use raw data to blank instead of calculated OD#23dgruano wants to merge 2 commits intoFYNCH-BIO:rcfrom
Conversation
eVOLVER.py used to first calculate the blank OD value and then store it. This commit adds data processing to store the raw blank and apply it before calculating the OD value with the fit, reducing inaccuracies. Summarized changes are: - Take half of the function transform_data and place it in a new function apply_OD_calibration (so each one does what they say), in order to use the fit after performing the rest of calculations - Store the raw value associated with 0 OD (raw 'blank' of the calibration) when retrieving the active calibration - Store the difference between the blank raw value of the calibration and the blank raw value of the experiment - Calculate the OD as a function of the raw value measured each time plus the difference between calibration and experiment blank. That is: f ( RawCal0 - RawExp0 + RawExpT ) = OD - Add prompts so user can decide what blanking procedure to use
Fix data processing errors that were not tested in previous commit.Change logic when storing and applying the blank. Save new var self.use_raw_blank to pickle to make new blank method compatible when resuming an existing experiment TODO: Check for od_raw_zero.json file and create it if needed
| zero_cal_values = np.array(json.load(f)) | ||
|
|
||
| self.OD_initial = zero_cal_values - np.array( | ||
| [float(x) for x in data['data']['od_135']]) # TODO: generalize for other od parameters |
There was a problem hiding this comment.
Please do this - it's very important for other users with different setups.
| (od_coefficients[1]*od_data[x]) + | ||
| (od_coefficients[2]*od_data_2[x]) + | ||
| (od_coefficients[3]*(od_data[x]**2)) + | ||
| (od_coefficients[4]*od_data[x]*od_data_2[x]) + |
There was a problem hiding this comment.
Is the zero-delta calc changes being applied to the other methods, or just sigmoid?
| time.strftime("%c")) | ||
| self._create_file(x, param + '_raw', defaults=[exp_str]) | ||
| try: | ||
| if calibration['calibrationType'] == 'od' and param == 'od_135': # TODO: generalize for other od parameters |
There was a problem hiding this comment.
please geenralize. It shouldn't be too much work. You basically just need to look at the incoming data and see what params exist and what type of calibration is being applied and which parameter is desired. Technically the od param can be named anything, and the calibration should guide you for what to look for.
|
The experimental blank should be averaged over a window of initial zero raw values instead of taking just the very first raw value. We see variability in raw measurements with an empty vial (~1000 a.u.), so calculations will be biased if the very first raw value is a bit off. Averaging a window would correct for this. |
What? Why?
Change the way eVOLVER blanks the cell density measurements. Instead of getting the initial OD and subtracting it from OD at time T, it will now get the initial raw value subtract it from the raw value at time T and using this difference to calculate the OD.
Changes proposed in this pull request:
Checks
Any screenshots or GIFs?