Skip to content

Commit

Permalink
snapshot mode, wait on checking for stirring (if both start simultane…
Browse files Browse the repository at this point in the history
…ously, don't alert too soon)
  • Loading branch information
CamDavidsonPilon committed Jan 25, 2025
1 parent 4865e59 commit 9e8f989
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
10 changes: 5 additions & 5 deletions pioreactor/background_jobs/dosing_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ def __init__(
) -> None:
super(DosingAutomationJob, self).__init__(unit, experiment)

if not is_pio_job_running("stirring"):
self.logger.warning(
"It's recommended to have stirring on to improve mixing during dosing events."
)

self.add_to_published_settings(
"duration",
{
Expand All @@ -264,6 +259,11 @@ def __init__(

self.set_duration(duration)

if not is_pio_job_running("stirring"):
self.logger.warning(
"It's recommended to have stirring on to improve mixing during dosing events."
)

def set_duration(self, duration: Optional[float]) -> None:
if duration:
self.duration = float(duration)
Expand Down
30 changes: 20 additions & 10 deletions pioreactor/background_jobs/od_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,21 +1246,31 @@ def start_od_reading(
help="specify the angle(s) between the IR LED(s) and the PD in channel 2, separated by commas. Don't specify if channel is empty.",
)
@click.option("--fake-data", is_flag=True, help="produce fake data (for testing)")
@click.option("--snapshot", is_flag=True, help="take one reading and exit")
def click_od_reading(
od_angle_channel1: pt.PdAngleOrREF,
od_angle_channel2: pt.PdAngleOrREF,
fake_data: bool,
od_angle_channel1: pt.PdAngleOrREF, od_angle_channel2: pt.PdAngleOrREF, fake_data: bool, snapshot: bool
) -> None:
"""
Start the optical density reading job
"""

possible_calibration = load_active_calibration("od")

od = start_od_reading(
od_angle_channel1,
od_angle_channel2,
fake_data=fake_data or whoami.is_testing_env(),
calibration=possible_calibration,
)
od.block_until_disconnected()
if snapshot:
od = start_od_reading(
od_angle_channel1,
od_angle_channel2,
fake_data=fake_data or whoami.is_testing_env(),
calibration=possible_calibration,
interval=None,
)
od.logger.debug(od.record_from_adc())
# end
else:
od = start_od_reading(
od_angle_channel1,
od_angle_channel2,
fake_data=fake_data or whoami.is_testing_env(),
calibration=possible_calibration,
)
od.block_until_disconnected()

0 comments on commit 9e8f989

Please sign in to comment.