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

make plotting option a command line argument

parent d0dd7ead
No related branches found
No related tags found
No related merge requests found
......@@ -268,7 +268,7 @@ class Measurements:
return equilibrium_indicator
def plot_output(self, output_file):
def plot_output(self, output_file, show_plot_window):
csv_data = pd.read_csv(output_file)
fig, ax1 = plt.subplots(2, figsize=(12, 10))
fig.suptitle("Graphical representation of chamber output", color="red")
......@@ -310,7 +310,9 @@ class Measurements:
ax1[1].legend(all_path_collections, labels, loc='lower right')
fig.savefig(time.strftime("%Y_%m_%d-%H_%M_%S") + 'graph.pdf')
plt.show()
if show_plot_window:
plt.show()
def calculate_temperature_stability(self, target_temp, readback_temp):
return (target_temp-self.max_delta_temp <= float(readback_temp)) and \
......@@ -337,6 +339,9 @@ if __name__ == '__main__':
parser.add_argument("-s", "--standby",
action="store_true", default=False,
help="Change Chamber mode to standby at the end")
parser.add_argument("-p", "--plot",
action="store_true", default=False,
help="Show plot window at the end")
# parser.add_argument("-q", "--quiet",
# action="store_false", dest="verbose", default=True,
......@@ -354,17 +359,11 @@ if __name__ == '__main__':
with open('test_stand_parameter.json', 'r') as f:
config_data = json.load(f)
# Move this to inside the chamber. But just putting it into perform_measurements is not good at the moment.
# That function needs refactoring first.
mes = Measurements(args.chamber, args.vna, args.file, output, args.standby, config_data)
try:
mes.perform_measurements()
plot_graph = input('want to plot a graph? ans[Yes/no]?').lower()
if plot_graph == "yes":
mes.plot_output(output)
else:
print("graph is stored with output file")
mes.plot_output(output, args.plot)
finally:
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