from ext.las_str.part_generator import * from ext.las_str.ls_math import * from ext.las_str.emittance import * from ext.las_str.print_mod import printf orbit_path = os.environ["ORBIT_ROOT"] addr = orbit_path+"/ext/laserstripping/working_dir/" trans = orbit_path+"/ext/laserstripping/transitions/" n_states = 3 pf = printf("ProjectX_%i.dat"%n_states,"level","polarization", "Bx [T]", "rmsAng. [mrad]", "emitt. [mm mrad]","em_norm. [mm mrad]", "efficiency") #for n_states, polar, Bx in [(n_states, polar, By) # for n_states in [4] # for polar in [0, 1] # for By in [0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.05, # 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2.0, 2.05, 2.1]]: for polar, Bx in [(polar, Bx) for polar in [1] for Bx in [0.35]]: n_step = 1000000 Nevol=100000 h = 0.05
from bunch import * from orbit_mpi import * import time, os from ext.las_str.part_generator import * from ext.las_str.ls_math import * from ext.las_str.emittance import * from ext.las_str.print_mod import printf orbit_path = os.environ["ORBIT_ROOT"] addr = orbit_path + "/ext/laserstripping/working_dir/" trans = orbit_path + "/ext/laserstripping/transitions/" n_states = 3 pf = printf("ProjectX_%i.dat" % n_states, "level", "polarization", "Bx [T]", "rmsAng. [mrad]", "emitt. [mm mrad]", "em_norm. [mm mrad]", "efficiency") #for n_states, polar, Bx in [(n_states, polar, By) # for n_states in [4] # for polar in [0, 1] # for By in [0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.05, # 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2.0, 2.05, 2.1]]: for polar, Bx in [(polar, Bx) for polar in [1] for Bx in [0.35]]: n_step = 1000000 Nevol = 100000 h = 0.05 z1 = -5 * h
#-------------------list of parameters to be optimized----------------------------# name_args,guess,increments,name_args_pr,print_factor = [],[],[],[],[] name_args.append('env_sigma'), guess.append(15.0e-12), increments.append(24.0e-13),name_args_pr.append('env_sigma[ps]'),print_factor.append(1e12) name_args.append('rx'), guess.append(3.9e-3), increments.append(1.0e-4), name_args_pr.append('rx[mm]'),print_factor.append(1e3) name_args.append('ry'), guess.append(1.34e-3), increments.append(1.0e-4), name_args_pr.append('ry[mm]'),print_factor.append(1e3) #name_args.append('ax'), guess.append(2.7e-3), increments.append(1.0e-4), name_args_pr.append('ax[mrad]'),print_factor.append(1e3) #name_args.append('ay'), guess.append(0.0e-3), increments.append(1.0e-4), name_args_pr.append('ay[mrad]'),print_factor.append(1e3) name_args.append('Bx'), guess.append(2.00), increments.append(0.1), name_args_pr.append('Bx[T]'),print_factor.append(1) pf = printf("test.dat",["N_step","cpu_time","W[MW]"] + name_args_pr + ["Popul", "+- Pop", "P_ioniz", "+- P_ioniz"]) #-------------------list of parameters to be optimized----------------------------# #-------------------definition of the optimization function----------------------------# def opt_func1(args):
import sys, math, os, orbit_mpi from trackerrk4 import * from laserstripping import * from bunch import * import orbit_mpi import time, os from ext.las_str.part_generator import * from ext.las_str.ls_math import * from ext.las_str.emittance import * from ext.las_str.print_mod import printf orbit_path = os.environ["ORBIT_ROOT"] addr = orbit_path + "/ext/laserstripping/working_dir/" trans = orbit_path + "/ext/laserstripping/transitions/" pf = printf("Hminus.dat", "By [T]", "rmsAng. [mrad]", "emitt. [mm mrad]", "em_norm. [mm mrad]", "efficiency") #for n_states, polar, By in [(n_states, polar, By) # for n_states in [2, 3, 4, 5] # for polar in [0, 1] # for By in [0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.05, # 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2.0, 2.05, 2.1]]: for Bx in [0.45]: n_step = 10000000 Nevol = 10000 h = 0.050 z1 = -2 * h
#-------------------list of parameters to be optimized----------------------------# name_args, guess, increments, name_args_pr, print_factor = [], [], [], [], [] name_args.append('env_sigma'), guess.append(30.0e-12), increments.append( 30.0e-13), name_args_pr.append('env_sigma[ps]'), print_factor.append(1e12) name_args.append('rx'), guess.append(2.0e-3), increments.append( 1.0e-4), name_args_pr.append('rx[mm]'), print_factor.append(1e3) #name_args.append('ry'), guess.append(2.03e-3), increments.append(1.0e-4), name_args_pr.append('ry[mm]'),print_factor.append(1e3) #name_args.append('ax'), guess.append(0.4e-3), increments.append(1.0e-4), name_args_pr.append('ax[mrad]'),print_factor.append(1e3) #name_args.append('ay'), guess.append(1.64e-3), increments.append(1.0e-4), name_args_pr.append('ay[mrad]'),print_factor.append(1e3) name_args.append('Bx'), guess.append(1.5), increments.append( 0.1), name_args_pr.append('Bx[T]'), print_factor.append(1) pf = printf("optimiz_2_1064_field.dat", ["N_step", "cpu_time", "W[MW]"] + name_args_pr + ["Popul", "+- Pop", "P_ioniz", "+- P_ioniz"]) #-------------------list of parameters to be optimized----------------------------# #-------------------definition of the optimization function----------------------------# def opt_func1(args): for i in range(len(args)): H13.__dict__[name_args[i]] = args[i] pop, sigma_pop, p_ioniz, sigma_p_ioniz = H13.population() pf.fdata(H13.count, orbit_mpi.MPI_Wtime() - time_start, H13.power / 1.0e+6, 1.0e+3 * H13.rx, 1.0e+3 * H13.ry, 1.0e+3 * H13.ax,
H13.rx = 1.69e-3 # [m] H13.ry = 0.77e-3 # [m] H13.ax = 0.36e-3 # [rad] H13.ay = 0.24e-3 # [rad] #----------------------End of the Laser field and excitation parameters of H0 atom----------------------# #H13.bunch.dumpBunch("bunch_init1.dat") #-------------------definition of the optimization function----------------------------# #pf = printf("optimiz.dat","N_part","cpu_time", "W[MW]", "wx[um]", "wy[um]", "fx[cm]", "fy[cm]", "Population", "+- Err") pf = printf("optimiz_sh1.0_test.dat","N_step","cpu_time", "W[MW]","rx[mm]", "ry[mm]", "ax[mrad]", "ay[mrad]", "Population", "+- Err") #name_args, guess, increments = ['wx','wy'],[300.0e-6, 300.0e-6],[10e-6, 100e-6] #name_args, guess, increments = ['wx','wy','fx'], [333.0e-6, 333.0e-6,-2.800], [10e-6, 100e-6,1.00] name_args, guess, increments = ['rx','ry','ax','ay'], [0.7e-3,0.7e-3,0.3e-3,0.3e-3], [1.0e-4,1.0e-4,1.0e-5,1.0e-5] #name_args, guess, increments = ['rx','ry','ax','ay'], [68.45e-3,0.377e-3,0.2e-3,0.2e-3], [1.0e-4,1.0e-4,1.0e-4,1.0e-4] #name_args, guess, increments = ['wx','fx'], [370.0e-6, -4.500], [10e-6,1.00] #name_args, guess, increments = ['wx','wy','fx','fy'], [300.6e-6, 300.6e-6,-2.0,-2.0], [10e-6, 10e-6,1.00,1.00] #powers = [0.1e6, 0.2e6, 0.3e6, 0.4e6, 0.5e6, 0.6e6, 0.7e6, 0.8e6, 0.9e6, 1.0e6] #powers = [0.5e6] #powers = [0.1e6, 0.2e6, 0.3e6, 0.4e6, 0.5e6, 0.6e6, 0.7e6, 0.8e6, 0.9e6, 1.0e6, 1.1e6, 1.2e6, 1.3e6, 1.4e6, 1.5e6, 1.6e6, 1.7e6, 1.8e6, 1.9e6, 2.0e6] def opt_func(args):
#H13.bunch.dumpBunch("bunch_init1.dat") #-------------------list of parameters to be optimized----------------------------# name_args, guess, increments, name_args_pr, print_factor = [], [], [], [], [] #name_args.append('env_sigma'), guess.append(15.0e-12), increments.append(24.0e-13),name_args_pr.append('env_sigma[ps]'),print_factor.append(1e12) name_args.append('rx'), guess.append(0.2e-3), increments.append( 0.05e-3), name_args_pr.append('rx[mm]'), print_factor.append(1e3) #name_args.append('ry'), guess.append(1.3e-3), increments.append(1.0e-4), name_args_pr.append('ry[mm]'),print_factor.append(1e3) name_args.append('ax'), guess.append(0.5e-3), increments.append( 0.1e-3), name_args_pr.append('ax[mrad]'), print_factor.append(1e3) #name_args.append('ay'), guess.append(0.45e-3), increments.append(1.0e-4), name_args_pr.append('ay[mrad]'),print_factor.append(1e3) #name_args.append('Bx'), guess.append(2.00), increments.append(0.1), name_args_pr.append('Bx[T]'),print_factor.append(1) pf = printf("test.dat", ["N_step", "cpu_time", "W[MW]"] + name_args_pr + ["Popul", "+- Pop", "P_ioniz", "+- P_ioniz"]) #-------------------list of parameters to be optimized----------------------------# #powers = [0.1e6, 0.2e6, 0.3e6, 0.4e6, 0.5e6, 0.6e6, 0.7e6, 0.8e6, 0.9e6, 1.0e6] #powers = [0.5e6] powers = [ 0.1e6, 0.2e6, 0.3e6, 0.4e6, 0.5e6, 0.6e6, 0.7e6, 0.8e6, 0.9e6, 1.0e6, 1.1e6, 1.2e6, 1.3e6, 1.4e6, 1.5e6, 1.6e6, 1.7e6, 1.8e6, 1.9e6, 2.0e6 ] #powers = [0.5e6, 1.0e6, 1.5e6, 2.0e6] def opt_func(args): em = []
from ext.las_str.part_generator import * from ext.las_str.ls_math import * from ext.las_str.emittance import * from ext.las_str.print_mod import printf orbit_path = os.environ["ORBIT_ROOT"] addr = orbit_path+"/ext/laserstripping/working_dir/" trans = orbit_path+"/ext/laserstripping/transitions/" pf = printf("Hminus.dat","By [T]", "rmsAng. [mrad]", "emitt. [mm mrad]","em_norm. [mm mrad]", "efficiency") #for n_states, polar, By in [(n_states, polar, By) # for n_states in [2, 3, 4, 5] # for polar in [0, 1] # for By in [0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.05, # 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2.0, 2.05, 2.1]]: for Bx in [0.45]: n_step = 10000000 Nevol=10000 h = 0.050 z1 = -2*h
H13.env_sigma = 20e-12 #[m] H13.rx = 0.7e-3 # [m] H13.ry = 0.7e-3 # [m] H13.ax = 0.3e-3 # [rad] H13.ay = 0.3e-3 # [rad] #----------------------End of the Laser field and excitation parameters of H0 atom----------------------# #H13.bunch.dumpBunch("bunch_init_sigma.dat") #-------------------definition of the optimization function----------------------------# pf = printf("Project_x_test.dat", "N_step", "cpu_time", "sigma_laser[ps]", "W[MW]", "wx[um]", "wy[um]", "fx[cm]", "fy[cm]", "Population", "+- Err") #pf = printf("optimiz_sh1.0.dat","N_part","cpu_time", "W[MW]", "rx[mm]", "ry[mm]", "ax[mrad]", "ay[mrad]", "Population", "+- Err") #name_args, guess, increments = ['env_sigma','wx','wy','fx','fy'],[20e-12,111.0e-6, 511.0e-6,1.0,1.0],[20e-13,10e-6, 10e-6, 0.1, 0.1] name_args, guess, increments = ['env_sigma', 'wx', 'wy', 'fx', 'fy' ], [20.0e-12, 100.0e-6, 500.0e-6, -3.0, -3.0], [20e-13, 10e-6, 10e-6, 0.1, 0.1] #name_args, guess, increments = ['wx','wy','fx'], [333.0e-6, 333.0e-6,-2.800], [10e-6, 100e-6,1.00] #name_args, guess, increments = ['rx','ry','ax','ay'], [0.7e-3,0.7e-3,0.3e-3,0.3e-3], [1.0e-4,1.0e-4,1.0e-5,1.0e-5] #name_args, guess, increments = ['rx','ry','ax','ay'], [68.45e-3,0.377e-3,0.2e-3,0.2e-3], [1.0e-4,1.0e-4,1.0e-4,1.0e-4] #name_args, guess, increments = ['wx','fx'], [370.0e-6, -4.500], [10e-6,1.00] #name_args, guess, increments = ['wx','wy','fx','fy'], [300.6e-6, 300.6e-6,-2.0,-2.0], [10e-6, 10e-6,1.00,1.00] #powers = [0.1e6, 0.2e6, 0.3e6, 0.4e6, 0.5e6, 0.6e6, 0.7e6, 0.8e6, 0.9e6, 1.0e6] #powers = [0.5e6]