From 332bc1f2ad949ff47eaeaa3faf2b468cccf8fe96 Mon Sep 17 00:00:00 2001
From: Sai Lakhan Ekal <sai.lakhan.ekal@desy.de>
Date: Tue, 18 Oct 2022 14:56:50 +0200
Subject: [PATCH] Now the graph and output file has the same name

---
 Python_script/prototype.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Python_script/prototype.py b/Python_script/prototype.py
index bdd22a9..fc517e5 100755
--- a/Python_script/prototype.py
+++ b/Python_script/prototype.py
@@ -270,8 +270,8 @@ class Measurements:
 
         return equilibrium_indicator
 
-    def plot_output(self, output_file, show_plot_window):
-        csv_data = pd.read_csv(output_file)
+    def plot_output(self, output_basename, show_plot_window):
+        csv_data = pd.read_csv(output_basename+'.csv')
         fig, ax1 = plt.subplots(2, figsize=(12, 10))
         fig.suptitle("Graphical representation of chamber output", color="red")
 
@@ -311,7 +311,7 @@ class Measurements:
         labels = [pc.get_label() for pc in all_path_collections]
         ax1[1].legend(all_path_collections, labels, loc='lower right')
 
-        fig.savefig(time.strftime("%Y_%m_%d-%H_%M_%S") + 'graph.pdf')
+        fig.savefig(output_basename + '_graph.pdf')
 
         if show_plot_window:
             plt.show()
@@ -351,21 +351,21 @@ if __name__ == '__main__':
     args = parser.parse_args()
 
     if not args.output:
-        output = time.strftime("%Y_%m_%d-%H_%M_%S") + "_results.csv"
+        output_basename = time.strftime("%Y_%m_%d-%H_%M_%S") + "_results"
     else:
-        output = args.output
+        output_basename = args.output
 
-    print(args.chamber, args.vna, args.file, output, args.standby)
+    print(args.chamber, args.vna, args.file, output_basename, args.standby)
 
     # reading json file for target accuracy
     with open('test_stand_parameter.json', 'r') as f:
         config_data = json.load(f)
 
-    mes = Measurements(args.chamber, args.vna, args.file, output, args.standby, config_data)
+    mes = Measurements(args.chamber, args.vna, args.file, output_basename+'.csv', args.standby, config_data)
     try:
 
         mes.perform_measurements()
-        mes.plot_output(output, args.plot)
+        mes.plot_output(output_basename, args.plot)
 
     finally:
         mes.chamber.close()
-- 
GitLab