# DEFINE SLICES --------------------------------------------------------------- number_slices = 3000 slice_beam = Profile(beam, CutOptions(cut_left=0, cut_right=21*bucket_length, n_slices=number_slices)) # LOAD IMPEDANCE TABLES ------------------------------------------------------- R_S = 5e8 frequency_R = 2*RF_sct_par.omega_rf[0,0] / 2.0 / np.pi Q = 10000 print('Im Z/n = '+str(R_S / (RF_sct_par.t_rev[0] * frequency_R * Q))) resonator = Resonators(R_S, frequency_R, Q) # INDUCED VOLTAGE FROM IMPEDANCE ---------------------------------------------- imp_list = [resonator] ind_volt_freq = InducedVoltageFreq(beam, slice_beam, imp_list, frequency_resolution=5e4) total_ind_volt = TotalInducedVoltage(beam, slice_beam, [ind_volt_freq]) # BEAM GENERATION ------------------------------------------------------------- n_bunches = 3 bunch_spacing_buckets = 10
ring_RF_section_res, my_beam_res, this_directory + '../output_files/EX_05_output_data_res', Profile=slice_beam_res, buffer_time=1) # LOAD IMPEDANCE TABLE-------------------------------------------------------- table = np.loadtxt(this_directory + '../input_files/EX_05_new_HQ_table.dat', comments='!') R_shunt = table[:, 2] * 10**6 f_res = table[:, 0] * 10**9 Q_factor = table[:, 1] resonator = Resonators(R_shunt, f_res, Q_factor) ind_volt_time = InducedVoltageTime(my_beam, slice_beam, [resonator]) ind_volt_freq = InducedVoltageFreq(my_beam_freq, slice_beam_freq, [resonator], 1e5) ind_volt_res = InducedVoltageResonator(my_beam_res, slice_beam_res, resonator) tot_vol = TotalInducedVoltage(my_beam, slice_beam, [ind_volt_time]) tot_vol_freq = TotalInducedVoltage(my_beam_freq, slice_beam_freq, [ind_volt_freq]) tot_vol_res = TotalInducedVoltage(my_beam_res, slice_beam_res, [ind_volt_res]) # Analytic result----------------------------------------------------------- VindGauss = np.zeros(len(slice_beam.bin_centers)) for r in range(len(Q_factor)): # Notice that the time-argument of inducedVoltageGauss is shifted by
def test_wrongMethodError(self): with self.assertRaises(RuntimeError): Resonators(1, 2, 3, method='something')
def setUp(self): # Nyquist frequency 1.6 GHz; frequency spacing 50 MHz self.profile = Profile(None, CutOptions=CutOptions(cut_left=0, cut_right=5e-9, n_slices=16)) self.impedance_source = Resonators([4.5e6], [200.222e6], [200])
def test_smallQError(self): with self.assertRaises(RuntimeError): Resonators(1, 2, 0.2)