@@ -762,10 +762,16 @@ def fit_and_plot_transverse_profiles(self,
762762
763763 ### Convert beam sizes to emittances if saved particles, otherwise take numerical object ###
764764 try :
765- part = tbt_dict ['particles_i' ]
766- gamma = part ['gamma0' ][0 ]
767- beta_rel = part ['beta0' ][0 ]
768-
765+ try :
766+ part = tbt_dict ['particles_i' ]
767+ gamma = part ['gamma0' ][0 ]
768+ beta_rel = part ['beta0' ][0 ]
769+ except KeyError :
770+ print ('\n Could not load particle dictionary, extracting info from default Pb line:' )
771+ # For now, load fixed values directly
772+ gamma = 7.315750557500678
773+ beta_rel = np .sqrt (1 - 1 / gamma ** 2 ) # value for Pb
774+
769775 # Fit q-Gaussian to final X and Y profiles, to latest curves - initial guess from Gaussian
770776 q0 = 1.02
771777 p0_qX = [popt_X [1 ], q0 , 1 / popt_X [2 ]** 2 / (5 - 3 * q0 ), 2 * popt_X [0 ]]
@@ -978,7 +984,9 @@ def fit_transverse_profile_evolution(self, profile_step=100, output_folder_name=
978984
979985 index_to_plot = np .arange (0 , len (tbt_dict ['monitorH_x_intensity' ])+ 1 , profile_step )
980986 index_to_plot [- 1 ] -= 1 # correct counting index
981- turns_to_plot = 100 * index_to_plot # 100 tursn for each index
987+ turns_to_plot = 100 * index_to_plot # 100 turns for each WS measurement index
988+ seconds_to_plot = tbt_dict ['Seconds' ][turns_to_plot ]
989+
982990 # Create empty arrays
983991 n_profiles = len (index_to_plot )
984992 Nb = np .zeros (n_profiles )
@@ -1108,7 +1116,7 @@ def fit_transverse_profile_evolution(self, profile_step=100, output_folder_name=
11081116 fig1 .savefig ('{}/0001_q_value_evolution_qGaussian_fits.png' .format (output_folder_name ), dpi = 250 )
11091117 plt .close ()
11101118
1111- return turns_to_plot , exn , eyn , Nb
1119+ return turns_to_plot , seconds_to_plot , exn , eyn , Nb , q_vals_X , q_vals_Y
11121120
11131121
11141122 def plot_multiple_sets_of_tracking_data (self ,
0 commit comments