plot_heatflux_example.py 2.9 KB
Newer Older
1
2
3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 29 17:41:40 2018
4
V3.4.1
5
6
7
@author: holn
"""
import numpy as np
8
import downloadversionIRdata as IR
9
10
import matplotlib.pyplot as plt
import datetime
11

Holger Niemann's avatar
Holger Niemann committed
12
13
14
15
port = 51 # 20
program = "20180814.024"#"20171207.027"#"20181016.023"#"20180927.017"#"20180904.007"#"20171207.022" # "20181004.012"

profile = "TM3h_5_7"
16

17
18
19
20
if __name__=='__main__':
    
    #%% loading data
    print(datetime.datetime.now(),"start")
21
    status,times,images=IR.download_heatflux_by_program(port,program,time_window=[0,2],version=2,verbose=5,testmode=False)
22
23
24
    print('done')
    
    #%% plotting data
25
    if status:
Holger Niemann's avatar
Holger Niemann committed
26
        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)        
27
        plt.figure()
Holger Niemann's avatar
Holger Niemann committed
28
29
        plt.imshow(images[0]/1e6)
        plt.clim([0,1])
30
31
32
33
34
35
36
37
38
39
        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
                        top='off',         # ticks along the top edge are off
                        left='off',
                        right='off',
                        labelleft='off',
                        labelbottom='off') # labels along the bottom edge are off
        c_ax = plt.colorbar()
        c_ax.set_label('q [MW/m2]')
Holger Niemann's avatar
Holger Niemann committed
40
        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')
41
42
43
44
45
        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-')
Holger Niemann's avatar
Holger Niemann committed
46
47
            plt.xlabel("s [m]", fontsize=26)
            plt.ylabel("q [MW/m2]", fontsize=26)
48
            plt.tick_params(labelsize=26)
Holger Niemann's avatar
Holger Niemann committed
49
            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)
50
            plt.grid()
Holger Niemann's avatar
Holger Niemann committed
51
            plt.ylim(bottom = 0)
52
            plt.show()
Holger Niemann's avatar
Holger Niemann committed
53
        elif len(np.shape(q)) == 2:
54
55
56
57
58
59
60
61
62
            plt.figure()
            X,Y=np.meshgrid(time,s)
            plt.pcolor(X,Y,q.swapaxes(0,1)/1e6,vmin=0)
            plt.xlabel("time [s]",fontsize=26)
            plt.ylabel("s [m]",fontsize=26)
            plt.tick_params(labelsize=26)
            cb=plt.colorbar()
            cb.set_label('heatflux in MW/m²', rotation=270, labelpad=15,fontsize=26)
            cb.ax.tick_params(labelsize=26)
Holger Niemann's avatar
Holger Niemann committed
63
            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)
64
            plt.show()
65
66
#        status3,mapping=IR.download_heatflux_scene_model_reference(port,program=program,verbose=0)
#        bild=np.zeros((768,1024))
67