tau_damp_x = 50.
tau_damp_y = 100.

flag_check_Qs = True
Q_s = np.nan

#ob = mfm.monitorh5_to_obj('bunch_evolution_00.h5')
ob = mfm.monitorh5list_to_obj(
    ['bunch_evolution_%02d.h5' % ii for ii in range(1)])

plt.close('all')

# Plot transverse positions
fig1 = plt.figure(1, figsize=(8, 6 * 1.2))
fig1.set_facecolor('w')
ms.mystyle_arial(fontsz=16)

axx = fig1.add_subplot(2, 1, 1)
axy = fig1.add_subplot(2, 1, 2, sharex=axx)

axx.plot(ob.mean_x)
axy.plot(ob.mean_y)

if flag_check_damp_time:
    turn_num = np.arange(0, len(ob.mean_x), dtype=np.float)
    ix_max = np.argmax(ob.mean_x)
    iy_max = np.argmax(ob.mean_y)

    axx.plot(ob.mean_x[ix_max] * np.exp(-(turn_num - ix_max) / tau_damp_x),
             linewidth=2,
             color='red',
Exemplo n.º 2
0
    for ss in these_slices:
        thisbuffer = ch.beam_2_buffer(ss,verbose=True, mode='pickle')
        list_buffers.append(thisbuffer)
        list_bunch_buffers[-1].append(thisbuffer)

big_buffer = ch.combine_float_buffers(list_buffers)


# Build profile of the full beam
thin_slicer = UniformBinSlicer(n_slices=10000, z_cuts=(-len(filling_pattern)*bucket_length_m*b_spac_buckets, bucket_length_m))
thin_slice_set = beam.get_slices(thin_slicer, statistics=True)

import matplotlib.pyplot as plt
plt.close('all')

ms.mystyle_arial(fontsz=14, dist_tick_lab=5)



# re-split buffer
list_buffers_rec = ch.split_float_buffers(big_buffer)

# Plot including sub-slicing
fig1 = plt.figure(1, figsize=(8, 6*1.3))
fig1.set_facecolor('w')
sp1 = plt.subplot(3,1,1)
sp2 = plt.subplot(3,1,2, sharex=sp1)
sp3 = plt.subplot(3,1,3, sharex=sp1)


for ibuf, buf in enumerate(list_buffers_rec):
Exemplo n.º 3
0
#             'mpsim_fname': None,
#             'label': r'$\Delta$Q$_\Phi\neq$0, $\Delta$Q$_R\neq$0'},
#         }

dict_plot = {
    'wquad': {
        'fname': '../008c_eigen_with_detuning_fine/eigenvalues.mat',
        'mpsim_fname': None,
        'label': r'$\Delta$Q$_\Phi\neq$0, $\Delta$Q$_R\neq$0'
    },
}

import matplotlib
import matplotlib.pyplot as plt
plt.close('all')
ms.mystyle_arial(fontsz=14, dist_tick_lab=5, traditional_look=False)
fig1 = plt.figure(1, figsize=(6.4 * 1.2, 4.8))
ax1 = fig1.add_subplot(111)
fig_re_list = []
fig_im_list = []
for ill, ll in enumerate(dict_plot.keys()):

    fname = dict_plot[ll]['fname']

    ob = mfm.myloadmat_to_obj(fname)
    Omega_mat = ob.Omega_mat
    strength_scan = ob.strength_scan
    strength_scan_0 = strength_scan
    # Omega_mat = np.zeros((ob.Omega_mat.shape[0]*2, ob.Omega_mat.shape[1]),
    #         dtype=np.complex)
    # strength_scan = np.zeros(Omega_mat.shape[0])
Exemplo n.º 4
0
# generate example figures with main PyECLOUD outputs
# Thanks for E. Belli, L. Mether and A. Romano for preparing this script

import sys, os
BIN = os.path.expanduser("../../../")
sys.path.append(BIN)

import pylab as pl
import numpy as np

import PyECLOUD.myloadmat_to_obj as mlo
import PyECLOUD.mystyle as ms

pl.close('all')
ms.mystyle_arial(fontsz=16)
dpiset = 200

ob=mlo.myloadmat_to_obj('../../testing/tests_buildup/LHC_ArcDipReal_450GeV_sey1.60_2.5e11ppb_bl_1.00ns/Pyecltest_ref.mat')

ifig = 0

#################################
# Variables saved per time step #
#################################

#8.
ifig+=1; pl.figure(ifig)
pl.plot(ob.t, ob.lam_t_array, linewidth=2)
pl.xlabel('Time [s]')
pl.ylabel('Beam profile [p/m]') 
ms.scix(); pl.grid('on')
Exemplo n.º 5
0
pl.close('all')

sim_folder = './'

dict_ref = mlm.myloadmat(
    '../tests_buildup/LHC_ArcDipReal_450GeV_sey1.70_2.5e11ppb_bl_1.00ns_multigrid/'
    + '/Pyecltest_angle3D_ref.mat'
)  # load dictionary of the reference simulation
dict_curr0 = mlm.myloadmat(
    './test_saving__iter0.mat')  # load dictionary of the current simulation
dict_curr1 = mlm.myloadmat(
    './test_saving__iter1.mat')  # load dictionary of the current simulation

pl.close('all')
myfontsz = 16
ms.mystyle_arial(fontsz=myfontsz)

fig1 = pl.figure(1)
fig1.set_facecolor('w')
ax1 = fig1.add_subplot(1, 1, 1)
ax1.plot(dict_ref['t'],
         dict_ref['Nel_timep'],
         '-',
         linewidth=2,
         label="Buildup simulation")
ax1.plot(dict_curr0['t'] - 10e-9 - dict_curr0['t'][0],
         dict_curr0['Nel_timep'],
         'r-',
         linewidth=2,
         label='PyHT beam, turn 1')
ax1.plot(dict_curr1['t'] - 10e-9 - dict_curr1['t'][0],
Exemplo n.º 6
0
ob.xg = ob.xg[N_discard:-N_discard]
ob.yg = ob.yg[N_discard:-N_discard]
ob.rho = ob.rho[:, N_discard:-N_discard, N_discard:-N_discard]
ob.phi = ob.phi[:, N_discard:-N_discard, N_discard:-N_discard]
ob.Ex = ob.Ex[:, N_discard:-N_discard, N_discard:-N_discard]
ob.Ey = ob.Ey[:, N_discard:-N_discard, N_discard:-N_discard]

ob.rho /= -qe

x_obs = 0.
ix_obs = np.argmin(np.abs(ob.xg - x_obs))
y_obs = 0.
iy_obs = np.argmin(np.abs(ob.yg - y_obs))

plt.close('all')
ms.mystyle_arial()
fig1 = plt.figure(1, figsize=(8, 6 * 1.5))
fig1.set_facecolor('w')
ax1 = fig1.add_subplot(3, 1, 1)
ax2 = fig1.add_subplot(3, 1, 2, sharex=ax1)
ax3 = fig1.add_subplot(3, 1, 3, sharex=ax1)

mbl = ax1.pcolormesh(ob.zg, ob.yg, ob.rho[:, ix_obs, :].T)
plt.colorbar(mappable=mbl, ax=ax1, aspect=5)
mbl = ax2.pcolormesh(ob.zg, ob.yg, ob.Ey[:, ix_obs, :].T)
plt.colorbar(mappable=mbl, ax=ax2, aspect=5, format='%.1e')
mbl = ax3.pcolormesh(ob.zg, ob.yg, ob.phi[:, ix_obs, :].T)
plt.colorbar(mappable=mbl, ax=ax3, aspect=5)

fig1.subplots_adjust(hspace=.4)
Exemplo n.º 7
0
N_dec = 1
lim_dens = [10, 14]
flag_log = True
outp_filname = 'pass%d.avi'%passlist[0]

########

########

qe = 1.60217657e-19
c = 299792458.

i_photog = 0

ms.mystyle_arial(fontsz=fontsz, dist_tick_lab=10)

chamber = mlo.myloadmat_to_obj(folder_sim + '/LHC_chm_ver.mat')
Vx = chamber.Vx
Vy = chamber.Vy

##load output file
obout = mlo.myloadmat_to_obj(folder_sim + '/' + main_outp_filename)
t = obout.t
lam_b1 = obout.lam_t_array
cendens = np.squeeze(obout.cen_density)

#every bunch passage
for pass_ind in passlist:

    filename_rho = 'rho_video/rho_pass%d.mat'%pass_ind
ref_folder = sim_folder
curr_folder = sim_folder

folder_plot = sim_folder+'/comparison_plots'


try:
	os.mkdir(folder_plot)
except OSError as err:
	print 'Folder not created due to exception:'
	print err
	


myfontsz = 14
ms.mystyle_arial(fontsz=myfontsz)

dict_ref = mlm.myloadmat(ref_folder+'/Pyecltest_ref.mat') # load dictionary of the reference simulation 
dict_curr = mlm.myloadmat(curr_folder+'/Pyecltest.mat')  # load dictionary of the current simulation   

                                 
out_var_ref = dict_ref.keys()   	# returns the list of keys
out_var_curr = dict_curr.keys()

out_var_ref.sort()     	# sort the keys in alphabetical order 
out_var_curr.sort() 

n_pass = 35  # reference passage