Skip to content

Commit

Permalink
hacky fix for exporting calibrations
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Oct 28, 2024
1 parent 572d074 commit 60e68d7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- `dosing_automation.vial_volume` replaced with `dosing_automation.liquid_volume`. You can see the values by watching `pio mqtt -t "pioreactor/+/+/dosing_automation/liquid_volume"` after starting a dosing automation.
- Adding a SQL table for tracking `liquid_volume`.
- Because we are now storing `liquid_volume` in the database, you can add charts in the UI that track the volume over time:
1. Add the following yaml contents to `~/.pioreactor/plugins/contrib/charts/lqiuid_volume.yaml`: https://gist.github.com/CamDavidsonPilon/95eef30189101da69f706d02ef28d972
1. Add the following yaml contents to `~/.pioreactor/plugins/ui/contrib/charts/liquid_volume.yaml`: https://gist.github.com/CamDavidsonPilon/95eef30189101da69f706d02ef28d972
2. In your config.ini, under `ui.overview.charts`, add the line `liquid_volume=1`.
- New dataset exports from the Export data page in the UI: calibrations and liquid-volumes.
- Added a "partition by unit" option to the Export data page that will create a csv per Pioreactor in the export, instead of grouping them all together.
Expand All @@ -30,6 +30,7 @@

#### Breaking changes
- `pio kill --name x` is now `pio kill --job-name x`
- removed publishing published_settings metadata to mqtt. Ex `$properties`, `$settable`, `$unit`, `$datatype` are no longer being sent mqtt. This was never used, and just a bandwidth suck.

#### Bug fixes
- fix for OD calibration graph showing "two lines" in the terminal display
Expand Down
4 changes: 2 additions & 2 deletions pioreactor/actions/leader/export_experiment_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def export_experiment_data(
_partition_by_unit = True

if not _partition_by_unit:
if experiment is None:
if experiment is None or "experiment" not in get_column_names(cursor, table):
query = f"SELECT {timestamp_to_localtimestamp_clause} * from {table} ORDER BY {order_by}"
cursor.execute(query)
filename = f"{table}-{time}.csv"
Expand All @@ -115,7 +115,7 @@ def export_experiment_data(
os.remove(path_to_file)

else:
if experiment is not None:
if experiment is not None or "experiment" not in get_column_names(cursor, table):
query = f"SELECT {timestamp_to_localtimestamp_clause} * from {table} WHERE experiment=:experiment ORDER BY :order_by"
cursor.execute(query, {"experiment": experiment, "order_by": order_by})
else:
Expand Down
4 changes: 2 additions & 2 deletions pioreactor/actions/self_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_all_positive_correlations_between_pds_and_leds(
# the problem is that if an LED is directly across from a PD, a high intensity will quickly
# saturate it and fail the test. So we try low intensities first, and if we exceed some threshold
# we exit before moving to the high intensities.
INTENSITIES = (32, 35, 53, 44, 38, 47, 50, 41, 56, 59, 62, 65)
INTENSITIES = (35, 53, 44, 38, 47, 50, 41, 56, 59, 62, 65)

results: dict[tuple[LedChannel, PdChannel], float] = {}

Expand All @@ -155,7 +155,7 @@ def test_all_positive_correlations_between_pds_and_leds(
# TODO: should we remove blank? Technically correlation is invariant to location.

with stirring.start_stirring(
target_rpm=1250,
target_rpm=500,
unit=unit,
experiment=experiment,
) as st:
Expand Down
6 changes: 0 additions & 6 deletions pioreactor/background_jobs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,12 +903,6 @@ def _clear_caches(self) -> None:
From homie: Devices can remove old properties and nodes by publishing a zero-length payload on the respective topics.
Use "persist" to keep it from clearing.
"""
self.publish(
f"pioreactor/{self.unit}/{self.experiment}/{self.job_name}/$properties",
None,
retain=True,
)

with JobManager() as jm:
for setting, metadata_on_attr in self.published_settings.items():
if not metadata_on_attr.get("persist", False):
Expand Down

0 comments on commit 60e68d7

Please sign in to comment.