def test_sampling_exception(self): with self.assertRaisesRegex( RuntimeError, 'ERROR: sampling value in PreprocessRamp not recognised. ' + 'Aborting...', msg='No RuntimeError for wrong sampling!'): RingOptions(sampling=0)
def test_plot_option_exception(self): with self.assertRaisesRegex( RuntimeError, 'ERROR: plot value in PreprocessRamp not recognised. ' + 'Aborting...', msg='No RuntimeError for wrong plot option!'): RingOptions(plot=42)
def test_interpolation_type_exception(self): with self.assertRaisesRegex( RuntimeError, 'ERROR: Interpolation scheme in PreprocessRamp not recognised. ' + 'Aborting...', msg='No RuntimeError for wrong interpolation scheme!'): RingOptions(interpolation='exponential')
def test_flat_top_exception(self): with self.assertRaisesRegex( RuntimeError, 'ERROR: flat_top value in PreprocessRamp not recognised. ' + 'Aborting...', msg='No RuntimeError for negative flat_top!'): RingOptions(flat_top=-42)
gamma_transition = 4.076750841 alpha = 1 / gamma_transition**2 C = 2*np.pi*radius # [m] # Initial and final simulation times initial_time = 0.277 # [s] final_time = 0.700 # [s] momentum_program = np.loadtxt(this_directory + '../input_files/EX_06_Source_TOF_P.csv', delimiter=',') time_array = momentum_program[:, 0]*1e-3 # [s] momentum = momentum_program[:, 1]*1e9 # [eV/c] particle_type = Proton() ring_opt = RingOptions(interpolation='linear', plot=True, figdir=this_directory + '../output_files/EX_06_fig', t_start=initial_time, t_end=final_time) general_params = Ring(C, alpha, (time_array, momentum), particle_type, RingOptions=ring_opt) # Cavities parameters n_rf_systems = 3 harmonic_numbers_1 = 1 harmonic_numbers_2 = 2 harmonic_numbers_3 = 16 phi_rf_1 = 0 # [rad] phi_rf_2 = np.pi # [rad] phi_rf_3 = np.pi/6 # [rad] voltage_program_C02 = np.loadtxt(