From b0663ef0143747ada04e48926914e336f92853d7 Mon Sep 17 00:00:00 2001 From: CamDavidsonPilon Date: Sat, 1 Feb 2025 07:25:33 -0500 Subject: [PATCH] more oversampling with the new firmware --- CHANGELOG.md | 1 + pioreactor/background_jobs/od_reading.py | 2 +- pioreactor/calibrations/stirring_calibration.py | 2 +- pioreactor/structs.py | 5 +++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ddef6b4..c15c9721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### Enhancements + - new RP2040 firmware improvements => less noise in OD readings - 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. This is useful for scripting purposes. - A new CLI for pumps: `pio run pumps`. Add pumps as options: diff --git a/pioreactor/background_jobs/od_reading.py b/pioreactor/background_jobs/od_reading.py index 0e0ad8d0..2e2a1111 100644 --- a/pioreactor/background_jobs/od_reading.py +++ b/pioreactor/background_jobs/od_reading.py @@ -123,7 +123,7 @@ def __init__( fake_data: bool = False, dynamic_gain: bool = True, penalizer: float = 0.0, # smoothing parameter between samples - oversampling_count: int = 32, + oversampling_count: int = 42, ) -> None: super().__init__() self.fake_data = fake_data diff --git a/pioreactor/calibrations/stirring_calibration.py b/pioreactor/calibrations/stirring_calibration.py index 716b67fe..282b4601 100644 --- a/pioreactor/calibrations/stirring_calibration.py +++ b/pioreactor/calibrations/stirring_calibration.py @@ -67,7 +67,7 @@ def run_stirring_calibration( max_dc + min_dc ) / 2 # we start with a somewhat low value, s.t. the stir bar is caught. st.start_stirring() - sleep(8) + sleep(5) for count, dc in enumerate(dcs, start=1): st.set_duty_cycle(dc) diff --git a/pioreactor/structs.py b/pioreactor/structs.py index 364aa251..e5a324c9 100644 --- a/pioreactor/structs.py +++ b/pioreactor/structs.py @@ -164,9 +164,14 @@ def calibration_type(self): def save_to_disk_for_device(self, device: str) -> str: from pioreactor.calibrations import CALIBRATION_PATH + import shutil calibration_dir = CALIBRATION_PATH / device calibration_dir.mkdir(parents=True, exist_ok=True) + + # Set ownership to pioreactor:www-data using shutil + shutil.chown(calibration_dir, user="pioreactor", group="www-data") + out_file = calibration_dir / f"{self.calibration_name}.yaml" # Serialize to YAML