Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Plot_t_delta_incl(d_delta,d_delta_av,d_delta_comp):
- for n_centralina in d_delta:
- # find temperature column name and tiltimeter columns names
- l_col_incl=[]
- l_n_incl=[]
- for column_name in d_delta[n_centralina].columns:
- if "TEMP"==column_name[:4]:
- T_col_name=column_name
- elif "INCL"==column_name[:4]:
- l_col_incl.append(column_name)
- n_incl=int(''.join(x for x in column_name if x.isdigit()))
- if n_incl not in l_n_incl:
- l_n_incl.append(n_incl)
- if l_n_incl: # check if list is not empty
- for n_incl in l_n_incl:
- l_data=[name for name in l_col_incl if str(n_incl) in name]
- l_data_pila=[name for name in l_data if "PILA" in name]
- l_data_spalla=[name for name in l_data if "SPALLA" in name]
- if l_data_pila:
- t=d_delta[n_centralina][l_data_pila[0]].index
- t_av=d_delta_av[n_centralina][l_data_pila[0]].index
- data1 = d_delta[n_centralina][l_data_pila[0]]
- data2 = d_delta[n_centralina][l_data_pila[1]]
- data3=d_delta_av[n_centralina][l_data_pila[0]]
- data4=d_delta_av[n_centralina][l_data_pila[1]]
- #data5=d_delta_comp[n_centralina][l_data_pila[0]]
- #data6=d_delta_comp[n_centralina][l_data_pila[1]]
- dataT = d_delta[n_centralina][T_col_name].values
- fig, ax1 = plt.subplots()
- color0 = 'tab:orange'
- color1 = 'tab:blue'
- ax1.set_xlabel('time')
- ax1.set_ylabel('rotazione [°]')
- ax1.plot(t, data1, color=color0, label=l_data_pila[0],linewidth=0.5)
- ax1.plot(t, data2, color=color1, label=l_data_pila[1],linewidth=0.5)
- ax1.plot(t_av, data3, color=color0, label=l_data_pila[0]+'av',linewidth=1.0)
- ax1.plot(t_av, data4, color=color1, label=l_data_pila[1]+'av',linewidth=1.0)
- #ax1.plot(t, data5, color=color0, label=l_data_pila[0]+'comp',linewidth=1.0,linestyle="--")
- #ax1.plot(t, data6, color=color1, label=l_data_pila[1]+'comp',linewidth=1.0,linestyle="--")
- ax1.tick_params(axis='y')
- # set y axis limits
- ax1.set_ylim([-0.2,0.2])
- plt.grid(True, which='major',axis='both', linestyle='--',dashes=[10, 10], linewidth=0.5)
- leg=plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
- ncol=2, mode="expand", borderaxespad=0.,fontsize=8)
- for line in leg.get_lines():
- line.set_linewidth(2)
- ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
- color = 'tab:grey'
- ax2.set_ylabel('T [°C]', color=color)
- ax2.plot(t, dataT, color=color, label="TEMPERATURE", linewidth=0.5,alpha=0.4)
- ax2.tick_params(axis='y', labelcolor=color)
- ax2.set_ylim([-25,25])
- fig.tight_layout()
- fig.canvas.set_window_title(l_data_pila[0][:-1])
- plt.show()
- if l_data_spalla:
- t=d_delta[n_centralina][l_data_spalla[0]].index
- t_av=d_delta_av[n_centralina][l_data_spalla[0]].index
- data1 = d_delta[n_centralina][l_data_spalla[0]]
- data2 = d_delta[n_centralina][l_data_spalla[1]]
- data3=d_delta_av[n_centralina][l_data_spalla[0]]
- data4=d_delta_av[n_centralina][l_data_spalla[1]]
- #data5=d_delta_comp[n_centralina][l_data_spalla[0]]
- #data6=d_delta_comp[n_centralina][l_data_spalla[1]]
- dataT = d_delta[n_centralina][T_col_name].values
- fig, ax1 = plt.subplots()
- color0 = 'tab:orange'
- color1 = 'tab:blue'
- ax1.set_xlabel('time')
- ax1.set_ylabel('rotazione [°]')
- ax1.plot(t, data1, color=color0, label=l_data_spalla[0],linewidth=0.5)
- ax1.plot(t, data2, color=color1, label=l_data_spalla[1],linewidth=0.5)
- ax1.plot(t_av, data3, color=color0, label=l_data_spalla[0]+'av',linewidth=1.0)
- ax1.plot(t_av, data4, color=color1, label=l_data_spalla[1]+'av',linewidth=1.0)
- #ax1.plot(t, data5, color=color0, label=l_data_spalla[0]+'comp',linewidth=1.0,linestyle="--")
- #ax1.plot(t, data6, color=color1, label=l_data_spalla[1]+'comp',linewidth=1.0,linestyle="--")
- ax1.tick_params(axis='y')
- # set y axis limits
- ax1.set_ylim([-0.2,0.2])
- plt.grid(True, which='major',axis='both', linestyle='--',dashes=[10, 10], linewidth=0.5)
- leg=plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
- ncol=2, mode="expand", borderaxespad=0.,fontsize=8)
- for line in leg.get_lines():
- line.set_linewidth(2)
- ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
- color = 'tab:grey'
- ax2.set_ylabel('T [°C]', color=color)
- ax2.plot(t, dataT, color=color, label="TEMPERATURE", linewidth=0.5,alpha=0.4)
- ax2.tick_params(axis='y', labelcolor=color)
- ax2.set_ylim([-25,25])
- fig.tight_layout()
- fig.canvas.set_window_title(l_data_spalla[0][:-1])
- plt.show()
- def Plot_t_delta_comp_incl(d_delta_comp, d_delta_av_comp):
- for n_centralina in d_delta_comp:
- # find temperature column name and tiltimeter columns names
- l_col_incl=[]
- l_n_incl=[]
- for column_name in d_delta_comp[n_centralina].columns:
- if "TEMP"==column_name[:4]:
- T_col_name=column_name
- elif "INCL"==column_name[:4]:
- l_col_incl.append(column_name)
- n_incl=int(''.join(x for x in column_name if x.isdigit()))
- if n_incl not in l_n_incl:
- l_n_incl.append(n_incl)
- if l_n_incl: # check if list is not empty
- for n_incl in l_n_incl:
- l_data=[name for name in l_col_incl if str(n_incl) in name]
- l_data_pila=[name for name in l_data if "PILA" in name]
- l_data_spalla=[name for name in l_data if "SPALLA" in name]
- if l_data_pila:
- t=d_delta_comp[n_centralina][l_data_pila[0]].index
- t_av=d_delta_av_comp[n_centralina][l_data_pila[0]].index
- data1 = d_delta_comp[n_centralina][l_data_pila[0]]
- data2 = d_delta_comp[n_centralina][l_data_pila[1]]
- data3=d_delta_av_comp[n_centralina][l_data_pila[0]]
- data4=d_delta_av_comp[n_centralina][l_data_pila[1]]
- dataT = d_delta_comp[n_centralina][T_col_name].values
- fig, ax1 = plt.subplots()
- color0 = 'tab:orange'
- color1 = 'tab:blue'
- ax1.set_xlabel('time')
- ax1.set_ylabel('rotazione [°]')
- ax1.plot(t, data1, color=color0, label=l_data_pila[0]+'comp',linewidth=0.5)
- ax1.plot(t, data2, color=color1, label=l_data_pila[1]+'comp',linewidth=0.5)
- ax1.plot(t_av, data3, color=color0, label=l_data_pila[0]+'av'+'comp',linewidth=1.0)
- ax1.plot(t_av, data4, color=color1, label=l_data_pila[1]+'av'+'comp',linewidth=1.0)
- ax1.tick_params(axis='y')
- # set y axis limits
- ax1.set_ylim([-0.2,0.2])
- plt.grid(True, which='major',axis='both', linestyle='--',dashes=[10, 10], linewidth=0.5)
- leg=plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
- ncol=2, mode="expand", borderaxespad=0.,fontsize=8)
- for line in leg.get_lines():
- line.set_linewidth(2)
- '''
- ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
- color = 'tab:grey'
- ax2.set_ylabel('T [°C]', color=color)
- ax2.plot(t, dataT, color=color, label="TEMPERATURE", linewidth=0.5,alpha=0.4)
- ax2.tick_params(axis='y', labelcolor=color)
- ax2.set_ylim([-25,25])
- '''
- fig.tight_layout()
- fig.canvas.set_window_title(l_data_pila[0][:-1]+"comp")
- plt.show()
- if l_data_spalla:
- t=d_delta_comp[n_centralina][l_data_spalla[0]].index
- t_av=d_delta_av_comp[n_centralina][l_data_spalla[0]].index
- data1 = d_delta_comp[n_centralina][l_data_spalla[0]]
- data2 = d_delta_comp[n_centralina][l_data_spalla[1]]
- data3=d_delta_av_comp[n_centralina][l_data_spalla[0]]
- data4=d_delta_av_comp[n_centralina][l_data_spalla[1]]
- dataT = d_delta_comp[n_centralina][T_col_name].values
- fig, ax1 = plt.subplots()
- color0 = 'tab:orange'
- color1 = 'tab:blue'
- ax1.set_xlabel('time')
- ax1.set_ylabel('rotazione [°]')
- ax1.plot(t, data1, color=color0, label=l_data_spalla[0]+'comp',linewidth=0.5)
- ax1.plot(t, data2, color=color1, label=l_data_spalla[1]+'comp',linewidth=0.5)
- ax1.plot(t_av, data3, color=color0, label=l_data_spalla[0]+'av'+'comp',linewidth=1.0)
- ax1.plot(t_av, data4, color=color1, label=l_data_spalla[1]+'av'+'comp',linewidth=1.0)
- ax1.tick_params(axis='y')
- # set y axis limits
- ax1.set_ylim([-0.2,0.2])
- plt.grid(True, which='major',axis='both', linestyle='--',dashes=[10, 10], linewidth=0.5)
- leg=plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
- ncol=2, mode="expand", borderaxespad=0.,fontsize=8)
- for line in leg.get_lines():
- line.set_linewidth(2)
- '''
- ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
- color = 'tab:grey'
- ax2.set_ylabel('T [°C]', color=color)
- ax2.plot(t, dataT, color=color, label="TEMPERATURE", linewidth=0.5,alpha=0.4)
- ax2.tick_params(axis='y', labelcolor=color)
- ax2.set_ylim([-25,25])
- '''
- fig.canvas.set_window_title(l_data_spalla[0][:-1]+"comp")
- fig.tight_layout()
- plt.show()
- def Plot_t_delta_fess(d_delta,d_delta_av,d_delta_comp,d_coeff_Pear):
- for n_centralina in d_delta:
- # find temperature column name and crack width gauge columns names
- l_col_fess=[]
- l_n_fess=[]
- for column_name in d_delta[n_centralina].columns:
- if "TEMP"==column_name[:4]:
- T_col_name=column_name
- elif "FESS"==column_name[:4]:
- l_col_fess.append(column_name)
- n_fess=int(''.join(x for x in column_name if x.isdigit()))
- if n_fess not in l_n_fess:
- l_n_fess.append(n_fess)
- if l_n_fess: # check if list is not empty
- for n_fess in l_n_fess:
- if n_fess != 100:
- l_data=[name for name in l_col_fess if str(n_fess) in name]
- t = d_delta[n_centralina][l_data[0]].index
- t_av=d_delta_av[n_centralina][l_data[0]].index
- data1 = d_delta[n_centralina][l_data[0]]
- data2 = d_delta[n_centralina][l_data[1]]
- data3 = d_delta[n_centralina][l_data[2]]
- data4 = d_delta_av[n_centralina][l_data[0]]
- data5 = d_delta_av[n_centralina][l_data[1]]
- data6 = d_delta_av[n_centralina][l_data[2]]
- dataT = d_delta[n_centralina][T_col_name].values
- fig, ax1 = plt.subplots()
- color = 'tab:orange'
- ax1.set_xlabel('time')
- ax1.set_ylabel('spostamento [mm]', color=color)
- ax1.plot(t, data1, color=color, label=l_data[0],linewidth=0.5)
- ax1.plot(t_av, data4, color=color, label=l_data[0]+'av',linewidth=0.5)
- ax1.tick_params(axis='y', labelcolor=color)
- color = 'tab:blue'
- ax1.set_xlabel('time')
- ax1.set_ylabel('spostamento [mm]', color=color)
- ax1.plot(t, data2, color=color, label=l_data[1],linewidth=0.5)
- ax1.plot(t_av, data5, color=color, label=l_data[1]+'av',linewidth=0.5)
- ax1.tick_params(axis='y', labelcolor=color)
- color = 'tab:green'
- ax1.set_xlabel('time')
- ax1.set_ylabel('spostamento [mm]', color=color)
- ax1.plot(t, data3, color=color, label=l_data[2],linewidth=0.5)
- ax1.plot(t_av, data6, color=color, label=l_data[2]+'av',linewidth=0.5)
- ax1.tick_params(axis='y', labelcolor=color)
- ax1.set_ylim([-15,15])
- textstr1=l_data[0]+' '+'c_Pear='+str(round(d_coeff_Pear[n_centralina][l_data[0]][0],2))
- textstr2=l_data[1]+' '+'c_Pear='+str(round(d_coeff_Pear[n_centralina][l_data[1]][0],2))
- textstr3=l_data[2]+' '+'c_Pear='+str(round(d_coeff_Pear[n_centralina][l_data[2]][0],2))
- ax1.text(0.05, 0.95,'%s\n%s\n%s'%(textstr1,textstr2,textstr3),
- transform=ax1.transAxes,fontsize=6,
- verticalalignment='top')
- plt.grid(True, which='major',axis='both', linestyle='--',dashes=[10, 10], linewidth=0.5)
- leg=plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
- ncol=3, mode="expand", borderaxespad=0.,fontsize=8)
- for line in leg.get_lines():
- line.set_linewidth(2)
- ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis
- color = 'tab:grey'
- ax2.set_ylabel('T [°C]', color=color)
- ax2.plot(t, dataT, color=color, label="TEMPERATURE", linewidth=0.5, alpha=0.4)
- ax2.tick_params(axis='y', labelcolor=color)
- ax2.set_ylim([-25,25])
- fig.canvas.set_window_title(l_data[0][:-2]+l_data[0][-1])
- fig.tight_layout()
- plt.show()
- def Plot_T_delta(d_delta,d_delta_av,d_fit_par):
- for n_centralina in d_delta:
- # find temperature column name and tiltimeter columns names
- l_col_incl=[]
- l_n_incl=[]
- for column_name in d_delta[n_centralina].columns:
- if "TEMP"==column_name[:4]:
- T_col_name=column_name
- elif "INCL"==column_name[:4]:
- l_col_incl.append(column_name)
- n_incl=int(''.join(x for x in column_name if x.isdigit()))
- if n_incl not in l_n_incl:
- l_n_incl.append(n_incl)
- if l_n_incl: # check if list is not empty
- for n_incl in l_n_incl:
- l_data=[name for name in l_col_incl if str(n_incl) in name]
- l_data_pila=[name for name in l_data if "PILA" in name]
- l_data_spalla=[name for name in l_data if "SPALLA" in name]
- if l_data_pila:
- T = d_delta[n_centralina][T_col_name]
- data1 = d_delta[n_centralina][l_data_pila[0]]
- data2= d_delta[n_centralina][l_data_pila[1]]
- p1 = np.poly1d(d_fit_par[n_centralina][l_data_pila[0]])
- p2 = np.poly1d(d_fit_par[n_centralina][l_data_pila[1]])
- xp = np.linspace(min(T), max(T), 100)
- fig, ax1 = plt.subplots()
- color0 = 'tab:orange'
- color1 = 'tab:blue'
- ax1.set_xlabel('TEMPERATURE')
- ax1.set_ylabel('rotazione [°]', color=color0)
- ax1.scatter(T, data1, s=1, color=color0, label=l_data_pila[0])
- ax1.scatter(T, data2, s=1, color=color1, label=l_data_pila[1])
- ax1.plot(xp,p1(xp),color=color0)
- ax1.plot(xp,p2(xp), color=color1)
- ax1.tick_params(axis='y')
- #ax1.set_ylim()
- plt.grid(True, which='major',axis='both', linestyle='--',dashes=[10, 10], linewidth=0.5)
- plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
- ncol=2, mode="expand", borderaxespad=0.)
- fig.canvas.set_window_title(l_data_pila[0][:-1]+"T-delta")
- fig.tight_layout() # otherwise the right y-label is slightly clipped
- plt.show()
- if l_data_spalla:
- T = d_delta[n_centralina][T_col_name]
- data1 = d_delta[n_centralina][l_data_spalla[0]]
- data2= d_delta[n_centralina][l_data_spalla[1]]
- p1 = np.poly1d(d_fit_par[n_centralina][l_data_spalla[0]])
- p2 = np.poly1d(d_fit_par[n_centralina][l_data_spalla[1]])
- xp = np.linspace(min(T), max(T), 100)
- fig, ax1 = plt.subplots()
- color0 = 'tab:orange'
- color1 = 'tab:blue'
- ax1.set_xlabel('TEMPERATURE')
- ax1.set_ylabel('rotazione [°]', color=color0)
- ax1.scatter(T, data1, s=1, color=color0, label=l_data_spalla[0])
- ax1.scatter(T, data2, s=1, color=color1, label=l_data_spalla[1])
- ax1.plot(xp,p1(xp),color=color0)
- ax1.plot(xp,p2(xp), color=color1)
- ax1.tick_params(axis='y')
- #ax1.set_ylim()
- plt.grid(True, which='major',axis='both', linestyle='--',dashes=[10, 10], linewidth=0.5)
- plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
- ncol=2, mode="expand", borderaxespad=0.)
- fig.canvas.set_window_title(l_data_spalla[0][:-1]+" T-delta")
- fig.tight_layout() # otherwise the right y-label is slightly clipped
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement