Пример #1
0
import sys, os
BIN = os.path.expanduser("../")
sys.path.append(BIN)

from PyECLOUD.buildup_simulation import BuildupSimulation

sim = BuildupSimulation()
sim.run()
Пример #2
0
    default='3D')
parser.add_argument('--skip_sey_extraction',
                    help='No SEY extraction',
                    action='store_true')

args = parser.parse_args()
if args.folder:
    sim_folder = args.folder

angle_distribution = 'cosine_%s' % args.angle_dist_func
filen_main_outp = sim_folder + '/Pyecltest_angle%s.mat' % args.angle_dist_func

time_0 = time.time()
sim = BuildupSimulation(pyecl_input_folder=sim_folder,
                        filen_main_outp=filen_main_outp,
                        secondary_angle_distribution=angle_distribution,
                        photoelectron_angle_distribution=angle_distribution,
                        extract_sey=not (args.skip_sey_extraction))
time_1 = time.time()
sim.run()
time_2 = time.time()

time_init = time_1 - time_0
time_run = time_2 - time_1

print('')
print('Test simulation done in %.2f s (init: %.1f s, run: %.1f s)!' %
      (time_init + time_run, time_init, time_run))
print('To inspect the results you can run:')
print('001_comparison_against_reference.py')
print('')
Пример #3
0
import sys, os
BIN = os.path.expanduser(
    "../../../")  #folder containing PyECLOUD, PyPIC, PyKLU
sys.path.append(BIN)

#ignore warnings
import warnings
warnings.filterwarnings("ignore")

sim_folder = 'LHC_ArcDipReal_450GeV_sey1.70_2.5e11ppb_bl_1.00ns'
#~ sim_folder = 'LHC_ArcDipReal_450GeV_sey1.70_2.5e11ppb_bl_1.00ns_multigrid'
#~ sim_folder = 'LHC_ArcQuadReal_450GeV_sey1.65_2.5e11ppb_bl_1.00ns'
#~ sim_folder = 'LHC_ArcDipReal_450GeV_sey1.00_2.5e11ppb_bl_1.00ns_gas_ionization'
#~ sim_folder = 'LHC_ArcDipReal_450GeV_sey1.70_2.5e11ppb_bl_1.00ns_change_s_and_E0'

from PyECLOUD.buildup_simulation import BuildupSimulation

sim = BuildupSimulation(pyecl_input_folder=sim_folder,
                        filen_main_outp=sim_folder + '/Pyecltest.mat')
sim.run()

print ''
print 'Test simulation done!'
print 'To inspect the results you can run:'
print '001_comparison_against_reference.py'
print ''
Пример #4
0
    'ref_size':
    lambda sim: sim.cloud_list[0].MP_e.nel_mp_ref
}

pass_by_pass_custom_observables = {
    'sum_rho': lambda sim: np.sum(sim.cloud_list[0].rho, axis=1)
}

save_once_custom_observables = {
    'Vx': lambda sim: sim.cloud_list[0].impact_man.chamb.Vx
}

sim = BuildupSimulation(
    pyecl_input_folder=sim_input_folder,
    filen_main_outp='./Pyecltest.mat',
    extract_sey=False,
    step_by_step_custom_observables=step_by_step_custom_observables,
    pass_by_pass_custom_observables=pass_by_pass_custom_observables,
    save_once_custom_observables=save_once_custom_observables)

ec = sim.cloud_list[0]

for ii, t_stop in enumerate(t_stop_list):
    print('\n\n==============================')
    print(('Simulation run %d - t_stop = %s s' % (ii, repr(t_stop))))
    print((' starting at tt=%s s' % repr(sim.beamtim.tt_curr)))

    sim.run(t_end_sim=t_stop)

    print((' after run a tt=%s' % repr(sim.beamtim.tt_curr)))
Пример #5
0
from PyECLOUD.buildup_simulation import BuildupSimulation

sim_input_folder = '../../testing/tests_buildup/LHC_ArcDipReal_450GeV_sey1.70_2.5e11ppb_bl_1.00ns'

from mpi4py import MPI
comm = MPI.COMM_WORLD

myid = comm.Get_rank()

x_aper = 2.3e-2
x_max_list = [-1e-2, 0, 1e-2, x_aper]

sim = BuildupSimulation(
    pyecl_input_folder=sim_input_folder,
    filen_main_outp='./Pyecltest_%02d.mat' % myid,
    flag_En_hist_seg=True,
    extract_sey=False,
    Nbin_En_hist=300,
    En_hist_max=2500.,  #eoV
    x_max_init_unif=x_max_list[myid])
sim.spacech_ele.comm = comm

sim.run(t_end_sim=5 * 25e-9)

ec = sim.cloud_list[0]

import matplotlib.pyplot as plt
plt.close('all')
fig = plt.figure(100 + myid)
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2)
Пример #6
0
import numpy as np

from PyECLOUD.buildup_simulation import BuildupSimulation

sim_input_folder = '../../testing/tests_buildup/LHC_ArcDipReal_450GeV_sey1.70_2.5e11ppb_bl_1.00ns'

save_only = 't Nel_timep xg_hist nel_hist'.split()

sim = BuildupSimulation(
    pyecl_input_folder=sim_input_folder,
    filen_main_outp='./Pyecltest.mat',
    flag_En_hist_seg=True,
    extract_sey=False,
    Nbin_En_hist=300,
    En_hist_max=2500.,  #eV i
    save_only=save_only)

sim.run(t_end_sim=None)
}
save_once_custom_observables = {
    'Vx': lambda sim: sim.cloud_list[0].impact_man.chamb.Vx,
    'Vy': lambda sim: sim.cloud_list[0].impact_man.chamb.Vy,
    'L_edg': lambda sim: sim.cloud_list[0].impact_man.chamb.L_edg,
    'flag_charging':
    lambda sim: sim.cloud_list[0].impact_man.sey_mod.flag_charging,
    'Q_max_segments':
    lambda sim: sim.cloud_list[0].impact_man.sey_mod.Q_max_segments,
    'EQ_segments':
    lambda sim: sim.cloud_list[0].impact_man.sey_mod.EQ_segments,
    'tau_segments':
    lambda sim: sim.cloud_list[0].impact_man.sey_mod.tau_segments,
}

additional_kwargs = {}

if seed_only_patch:
    additional_kwargs.update({
        'x_min_init_unif': 6.5e-3,
        'x_max_init_unif': 9.5e-3
    })

sim = BuildupSimulation(
    step_by_step_custom_observables=step_by_step_custom_observables,
    pass_by_pass_custom_observables=pass_by_pass_custom_observables,
    save_once_custom_observables=save_once_custom_observables,
    **additional_kwargs)

sim.run(t_end_sim=None)
Пример #8
0

step_by_step_custom_observables = {
    'N_observed': observe_electrons,
}

pass_by_pass_custom_observables = {}

save_once_custom_observables = {}

sim = BuildupSimulation(
    pyecl_input_folder=sim_input_folder,
    logfile_path='logfile.txt',
    progress_path='progress.txt',
    filen_main_outp='./Pyecltest.mat',
    secondary_angle_distribution='cosine_3D',
    fact_clean=0.,  # cleanings would move electrons around
    extract_sey=False,
    step_by_step_custom_observables=step_by_step_custom_observables,
    pass_by_pass_custom_observables=pass_by_pass_custom_observables,
    save_once_custom_observables=save_once_custom_observables)

ec = sim.cloud_list[0]

for ii, t_stop in enumerate(t_stop_list):
    print('\n\n==============================')
    print(('Simulation run %d - t_stop = %s s' % (ii, repr(t_stop))))
    print((' starting at tt=%s s' % repr(sim.beamtim.tt_curr)))

    sim.run(t_end_sim=t_stop)
Пример #9
0
import sys, os
BIN = os.path.expanduser("../../../")
sys.path.append(BIN)

# sim_folder = 'LHC_ArcDipReal_450GeV_sey1.70_2.5e11ppb_bl_1.00ns'
# sim_folder = 'LHC_ArcQuadReal_450GeV_sey1.65_2.5e11ppb_bl_1.00ns'
sim_folder = 'LHC_ArcDipReal_450GeV_sey1.00_2.5e11ppb_bl_1.00ns_gas_ionization'


from PyECLOUD.buildup_simulation import BuildupSimulation


sim = BuildupSimulation(pyecl_input_folder = sim_folder, filen_main_outp = sim_folder+'/Pyecltest.mat')
sim.run()


print ''
print 'Test simulation done!'
print 'To instpect the results you can run:'
print '001_comparison_against_reference.py'
print ''
Пример #10
0
import numpy as np

from PyECLOUD.buildup_simulation import BuildupSimulation

sim_input_folder = './input_files'

save_once_custom_observables = {
        'Vx': lambda sim: sim.cloud_list[0].impact_man.chamb.Vx,
        'Vy': lambda sim: sim.cloud_list[0].impact_man.chamb.Vy,
        'L_edg': lambda sim: sim.cloud_list[0].impact_man.chamb.L_edg,
        }


