# Define what to save in file bunchmonitor = BunchMonitor(general_params, rf_params, beam, this_directory + '../output_files/EX_07_output_data', Profile=slice_beam) format_options = {'dirname': this_directory + '../output_files/EX_07_fig'} plots = Plot(general_params, rf_params, beam, dt_plt, N_t, 0, 8.e-7, -400e6, 400e6, separatrix_plot=True, Profile=slice_beam, h5file=this_directory + '../output_files/EX_07_output_data', format_options=format_options) # Accelerator map map_ = [long_tracker] + [slice_beam] + [bunchmonitor] + [plots] print("Map set") print("") # Tracking --------------------------------------------------------------------- for i in range(1, N_t + 1):
my_beam, slice_beam, [ind_volt_freq, steps, dir_space_charge]) # PLOTS format_options = { 'dirname': this_directory + '../output_files/EX_02_fig', 'linestyle': '.' } plots = Plot(general_params, RF_sct_par, my_beam, 1, n_turns, 0, 5.72984173562e-7, -my_beam.sigma_dE * 4.2, my_beam.sigma_dE * 4.2, xunit='s', separatrix_plot=True, Profile=slice_beam, h5file=this_directory + '../output_files/EX_02_output_data', histograms_plot=True, format_options=format_options) # ACCELERATION MAP------------------------------------------------------------- map_ = [total_induced_voltage] + [ring_RF_section ] + [slice_beam] + [bunchmonitor] + [plots] # TRACKING + PLOTS-------------------------------------------------------------
'../mpi_output_files/EX_09_output_data', Profile=slices_ring, PhaseLoop=phase_loop) #Plots format_options = { 'dirname': this_directory + '../mpi_output_files/EX_09_fig' } plots = Plot(general_params, rf_params, my_beam, 100, n_turns, 0.0, 2.0 * 0.9e-6, -1.e6, 1.e6, separatrix_plot=True, Profile=slices_ring, format_options=format_options, h5file=this_directory + '../mpi_output_files/EX_09_output_data', PhaseLoop=phase_loop) map_ += [bunch_monitor, plots] my_beam.split() for i in range(1, n_turns + 1): if i == 100: phase_loop.reference += 0.00001 #/1.6e-6
print("Beam set and distribution generated...") # Need slices for the Gaussian fit; slice for the first plot slice_beam = Profile(beam, CutOptions(n_slices=100), FitOptions(fit_option='gaussian')) # Define what to save in file bunchmonitor = BunchMonitor(general_params, rf_params_tot, beam, this_directory + '../output_files/EX_04_output_data', Profile=slice_beam, buffer_time=1) # PLOTS format_options = {'dirname': this_directory + '../output_files/EX_04_fig', 'linestyle': '.'} plots = Plot(general_params, rf_params_tot, beam, dt_plt, dt_plt, 0, 0.0001763*h, -450e6, 450e6, xunit='rad', separatrix_plot=True, Profile=slice_beam, h5file=this_directory + '../output_files/EX_04_output_data', histograms_plot=True, format_options=format_options) # For testing purposes test_string = '' test_string += '{:<17}\t{:<17}\t{:<17}\t{:<17}\n'.format( 'mean_dE', 'std_dE', 'mean_dt', 'std_dt') test_string += '{:+10.10e}\t{:+10.10e}\t{:+10.10e}\t{:+10.10e}\n'.format( np.mean(beam.dE), np.std(beam.dE), np.mean(beam.dt), np.std(beam.dt)) # Accelerator map map_ = [long_tracker_1] + [long_tracker_2] + [slice_beam] #+ [bunchmonitor] + \ #[plots] print("Map set") print("")
distribution_type=distribution_type, distribution_variable=distribution_variable, seed=1222) my_beam.dE += 90.0e3 slices_ring.track() #Monitor bunch_monitor = BunchMonitor(general_params, rf_params, my_beam, this_directory + '../output_files/EX_08_output_data', Profile=slices_ring, PhaseLoop=phase_loop) #Plots format_options = {'dirname': this_directory + '../output_files/EX_08_fig'} plots = Plot(general_params, rf_params, my_beam, 50, n_turns, 0.0, 2*np.pi, -1e6, 1e6, xunit='rad', separatrix_plot=True, Profile=slices_ring, format_options=format_options, h5file=this_directory + '../output_files/EX_08_output_data', PhaseLoop=phase_loop) # Accelerator map map_ = [full_ring] + [slices_ring] + [bunch_monitor] + [plots] for i in range(1, n_turns+1): print(i) for m in map_: m.track() print("Done!")
VindGauss += tmp.real # PLOTS format_options = { 'dirname': this_directory + '../output_files/EX_05_fig/1', 'linestyle': '.' } plots = Plot(general_params, RF_sct_par, my_beam, dt_plt, n_turns, 0, 0.0014 * harmonic_number, -1.5e8, 1.5e8, xunit='rad', separatrix_plot=True, Profile=slice_beam, h5file=this_directory + '../output_files/EX_05_output_data', histograms_plot=True, sampling=50, format_options=format_options) format_options = { 'dirname': this_directory + '../output_files/EX_05_fig/2', 'linestyle': '.' } plots_freq = Plot(general_params_freq, RF_sct_par_freq, my_beam_freq,
rf, beam, this_directory + '../mpi_output_files/EX_01_output_data', Profile=profile) format_options = { 'dirname': this_directory + '../mpi_output_files/EX_01_fig' } plots = Plot(ring, rf, beam, dt_plt, N_t, 0, 0.0001763 * h, -400e6, 400e6, xunit='rad', separatrix_plot=True, Profile=profile, h5file=this_directory + '../mpi_output_files/EX_01_output_data', format_options=format_options) map_ += [bunchmonitor] + [plots] # For testing purposes test_string = '' test_string += '{:<17}\t{:<17}\t{:<17}\t{:<17}\n'.format( 'mean_dE', 'std_dE', 'mean_dt', 'std_dt') test_string += '{:+10.10e}\t{:+10.10e}\t{:+10.10e}\t{:+10.10e}\n'.format(