def p_array(): np.random.seed(11) # generate beam file sigma_x = 0.000121407185261 sigma_px = 1.80989470506e-05 sigma_y = 0.000165584800564 sigma_py = 4.00994225888e-05 p_array = generate_parray(sigma_x=sigma_x, sigma_px=sigma_px, sigma_y=sigma_y, sigma_py=sigma_py, sigma_tau=1.30190131e-04, sigma_p=3.09815718e-04, tau_p_cor=0.002, charge=0.5e-9, nparticles=20000, energy=0.13) return p_array
def p_array(): np.random.seed(33) p_array = generate_parray(sigma_x=0, sigma_px=0, sigma_y=None, sigma_py=None, sigma_tau=100e-6 / 2.36, sigma_p=0, chirp=0.01 / 2.36, charge=0.5e-9, nparticles=10000, energy=0.6) return p_array
und_start = Marker() und_stop = Marker() cell = (D0, BL_48I_I1, D1, BL_48II_I1, D2, und_start, UNDU, und_stop, D2, BL_50I_I1, D1, BL_50II_I1, D3) sigma_x = 0.000121407185261 sigma_px = 1.80989470506e-05 sigma_y = 0.000165584800564 sigma_py = 4.00994225888e-05 p_array = generate_parray(sigma_x=sigma_x, sigma_px=sigma_px, sigma_y=None, sigma_py=None, sigma_tau=1.30190131e-04, sigma_p=3.09815718e-04, tau_p_cor=0.002, charge=0.5e-9, nparticles=200000, energy=0.13) m = MethodTM() m.global_method = SecondTM lat = MagneticLattice(cell, method=m) navi = Navigator(lat) navi.unit_step = 0.05 csr = CSR() csr.energy = p_array.E
und.npoints = 2000 cell = (d1, und, d2) method = MethodTM() method.params[Undulator] = RungeKuttaTM method.global_method = SecondTM lat = MagneticLattice(cell, method=method) np.random.seed(33) p_array = generate_parray(sigma_x=0, sigma_px=0, sigma_y=None, sigma_py=None, sigma_tau=100e-6 / 2.36, sigma_p=0, chirp=0.01 / 2.36, charge=0.5e-9, nparticles=10000, energy=0.6) p_array_1 = copy.deepcopy(p_array) navi = Navigator(lat) tws_track, p_array_1 = track(lat, p_array_1, navi, calc_tws=False) plt.plot(p_array.tau() * 1000, p_array.p(), ".", label="initial distrib.") plt.plot(p_array_1.tau() * 1000, p_array_1.p(), ".", label="after undul") plt.legend() plt.grid(True) plt.show()