plots that should work
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import json
|
|
5 |
import time
|
6 |
import matplotlib.pyplot as plt
|
7 |
import numpy as np
|
8 |
-
import datetime
|
9 |
import pytz
|
10 |
import pandas as pd
|
11 |
|
@@ -676,8 +676,6 @@ def get_data_default(time_scale, exp):
|
|
676 |
|
677 |
client.unsubscribe(f"pioreactor/{PIOREACTOR}/readings")
|
678 |
|
679 |
-
plots = [None, None, None, None]
|
680 |
-
|
681 |
if temp_graph is not None:
|
682 |
for temp in temp_graph:
|
683 |
utc_time = datetime.strptime(temp["x"], "%Y-%m-%dT%H:%M:%S.%fZ")
|
@@ -689,14 +687,14 @@ def get_data_default(time_scale, exp):
|
|
689 |
df = df.set_index("x")
|
690 |
|
691 |
plt.figure()
|
692 |
-
plt.plot(df.index, df["
|
693 |
plt.xlabel("Time")
|
694 |
plt.ylabel("Temperature")
|
695 |
plt.title("Temperature vs Time")
|
696 |
plot1 = plt.gcf()
|
697 |
plt.close()
|
698 |
else:
|
699 |
-
|
700 |
|
701 |
if od_graph is not None:
|
702 |
for od in od_graph:
|
@@ -707,10 +705,17 @@ def get_data_default(time_scale, exp):
|
|
707 |
od["x"] = local_time.strftime("%Y-%m-%d %H:%M:%S")
|
708 |
df = pd.DataFrame(od_graph)
|
709 |
df = df.set_index("x")
|
710 |
-
|
711 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
712 |
else:
|
713 |
-
|
|
|
714 |
|
715 |
if norm_od_graph is not None:
|
716 |
for od in norm_od_graph:
|
@@ -722,9 +727,16 @@ def get_data_default(time_scale, exp):
|
|
722 |
df = pd.DataFrame(norm_od_graph)
|
723 |
df = df.set_index("x")
|
724 |
|
725 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
726 |
else:
|
727 |
-
|
|
|
728 |
|
729 |
if growth_rate_graph is not None:
|
730 |
for gr in growth_rate_graph:
|
@@ -735,12 +747,19 @@ def get_data_default(time_scale, exp):
|
|
735 |
gr["x"] = local_time.strftime("%Y-%m-%d %H:%M:%S")
|
736 |
df = pd.DataFrame(growth_rate_graph)
|
737 |
df = df.set_index("x")
|
738 |
-
|
739 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
740 |
else:
|
741 |
-
|
742 |
-
|
743 |
-
|
|
|
744 |
|
745 |
|
746 |
# Define the interface components
|
|
|
5 |
import time
|
6 |
import matplotlib.pyplot as plt
|
7 |
import numpy as np
|
8 |
+
from datetime import datetime
|
9 |
import pytz
|
10 |
import pandas as pd
|
11 |
|
|
|
676 |
|
677 |
client.unsubscribe(f"pioreactor/{PIOREACTOR}/readings")
|
678 |
|
|
|
|
|
679 |
if temp_graph is not None:
|
680 |
for temp in temp_graph:
|
681 |
utc_time = datetime.strptime(temp["x"], "%Y-%m-%dT%H:%M:%S.%fZ")
|
|
|
687 |
df = df.set_index("x")
|
688 |
|
689 |
plt.figure()
|
690 |
+
plt.plot(df.index, df["y"])
|
691 |
plt.xlabel("Time")
|
692 |
plt.ylabel("Temperature")
|
693 |
plt.title("Temperature vs Time")
|
694 |
plot1 = plt.gcf()
|
695 |
plt.close()
|
696 |
else:
|
697 |
+
plot1 = None
|
698 |
|
699 |
if od_graph is not None:
|
700 |
for od in od_graph:
|
|
|
705 |
od["x"] = local_time.strftime("%Y-%m-%d %H:%M:%S")
|
706 |
df = pd.DataFrame(od_graph)
|
707 |
df = df.set_index("x")
|
708 |
+
|
709 |
+
plt.figure()
|
710 |
+
plt.plot(df.index, df["y"])
|
711 |
+
plt.xlabel("Time")
|
712 |
+
plt.ylabel("OD")
|
713 |
+
plt.title("OD vs Time")
|
714 |
+
plot2 = plt.gcf()
|
715 |
+
plt.close()
|
716 |
else:
|
717 |
+
plot2 = None
|
718 |
+
|
719 |
|
720 |
if norm_od_graph is not None:
|
721 |
for od in norm_od_graph:
|
|
|
727 |
df = pd.DataFrame(norm_od_graph)
|
728 |
df = df.set_index("x")
|
729 |
|
730 |
+
plt.figure()
|
731 |
+
plt.plot(df.index, df["y"])
|
732 |
+
plt.xlabel("Time")
|
733 |
+
plt.ylabel("Normalized OD")
|
734 |
+
plt.title("Normalized OD vs Time")
|
735 |
+
plot3 = plt.gcf()
|
736 |
+
plt.close()
|
737 |
else:
|
738 |
+
plot3 = None
|
739 |
+
|
740 |
|
741 |
if growth_rate_graph is not None:
|
742 |
for gr in growth_rate_graph:
|
|
|
747 |
gr["x"] = local_time.strftime("%Y-%m-%d %H:%M:%S")
|
748 |
df = pd.DataFrame(growth_rate_graph)
|
749 |
df = df.set_index("x")
|
750 |
+
|
751 |
+
plt.figure()
|
752 |
+
plt.plot(df.index, df["y"])
|
753 |
+
plt.xlabel("Time")
|
754 |
+
plt.ylabel("Growth Rate")
|
755 |
+
plt.title("Growth Rate vs Time")
|
756 |
+
plot4 = plt.gcf()
|
757 |
+
plt.close()
|
758 |
else:
|
759 |
+
plot4 = None
|
760 |
+
|
761 |
+
# Return both plots
|
762 |
+
return plot1, plot2, plot3, plot4
|
763 |
|
764 |
|
765 |
# Define the interface components
|