Skip to content

Use raw data to blank instead of calculated OD#23

Open
dgruano wants to merge 2 commits intoFYNCH-BIO:rcfrom
dgruano:od-blank
Open

Use raw data to blank instead of calculated OD#23
dgruano wants to merge 2 commits intoFYNCH-BIO:rcfrom
dgruano:od-blank

Conversation

@dgruano
Copy link
Copy Markdown
Contributor

@dgruano dgruano commented Aug 28, 2020

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:

  • Calculate OD using a raw blank i.e OD = f ( RawCal0 - RawExp0 + RawExpT )
  • Add user prompt to chose how to blank
  • Storing important variables and improved logic

Checks

  • Updated documentation.
  • Follows 7 rules of great commit messages. For most PRs a single commit should suffice, in some cases multiple topical commits can be useful. During review it is ok to see tiny commits (e.g. Fix reviewer comments), but right before the code gets merged to master or rc branch, any such commits should be squashed since they are useless to the other developers. Definitely avoid merge commits, use rebase instead.
  • Follows the Google Style Guide.

Any screenshots or GIFs?

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]) +
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dgruano
Copy link
Copy Markdown
Contributor Author

dgruano commented Feb 5, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants