line, part=part, Dx_wrt_CO_m=0., Dpx_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 0].flatten(), Dy_wrt_CO_m=0, Dpy_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 1].flatten(), Dsigma_wrt_CO_m=0., Ddelta_wrt_CO=0., n_turns=n_turns, verbose=True) info = track_with elif track_with == 'Sixtrack': x_tbt, px_tbt, y_tbt, py_tbt, sigma_tbt, delta_tbt = hp.track_particle_sixtrack( partCO=partCO, Dx_wrt_CO_m=0., Dpx_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 0].flatten(), Dy_wrt_CO_m=0, Dpy_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 1].flatten(), Dsigma_wrt_CO_m=0., Ddelta_wrt_CO=0., n_turns=n_turns) info = track_with elif track_with == 'Sixtracklib': x_tbt, px_tbt, y_tbt, py_tbt, sigma_tbt, delta_tbt = hp.track_particle_sixtracklib( line=line, partCO=partCO, Dx_wrt_CO_m=0., Dpx_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 0].flatten(), Dy_wrt_CO_m=0., Dpy_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 1].flatten(), Dsigma_wrt_CO_m=0., Ddelta_wrt_CO=0., n_turns=n_turns, device_opencl=device_opencl) info = track_with if device_opencl is None: info += ' (CPU)' else: info += ' (GPU %s)'%device_opencl else: raise ValueError('What?!') n_part = x_tbt.shape[1] Qx = np.zeros(n_part) Qy = np.zeros(n_part) for i_part in range(n_part): Qx[i_part] = NAFFlib.get_tune(x_tbt[:, i_part])
Dpx_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 0].flatten(), Dy_wrt_CO_m=0, Dpy_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 1].flatten(), Dsigma_wrt_CO_m=0., Ddelta_wrt_CO=0., n_turns=n_turns) os.chdir('..') info = track_with elif track_with == 'Sixtracklib': x_tbt, px_tbt, y_tbt, py_tbt, sigma_tbt, delta_tbt = hp.track_particle_sixtracklib( line=line, partCO=partCO, Dx_wrt_CO_m=0., Dpx_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 0].flatten(), Dy_wrt_CO_m=0., Dpy_wrt_CO_rad=DpxDpy_wrt_CO[:, :, 1].flatten(), Dsigma_wrt_CO_m=0., Ddelta_wrt_CO=0., n_turns=n_turns, device=device) info = track_with if device is None: info += ' (CPU)' else: info += ' (GPU %s)' % device else: raise ValueError('What?!') n_part = x_tbt.shape[1] Qx = np.zeros(n_part)
x_tbt_pyST, px_tbt_pyST, y_tbt_pyST, py_tbt_pyST, sigma_tbt_pyST, delta_tbt_pyST = hp.track_particle_pysixtrack( line, part=part, Dx_wrt_CO_m=Dx_m, Dpx_wrt_CO_rad=Dpx_rad, Dy_wrt_CO_m=Dy_m, Dpy_wrt_CO_rad=Dpy_rad, Dsigma_wrt_CO_m=Dsigma_m, Ddelta_wrt_CO=Ddelta, n_turns=n_turns, verbose=True) dict_tbt['PyST'] = {kk:vv for kk,vv in zip('x y px py sigma delta'.split(), [x_tbt_pyST, px_tbt_pyST, y_tbt_pyST, py_tbt_pyST, sigma_tbt_pyST, delta_tbt_pyST])} print('Tracking ST') x_tbt_ST, px_tbt_ST, y_tbt_ST, py_tbt_ST, sigma_tbt_ST, delta_tbt_ST = hp.track_particle_sixtrack( partCO=partCO, Dx_wrt_CO_m=np.array([Dx_m, Dx_m]), Dpx_wrt_CO_rad=Dpx_rad, Dy_wrt_CO_m=Dy_m, Dpy_wrt_CO_rad=Dpy_rad, Dsigma_wrt_CO_m=Dsigma_m, Ddelta_wrt_CO=Ddelta, n_turns=n_turns) dict_tbt['ST'] = {kk:vv for kk,vv in zip('x y px py sigma delta'.split(), [x_tbt_ST, px_tbt_ST, y_tbt_ST, py_tbt_ST, sigma_tbt_ST, delta_tbt_ST])} print('Tracking STlib') x_tbt_STl, px_tbt_STl, y_tbt_STl, py_tbt_STl, sigma_tbt_STl, delta_tbt_STl = hp.track_particle_sixtracklib( line, partCO=partCO, Dx_wrt_CO_m=np.array([Dx_m, Dx_m]), Dpx_wrt_CO_rad=Dpx_rad, Dy_wrt_CO_m=Dy_m, Dpy_wrt_CO_rad=Dpy_rad, Dsigma_wrt_CO_m=Dsigma_m, Ddelta_wrt_CO=Ddelta, n_turns=n_turns) dict_tbt['STlib'] = {kk:vv for kk,vv in zip('x y px py sigma delta'.split(), [x_tbt_STl, px_tbt_STl, y_tbt_STl, py_tbt_STl, sigma_tbt_STl, delta_tbt_STl])} plt.close('all') fig1 = plt.figure(1, figsize=(8 * 1.5, 6 * 1.2)) axx = fig1.add_subplot(3, 2, 1) axx.plot(x_tbt_pyST[:, 0], label='PyST') axx.plot(x_tbt_ST[:, 0], label='ST') axx.plot(x_tbt_STl[:, 0], label='STl') axx.set_ylabel('x [m]') axy = fig1.add_subplot(3, 2, 2, sharex=axx) axy.plot(y_tbt_pyST, label='PyST') axy.plot(y_tbt_ST[:, 0], label='ST')
Dy_wrt_CO_m=Dy_m, Dpy_wrt_CO_rad=Dpy_rad, Dsigma_wrt_CO_m=Dsigma_m, Ddelta_wrt_CO=Ddelta, n_turns=n_turns) dict_tbt['ST'] = { kk: vv for kk, vv in zip('x y px py sigma delta'.split( ), [x_tbt_ST, px_tbt_ST, y_tbt_ST, py_tbt_ST, sigma_tbt_ST, delta_tbt_ST]) } print('Tracking STlib') x_tbt_STl, px_tbt_STl, y_tbt_STl, py_tbt_STl, sigma_tbt_STl, delta_tbt_STl = hp.track_particle_sixtracklib( line, partCO=partCO, Dx_wrt_CO_m=np.array([Dx_m, Dx_m]), Dpx_wrt_CO_rad=Dpx_rad, Dy_wrt_CO_m=Dy_m, Dpy_wrt_CO_rad=Dpy_rad, Dsigma_wrt_CO_m=Dsigma_m, Ddelta_wrt_CO=Ddelta, n_turns=n_turns) dict_tbt['STlib'] = { kk: vv for kk, vv in zip('x y px py sigma delta'.split(), [ x_tbt_STl, px_tbt_STl, y_tbt_STl, py_tbt_STl, sigma_tbt_STl, delta_tbt_STl ]) } print('Tracking PyST') x_tbt_pyST, px_tbt_pyST, y_tbt_pyST, py_tbt_pyST, sigma_tbt_pyST, delta_tbt_pyST = hp.track_particle_pysixtrack( line, part=part,