Skip to content

Commit b12c480

Browse files
committed
edits
1 parent 850bd3e commit b12c480

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

pioreactor/actions/od_calibration.py

+29-14
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def introduction() -> None:
5656
echo(
5757
"""This routine will calibrate the current Pioreactor to (offline) OD600 readings. You'll need:
5858
1. The Pioreactor you wish to calibrate (the one you are using)
59-
2. At least 10mL of a culture with density the most you'll ever observe, and its OD600 measurement
59+
2. At least 10mL of a culture with the highest density you'll ever observe, and its OD600 measurement
6060
3. A micro-pipette
6161
4. Accurate 10mL measurement tool
6262
5. Sterile media, amount to be determined shortly.
@@ -155,7 +155,7 @@ def setup_HDC_instructions() -> None:
155155

156156

157157
def start_stirring():
158-
while not confirm(green("Reading to start stirring?"), default=True):
158+
while not confirm(green("Reading to start stirring?"), default=True, abort=True):
159159
pass
160160

161161
echo("Starting stirring and blocking until near target RPM.")
@@ -189,6 +189,8 @@ def plot_data(
189189

190190
plt.theme("pro")
191191
plt.title(title)
192+
plt.xlabel("OD600")
193+
plt.ylabel("OD Reading (Raw)")
192194
plt.plot_size(105, 22)
193195

194196
if interpolation_curve:
@@ -211,6 +213,9 @@ def start_recording_and_diluting(
211213
inferred_od600s = []
212214
current_volume_in_vial = initial_volume_in_vial = 10.0
213215
n_samples = int((20 - initial_volume_in_vial) / dilution_amount)
216+
if initial_volume_in_vial + dilution_amount * n_samples >= 18:
217+
n_samples = n_samples - 1
218+
#20mL in one vial is very scary
214219
total_n_samples = int(log2(initial_od600 / minimum_od600) * (initial_volume_in_vial / dilution_amount))
215220
count_of_samples = 0
216221

@@ -236,14 +241,24 @@ def get_voltage_from_adc() -> pt.Voltage:
236241
od_reader.record_from_adc()
237242

238243
while inferred_od600 > minimum_od600:
239-
if inferred_od600 < initial_od600 and confirm(
240-
green("Do you want to enter an updated OD600 value for the current density?")
241-
):
242-
inferred_od600 = prompt(
243-
green("Updated OD600"),
244-
type=float,
245-
confirmation_prompt=green("Repeat for confirmation"),
246-
)
244+
while True:
245+
if inferred_od600 < initial_od600 and confirm(
246+
green("Do you want to enter an updated OD600 value for the current density?")
247+
):
248+
r = prompt(
249+
green("Enter updated OD600, or SKIP"),
250+
type=str,
251+
confirmation_prompt=green("Repeat for confirmation"),
252+
)
253+
if r == "SKIP":
254+
break
255+
256+
else:
257+
try:
258+
inferred_od600 = float(r)
259+
break
260+
except ValueError:
261+
echo("OD600 entered is invalid.")
247262

248263
inferred_od600s.append(inferred_od600)
249264

@@ -268,7 +283,7 @@ def get_voltage_from_adc() -> pt.Voltage:
268283
)
269284
echo(f"Add {dilution_amount}ml of media to vial.")
270285

271-
while not confirm(green("Continue?"), default=True):
286+
while not confirm(green("Continue?"), default=False):
272287
pass
273288

274289
current_volume_in_vial = current_volume_in_vial + dilution_amount
@@ -306,9 +321,9 @@ def get_voltage_from_adc() -> pt.Voltage:
306321
echo(style("Stop❗", fg="red"))
307322
echo("Carefully remove vial.")
308323
echo("(Optional: take new OD600 reading with external instrument.)")
309-
echo("Reduce volume in vial back to 10ml.")
324+
echo(f"Reduce volume in vial by {n_samples*dilution_amount}mL. There should be 10mL remaining in your vial.")
310325
echo("Confirm vial outside is dry and clean. Place back into Pioreactor.")
311-
while not confirm(green("Continue?"), default=True):
326+
while not confirm(green("Continue?"), default=False):
312327
pass
313328
current_volume_in_vial = initial_volume_in_vial
314329
st.set_state("ready")
@@ -330,7 +345,7 @@ def get_voltage_from_adc() -> pt.Voltage:
330345
confirmation_prompt=green("Repeat for confirmation"),
331346
)
332347
echo("Confirm vial outside is dry and clean. Place back into Pioreactor.")
333-
while not confirm(green("Continue?"), default=True):
348+
while not confirm(green("Continue?"), default=False):
334349
pass
335350
echo("Reading blank...")
336351

0 commit comments

Comments
 (0)