From abf057b57fad7c9a231169a332e2958a7319b5bd Mon Sep 17 00:00:00 2001
From: Holger Niemann <holger.niemann@ipp.mpg.de>
Date: Fri, 29 Nov 2019 09:50:54 +0100
Subject: [PATCH] small format changes

---
 plot_heatflux_example.py | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/plot_heatflux_example.py b/plot_heatflux_example.py
index e8b7968..88c6a82 100644
--- a/plot_heatflux_example.py
+++ b/plot_heatflux_example.py
@@ -9,22 +9,24 @@ import downloadversionIRdata as IR
 import matplotlib.pyplot as plt
 import datetime
 
-port=51 # 20
-program="20180927.017"#"20180904.007"#"20171207.022" # "20181004.012"
+port = 51 # 20
+program = "20180814.024"#"20171207.027"#"20181016.023"#"20180927.017"#"20180904.007"#"20171207.022" # "20181004.012"
+
+profile = "TM3h_5_7"
 
 if __name__=='__main__':
     
     #%% loading data
     print(datetime.datetime.now(),"start")
-    status,times,images=IR.download_heatflux_by_program(port,program,time_window=6.5,version=2,threads=1,verbose=5,testmode=False)
+    status,times,images=IR.download_heatflux_by_program(port,program,time_window=[0,2],version=2,threads=1,verbose=5,testmode=False)
     print('done')
     
     #%% plotting data
     if status:
-        status2,time,s,q=IR.extract_heatflux_profile_from_DL((np.asarray(times)-times[0])/1e9,images,profile="TM3h_5_5",time_window=None,verbose=5,testmode=False)        
+        status2,time,s,q=IR.extract_heatflux_profile_from_DL((np.asarray(times)-times[0])/1e9,images,profile=profile,time_window=[0.5,1.5],verbose=5,testmode=False)        
         plt.figure()
-        plt.imshow(images[-1]/1e6)
-        plt.clim([0,4])
+        plt.imshow(images[0]/1e6)
+        plt.clim([0,1])
         plt.tick_params(axis='both',       # changes apply to the x-axis
                         which='both',      # both major and minor ticks are affected
                         bottom='off',      # ticks along the bottom edge are off
@@ -35,20 +37,20 @@ if __name__=='__main__':
                         labelbottom='off') # labels along the bottom edge are off
         c_ax = plt.colorbar()
         c_ax.set_label('q [MW/m2]')
-        plt.savefig('20171109.008 - '+str(round((np.asarray(times[-1])-times[0])/1e9,2))+' - AEF20IR - in MWm2.png', dpi=300, bbox_inches='tight')
+        plt.savefig(program+' - '+str(round((np.asarray(times[-1])-times[0])/1e9,2))+' - AEF{0}IR - in MWm2.png'.format(port), dpi=300, bbox_inches='tight')
         if len(np.shape(q))==1 or np.shape(q)[0]==1:
             if np.shape(q)[0]==1:
                 q=q[0]
             plt.figure()
             plt.plot(s,q/1e6,'ko-')
-            plt.xlabel("s [m]",fontsize=26)
-            plt.ylabel("q [MW/m2]",fontsize=26)
+            plt.xlabel("s [m]", fontsize=26)
+            plt.ylabel("q [MW/m2]", fontsize=26)
             plt.tick_params(labelsize=26)
-            plt.title("{0} heat flux profile for TM3, finger 5, profile 5 @1s".format(program),fontsize=26)
+            plt.title("{0} heat flux profile for {1}, finger {2}, profile {3} @1s".format(program,profile.split("_")[0],profile.split("_")[1],profile.split("_")[2]),fontsize=26)
             plt.grid()
-            plt.ylim(bottom=0)
+            plt.ylim(bottom = 0)
             plt.show()
-        elif len(np.shape(q))==2:
+        elif len(np.shape(q)) == 2:
             plt.figure()
             X,Y=np.meshgrid(time,s)
             plt.pcolor(X,Y,q.swapaxes(0,1)/1e6,vmin=0)
@@ -58,7 +60,7 @@ if __name__=='__main__':
             cb=plt.colorbar()
             cb.set_label('heatflux in MW/m²', rotation=270, labelpad=15,fontsize=26)
             cb.ax.tick_params(labelsize=26)
-            plt.title("{0} heat flux profile for TM3, finger 5, profile 5".format(program),fontsize=26)
+            plt.title("{0} heat flux profile for {1}, finger {2}, profile {3} @1s".format(program,profile.split("_")[0],profile.split("_")[1],profile.split("_")[2]),fontsize=26)
             plt.show()
 #        status3,mapping=IR.download_heatflux_scene_model_reference(port,program=program,verbose=0)
 #        bild=np.zeros((768,1024))
-- 
GitLab