From 8d14982c2408c60e0d876e3282469ac866d900ab Mon Sep 17 00:00:00 2001 From: CamDavidsonPilon Date: Thu, 30 Jan 2025 20:03:52 -0500 Subject: [PATCH] fix calibration -y, better default pump cal from Mo's data --- CHANGELOG.md | 13 ++++++++----- pioreactor/actions/pump.py | 6 +++--- pioreactor/calibrations/stirring_calibration.py | 4 ++-- pioreactor/cli/calibrations.py | 2 ++ pioreactor/cli/run.py | 6 +++--- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7341c2f..6ddef6b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ #### Enhancements - Improved chart colors in the UI - - The OD reading CLI has a new option, `--snapshot`, that will start the job, take a single reading, and exit. + - The OD reading CLI has a new option, `--snapshot`, that will start the job, take a single reading, and exit. This is useful for scripting purposes. - A new CLI for pumps: `pio run pumps`. Add pumps as options: ``` pio run pumps --media 1 --waste 2 @@ -12,9 +12,11 @@ ``` pio run pumps --waste 2 --media 1 --waste 2 ``` - - support for 40ml - - Run multiple experiment profiles per experiment. - + - Initial support for 40ml + - Run multiple experiment profiles per experiment! + - Specify which Pioreactor to update on the Updates page (option is only available with release archives.) + - Choose the level of detail on the new Event Logs page. + - Added index to stirring_rates table. #### Web API changes @@ -38,7 +40,8 @@ #### Bug fixes - fixed ui not showing 3p calibrations - - experiment profiles start now use the unit_api directly. I think this mitigates the huey workers stampeding on each other when try to start many jobs. + - experiment profiles start now use the unit_api directly. This may mitigate the issue where huey workers stampeding on each other when try to start many jobs. + - fix `pio calibrations run ... -y` not saving as active. ### 25.1.21 diff --git a/pioreactor/actions/pump.py b/pioreactor/actions/pump.py index 555850d4..e46919ce 100644 --- a/pioreactor/actions/pump.py +++ b/pioreactor/actions/pump.py @@ -34,12 +34,12 @@ DEFAULT_PWM_CALIBRATION = structs.SimplePeristalticPumpCalibration( calibrated_on_pioreactor_unit=get_unit_name(), created_at=default_datetime_for_pioreactor(), - hz=200.0, - dc=100.0, + hz=250.0, + dc=95.0, voltage=-1, calibration_name="default_pump_calibration", curve_type="poly", - curve_data_=[1.0, 0.0], + curve_data_=[0.0911, 0.0], # 0.0911 is a pretty okay estimate for the slope of the calibration curve recorded_data={"x": [], "y": []}, ) diff --git a/pioreactor/calibrations/stirring_calibration.py b/pioreactor/calibrations/stirring_calibration.py index 1abe93e5..716b67fe 100644 --- a/pioreactor/calibrations/stirring_calibration.py +++ b/pioreactor/calibrations/stirring_calibration.py @@ -50,9 +50,9 @@ def run_stirring_calibration( # go up and down to observe any hysteresis. dcs = ( - list(range(round(max_dc), round(min_dc) - 3, -3)) + list(range(round(max_dc), round(min_dc) - 2, -3)) + list(range(round(min_dc), round(max_dc) + 3, 3)) - + list(range(round(max_dc), round(min_dc) - 3, -3)) + + list(range(round(max_dc), round(min_dc) - 2, -3)) ) n_samples = len(dcs) diff --git a/pioreactor/cli/calibrations.py b/pioreactor/cli/calibrations.py index e8fc87a6..32e64420 100644 --- a/pioreactor/cli/calibrations.py +++ b/pioreactor/cli/calibrations.py @@ -121,6 +121,8 @@ def run_calibration(ctx, device: str, protocol_name: str | None, y: bool) -> Non click.echo( f"Okay. You can use 'pio calibration set-active --device {device} --name {calibration_struct.calibration_name}' to set this calibration as the active one." ) + else: + calibration_struct.set_as_active_calibration_for_device(device) click.echo( f"Calibration '{calibration_struct.calibration_name}' of device '{device}' saved to {out_file} ✅" diff --git a/pioreactor/cli/run.py b/pioreactor/cli/run.py index 68591c00..6914a4ce 100644 --- a/pioreactor/cli/run.py +++ b/pioreactor/cli/run.py @@ -62,9 +62,9 @@ def run() -> None: for plugin in plugin_management.get_plugins().values(): for possible_entry_point in dir(plugin.module): if possible_entry_point.startswith("click_"): - print( - "The `click` API is deprecated and will stop working in the future. You should update your plugins." - ) + # print( + # "The `click` API is deprecated and will stop working in the future. You should update your plugins." + # ) run.add_command(getattr(plugin.module, possible_entry_point)) if am_I_leader():