sim = BuildupSimulation(pyecl_input_folder=sim_input_folder, 
        filen_main_outp='./Pyecltest.mat',
        filename_chm='chamber.mat',
        flag_En_hist_seg = True, 
        extract_sey=False,
        Nbin_En_hist= 300, 
        En_hist_max= 2500.,  #eV 
        save_once_custom_observables=save_once_custom_observables)

sim.run(t_end_sim=None)
Пример #11
0
import sys
import os
BIN = os.path.expanduser("../../../../")
sys.path.append(BIN)

from PyECLOUD.buildup_simulation import BuildupSimulation

saved_states_list = [f for f in os.listdir('./') if (f.find('simulation_checkpoint_') != -1)]
if len(saved_states_list) == 0:
    raise Exception('No simulation checkpoint file was found')
saved_states_list.sort()


last_saved_state = saved_states_list[-1]

sim = BuildupSimulation()
sim.load_checkpoint(last_saved_state)
sim.run()
# merge_Pyecltest.merge_Pyecltest()
Пример #12
0
import sys, os
BIN = os.path.expanduser("../")
sys.path.append(BIN)


from PyECLOUD.buildup_simulation import BuildupSimulation


sim = BuildupSimulation()
sim.load_state('simulation_state_0.pkl')
sim.run()
Пример #13
0
import sys, os
BIN = os.path.expanduser("../")
sys.path.append(BIN)

from PyECLOUD.buildup_simulation import BuildupSimulation
input_folder = 'testing/tests_buildup/LHC_ArcDipReal_450GeV_sey1.70_2.5e11ppb_bl_1.00ns_stress_saver/'

sim = BuildupSimulation(pyecl_input_folder=input_folder)

# Optionally enable video saving
for cloud in sim.cloud_list:
    cloud.pyeclsaver.flag_video = False
    cloud.pyeclsaver.flag_sc_video = False

sim.load_state(input_folder + '/simulation_state_0.pkl')
sim.run()
parser = argparse.ArgumentParser()
parser.add_argument('--folder', help='Simulation_folder')
parser.add_argument(
    '--angle-dist-func',
    help=
    'Angular distribution of new MPs relative to surface normal. Introduced in July 2017.',
    choices=('2D', '3D'),
    default='3D')

args = parser.parse_args()
if args.folder:
    sim_folder = args.folder

angle_distribution = 'cosine_%s' % args.angle_dist_func
filen_main_outp = sim_folder + '/Pyecltest_angle%s.mat' % args.angle_dist_func

time_0 = time.time()
sim = BuildupSimulation(pyecl_input_folder=sim_folder,
                        filen_main_outp=filen_main_outp,
                        secondary_angle_distribution=angle_distribution,
                        photoelectron_angle_distribution=angle_distribution)
sim.run()

time_needed = time.time() - time_0

print('')
print('Test simulation done in %.2f s!' % time_needed)
print('To inspect the results you can run:')
print('001_comparison_against_reference.py')
print('')
from PyECLOUD.buildup_simulation import BuildupSimulation

# Build the simulation object
sim = BuildupSimulation(extract_sey=False)
# Run the simulation
sim.run()
Пример #16
0
        pyeclsaver.Fesfx_video = []
        pyeclsaver.Fesfy_video = []
        pyeclsaver.Fbfx_video = []
        pyeclsaver.Fbfy_video = []
        pyeclsaver.Fbfz_video = []
        pyeclsaver.t_efield_video_new = []
    return 0


step_by_step_custom_observables = {
        'dummy2': lambda sim : _forces_movie_save(sim)
        }


sim = BuildupSimulation(pyecl_input_folder=sim_input_folder,
        filen_main_outp='./Pyecltest.mat',
        extract_sey=False,
        step_by_step_custom_observables = step_by_step_custom_observables)

_forces_movie_init(sim,sim_input_folder)

sim.run()

ob1 = mlo.myloadmat('Pyecltest.mat')
cloud = sim.cloud_list[0]
pyeclsaver = cloud.pyeclsaver
ob1['forces_ratio_hist'] = pyeclsaver.forces_ratio_hist
ob1['forces_ratio_hist_bins'] = pyeclsaver.forces_ratio_hist_bins
ob1['t_forces_ratio_hist'] = pyeclsaver.t_forces_ratio_hist
sio.savemat('Pyecltest_enhanced.mat', ob1, oned_as='row')
Пример #17
0
import sys, os
BIN = os.path.expanduser("../")
sys.path.append(BIN)

from PyECLOUD.buildup_simulation import BuildupSimulation

sim = BuildupSimulation()
sim.load_state('simulation_state_0.pkl')
sim.run()