xp_i[:, ii] = xp_after[:n_record]
    y_i[:, ii] = y_after[:n_record]
    yp_i[:, ii] = yp_after[:n_record]


from tune_analysis import tune_analysis
qx_i, qy_i, qx_centroid, qy_centroid = tune_analysis(x_i, xp_i, y_i, yp_i)

pl.close('all')
ms.mystyle(fontsz=14)
pl.figure(1)
sp1 = pl.subplot(2, 1, 1)
pl.plot(np.mean(x_i, axis=0), '.-b', markersize=5, linewidth=2, label='PyHT')
pl.ylabel('<x>')
pl.grid('on')
ms.sciy()
pl.legend(prop={'size': 14})
pl.subplot(2, 1, 2, sharex=sp1)
pl.plot(np.mean(y_i, axis=0), '.-b', markersize=5, linewidth=2, label='PyHT')
pl.xlabel('Turn'); pl.ylabel('<y>')
pl.grid('on')
ms.sciy()
#pl.savefig(filename.split('_prb.dat')[0]+'_centroids.png', dpi=200)


pl.figure(2)
pl.plot(np.abs(qx_i), np.abs(qy_i), '.', label='PyHT', markersize=3)
pl.plot(np.abs(qx_ht), np.abs(qy_ht), '.r', label='HT', markersize=3)
pl.plot([np.modf(machine.Q_x)[0]], [np.modf(machine.Q_y)[0]], 'go')
pl.xlabel('$Q_x$'); pl.ylabel('$Q_y$')
pl.legend(prop={'size': 14})
Beispiel #2
0
#14.
ifig += 1; pl.figure(ifig)
pl.plot(ob.xg_hist, np.sum(ob.nel_impact_hist_tot, axis=0), linewidth=2)
pl.xlabel('Chamber bin position [m]')
pl.ylabel('Impacting $e^-$ per bin')
ms.scix(); pl.grid('on')
pl.suptitle('Var. name: sum(nel_impact_hist_tot, axis=0)\nNumber of impacting electrons in each slice')
pl.subplots_adjust(top=.82, bottom=.14)

#19.
ifig += 1; pl.figure(ifig)
pl.plot(np.sum(ob.energ_eV_impact_hist, axis=1), linewidth=2)
pl.xlabel('Passage')
pl.ylabel('Energy of impacting electrons [eV]')
pl.grid('on'); ms.sciy()
pl.suptitle('Var. name: sum(energ_eV_impact_hist, axis=1)\nEnergy of impacting electrons at each passage')
pl.subplots_adjust(top=.82, bottom=.14)

#20.
ifig += 1; pl.figure(ifig)
pl.plot(ob.xg_hist, np.sum(ob.energ_eV_impact_hist, axis=0), linewidth=2)
pl.xlabel('Position in the chamber [m]')
pl.ylabel('Energy of impacting electrons[eV]')
pl.grid('on'); ms.sciy(); ms.scix()
pl.suptitle('Var. name: sum(energ_eV_impact_hist, axis=0)\nTotal energy of impacting electrons per passage [eV]')
pl.subplots_adjust(top=.82, bottom=.14)


pl.show()
ms.scix(); pl.grid('on')
pl.suptitle('Var. name: cen_density\nelectron density at the beam position')
pl.subplots_adjust(top=.82, bottom=.14)
pl.savefig('fig%02d.png'%ifig, dpi=dpiset)


###############################
# Variables saved per passage #
###############################

#15.
ifig+=1; pl.figure(ifig)
pl.plot(ob.N_mp_pass, linewidth=2) 
pl.xlabel('Passage')
pl.ylabel('Number of MP per unit length [$m^{-1}$]') 
ms.scix(); ms.sciy(); pl.grid('on')
pl.suptitle('Var. name: N_mp_pass\nNumber of MP at each passage')
pl.subplots_adjust(top=.82, bottom=.14)
pl.savefig('fig%02d.png'%ifig, dpi=dpiset)

#16.
ifig+=1; pl.figure(ifig)
pl.plot(ob.N_mp_impact_pass, linewidth=2) 
pl.xlabel('Passage')
pl.ylabel('Number of impacting MP per passage') 
pl.grid('on');ms.sciy()
pl.suptitle('Var. name: N_mp_impact_pass\nNumber of macroparticles that impact for each passage')
pl.subplots_adjust(top=.82, bottom=.14)
pl.savefig('fig%02d.png'%ifig, dpi=dpiset)

#17.
		
		if (k in out_var_ref) and (dict_ref[k].shape!=()):
			
		
			#Plot vector for the reference simulation
			pl.plot(dict_ref[k],'r', label='ref_sim')
			print ii,k,'ref_sim'
			
			
		else:
			print '%s not  in reference'%k
		
		
				
		pl.legend(prop={'size':myfontsz}, bbox_to_anchor=(1, 1),  loc='upper left')
		ms.sciy()
		pl.savefig(folder_plot+'/%s'%k, dpi=300)




	elif len(dict_curr[k].shape)==2:  # var is a matrix!!!!!!!!!!!!!!!!!
		
		
		fig=pl.figure(ii)
		pl.subplots_adjust(top=1.2)
		pl.suptitle(out_var_curr[ii])
		gs1 = gridspec.GridSpec(2, 1)
		gs2 = gridspec.GridSpec(3, 1)