Skip to content
Snippets Groups Projects
Commit 75efdfac authored by Martin Killenberg's avatar Martin Killenberg
Browse files

update online plot while taking stable measurementes

parent b6b6a348
No related branches found
No related tags found
No related merge requests found
...@@ -138,7 +138,8 @@ class Measurements: ...@@ -138,7 +138,8 @@ class Measurements:
print('Setpoint: ' + str(next_temp) + ' ' + str(next_hum) + ' | Temp: ' + data.temp + print('Setpoint: ' + str(next_temp) + ' ' + str(next_hum) + ' | Temp: ' + data.temp +
' °C' + ' | Humid: ' + data.hum + '%' ' °C' + ' | Humid: ' + data.hum + '%'
+ ' | soaking read nr' + str(len(magnitudes_queue))) + ' | soaking read nr' + str(len(magnitudes_queue)))
self.write_data(writer, next_temp, next_hum, data, self.cook_up_equi_indicator()) self.store_and_plot_data(next_temp, next_hum, data, self.cook_up_equi_indicator())
writer.writerow(self.data_collection[-1])
if self.temperature_stable and self.humidity_stable and self.magnitude_stable and\ if self.temperature_stable and self.humidity_stable and self.magnitude_stable and\
self.phase_stable: self.phase_stable:
...@@ -164,7 +165,8 @@ class Measurements: ...@@ -164,7 +165,8 @@ class Measurements:
self.phase_stable = (reference_phase-self.max_delta_phase <= phase) and\ self.phase_stable = (reference_phase-self.max_delta_phase <= phase) and\
(phase <= reference_phase+self.max_delta_phase) (phase <= reference_phase+self.max_delta_phase)
supposedly_stable_measurements.append([data, self.cook_up_equi_indicator()]) self.store_and_plot_data(next_temp, next_hum, data, self.cook_up_equi_indicator())
supposedly_stable_measurements.append(self.data_collection[-1])
if (self.temperature_stable and self.humidity_stable and self.magnitude_stable and if (self.temperature_stable and self.humidity_stable and self.magnitude_stable and
self.phase_stable): self.phase_stable):
...@@ -175,13 +177,14 @@ class Measurements: ...@@ -175,13 +177,14 @@ class Measurements:
print('Measurement not stable. Retrying.') print('Measurement not stable. Retrying.')
break break
for [d, measurement_equi] in supposedly_stable_measurements: for measurement in supposedly_stable_measurements:
if all_measurements_stable: if all_measurements_stable:
equi = TEMPERATURE_STABLE | HUMIDITY_STABLE | MAGNITUDE_STABLE | PHASE_STABLE | MEASUREMENT_STABLE measurement['EQUILIBRIUM_INDICATOR'] = TEMPERATURE_STABLE | HUMIDITY_STABLE |\
MAGNITUDE_STABLE | PHASE_STABLE |\
MEASUREMENT_STABLE
do_another_measurement = False do_another_measurement = False
else:
equi = measurement_equi writer.writerow(measurement)
self.write_data(writer, next_temp, next_hum, d, equi)
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
...@@ -202,7 +205,7 @@ class Measurements: ...@@ -202,7 +205,7 @@ class Measurements:
return MeasurementData(int(self.clock.time()), temp, hum, power, frequency, s11, s21, s12, s22) return MeasurementData(int(self.clock.time()), temp, hum, power, frequency, s11, s21, s12, s22)
def write_data(self, writer, target_temp, target_hum, data, equi_indicator): def store_and_plot_data(self, target_temp, target_hum, data, equi_indicator):
measurement = { measurement = {
'TIMESTAMP': data.timestamp, 'TIMESTAMP': data.timestamp,
'TARGET_TEMPERATURE': target_temp, 'TARGET_TEMPERATURE': target_temp,
...@@ -221,7 +224,6 @@ class Measurements: ...@@ -221,7 +224,6 @@ class Measurements:
'S22_PHASE': self.calculate_mean_phase(data.s22), 'S22_PHASE': self.calculate_mean_phase(data.s22),
'S22_MAGNITUDE': self.calculate_mean_magnitude(data.s22) 'S22_MAGNITUDE': self.calculate_mean_magnitude(data.s22)
} }
writer.writerow(measurement)
self.data_collection.append(measurement) self.data_collection.append(measurement)
data_frame = pd.DataFrame(self.data_collection) data_frame = pd.DataFrame(self.data_collection)
self.measurement_plot.draw(data_frame) self.measurement_plot.draw(data_frame)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment