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

improve plot headers

parent f1c05b60
No related branches found
No related tags found
No related merge requests found
...@@ -75,6 +75,8 @@ class Measurements: ...@@ -75,6 +75,8 @@ class Measurements:
next_soaking = int(list_of_values[2]) # soaking_time next_soaking = int(list_of_values[2]) # soaking_time
next_reads = int(list_of_values[3]) # number of stable readings next_reads = int(list_of_values[3]) # number of stable readings
self.measurement_plot.fig.suptitle("Measurement "+str(measurement_number)+': ' + str(next_temp) +
' degC, ' + str(next_hum) + ' rel. hum.', color="red")
self.perform_single_measurement(self.output_basename+'_'+str(measurement_number)+'.csv', next_temp, next_hum, self.perform_single_measurement(self.output_basename+'_'+str(measurement_number)+'.csv', next_temp, next_hum,
next_soaking, next_reads) next_soaking, next_reads)
measurement_number += 1 measurement_number += 1
...@@ -84,12 +86,12 @@ class Measurements: ...@@ -84,12 +86,12 @@ class Measurements:
plt.close() plt.close()
return measurement_number
if self.standby: if self.standby:
standby_response = self.chamber.set_mode('STANDBY') standby_response = self.chamber.set_mode('STANDBY')
print(standby_response) print(standby_response)
return measurement_number
def perform_temperature_sweep(self, start_temp, stop_temp, temp_step, target_hum, soaking_time, n_stable_reads): def perform_temperature_sweep(self, start_temp, stop_temp, temp_step, target_hum, soaking_time, n_stable_reads):
current_temp = start_temp current_temp = start_temp
temperatures = [] temperatures = []
...@@ -100,8 +102,12 @@ class Measurements: ...@@ -100,8 +102,12 @@ class Measurements:
for temp in temperatures: for temp in temperatures:
output_name = self.output_basename + '_'+str(temp)+'deg.csv' output_name = self.output_basename + '_'+str(temp)+'deg.csv'
self.measurement_plot.fig.suptitle("Temp. sweep measurement "+str(temperatures.index(temp)+1)+'/'+str(len(temperatures))+
': ' + str(temp) + ' degC, ' + str(target_hum) + ' rel. hum.',
color="red")
self.perform_single_measurement(output_name, temp, target_hum, soaking_time, n_stable_reads) self.perform_single_measurement(output_name, temp, target_hum, soaking_time, n_stable_reads)
plt.close()
return temperatures return temperatures
def perform_single_measurement(self, output, target_temp, target_hum, soaking_time, n_stable_reads): def perform_single_measurement(self, output, target_temp, target_hum, soaking_time, n_stable_reads):
...@@ -320,7 +326,7 @@ class Measurements: ...@@ -320,7 +326,7 @@ class Measurements:
return (target_hum-self.max_delta_hum <= float(readback_hum)) and \ return (target_hum-self.max_delta_hum <= float(readback_hum)) and \
(float(readback_hum) <= target_hum+self.max_delta_hum) (float(readback_hum) <= target_hum+self.max_delta_hum)
def plot_output(output_basename, measurements_appendices, show_blocking_plot): def plot_output(output_basename, measurements_appendices, show_blocking_plot, title = ''):
list_of_frames = [] list_of_frames = []
for m in measurements_appendices: for m in measurements_appendices:
measurement_name = output_basename+'_'+str(m) measurement_name = output_basename+'_'+str(m)
...@@ -329,7 +335,7 @@ def plot_output(output_basename, measurements_appendices, show_blocking_plot): ...@@ -329,7 +335,7 @@ def plot_output(output_basename, measurements_appendices, show_blocking_plot):
combined_data_frame = pd.concat(list_of_frames, ignore_index=True, sort=False) combined_data_frame = pd.concat(list_of_frames, ignore_index=True, sort=False)
if show_blocking_plot: if show_blocking_plot:
plt.ioff() plt.ioff()
plot = MeasurementPlot.MeasurementPlot() plot = MeasurementPlot.MeasurementPlot(title)
plot.draw(combined_data_frame, output_basename + '_graph.pdf') plot.draw(combined_data_frame, output_basename + '_graph.pdf')
def run_temperature_sweep_from_file(temperature_sweep_file, meas): def run_temperature_sweep_from_file(temperature_sweep_file, meas):
...@@ -397,14 +403,15 @@ if __name__ == '__main__': ...@@ -397,14 +403,15 @@ if __name__ == '__main__':
try: try:
if args.file: if args.file:
n_measurements = mes.perform_measurements(args.file) n_measurements = mes.perform_measurements(args.file)
plot_output(output_basename, range(n_measurements), args.plot) plot_output(output_basename, range(n_measurements), args.plot, output_basename)
if args.temperaturesweepfile: if args.temperaturesweepfile:
temperatures = run_temperature_sweep_from_file(args.temperaturesweepfile, mes) temperatures = run_temperature_sweep_from_file(args.temperaturesweepfile, mes)
#run analysis here #run analysis here
temp_extensions = [] temp_extensions = []
for t in temperatures: for t in temperatures:
temp_extensions.append(str(t)+'deg') temp_extensions.append(str(t)+'deg')
plot_output(output_basename, temp_extensions, args.plot) plot_output(output_basename, temp_extensions, args.plot, output_basename + ': Temperature sweep ' +
str(temperatures[0]) + ' degC to ' + str(temperatures[-1]) + ' degC')
print(str(temp_extensions)) print(str(temp_extensions))
finally: finally:
mes.chamber.close() mes.chamber.close()
......
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