Beispiel #1
0
def save_bunch_to_folder(bunch, dirname):
    import PyPARIS.myfilemanager as mfm
    import PyPARIS.communication_helpers as ch
    if not os.path.exists(dirname):
        os.makedirs(dirname)
    buf = ch.beam_2_buffer(bunch)
    bpath = dirname + '/bunch%d.h5' % bunch.slice_info['i_bunch']
    print(('Saving: ' + bpath))
    mfm.dict_to_h5(dict_save={'bunchbuffer': buf}, filename=bpath)
Beispiel #2
0
	def piece_to_buffer(self, piece):
		buf = ch.beam_2_buffer(piece)
		return buf
 def piece_to_buffer(self, piece):
     buf = ch.beam_2_buffer(piece)
     return buf
Beispiel #4
0
#generate bunch objects
list_bunches = gmb.gen_matched_multibunch_beam(machine, macroparticlenumber, filling_pattern, b_spac_s, bunch_intensity, epsn_x, epsn_y, sigma_z, non_linear_long_matching, min_inten_slice4EC)

beam = sum(list_bunches)

import PyPARIS.slicing_tool as st
import PyPARIS.communication_helpers as ch

# Turn slices into buffer
list_buffers = []
list_bunch_buffers = []
for bb in list_bunches:
    these_slices = st.slice_a_bunch(bb, z_cut=z_cut, n_slices=n_slices)
    list_bunch_buffers.append([])
    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)
Beispiel #5
0
import sys
sys.path.append('../../../')

import PyPARIS_sim_class.Simulation as sim_mod
import PyPARIS.communication_helpers as ch

ring = sim_mod.get_serial_CPUring(init_sim_objects_auto=False)

ring.sim_content.pp.enable_arc_quad = False
ring.sim_content.init_all()
slices = ring.sim_content.init_master()

bunch = ring.sim_content.bunch

import h5py
with h5py.File('generated_bunch.h5', 'w') as fid:
    fid['bunch'] = ch.beam_2_buffer(bunch)