def get_tracker_kwargs(self, magnet_dict=None): tmp_dir = os.path.expanduser(self.TmpDir.text()) assert os.path.isdir(tmp_dir) assert os.access(tmp_dir, os.W_OK) elegant_matrix.set_tmp_dir(tmp_dir) #time_match = re_time.match(self.ImportFileTime.text().strip()) #if time_match is None: # raise ValueError('Wrong format of ImportFileTime: %s\nMust be: yyyy-MM-dd:hh-mm-ss' % self.ImportFileTime.text()) timestamp = None struct_lengths = [ float(self.StructLength1.text()), float(self.StructLength1.text()) ] n_particles = int(float(self.N_Particles.text())) n_emittances = [ float(self.TransEmittanceX.text()) * 1e-9, float(self.TransEmittanceY.text()) * 1e-9 ] screen_bins = int(self.ScreenBins.text()) screen_cutoff = float(self.ScreenCutoff.text()) smoothen = float(self.ScreenSmoothen.text()) * 1e-6 profile_cutoff = float(self.ProfileCutoff.text()) len_screen = int(self.ScreenLength.text()) quad_wake = self.UseQuadCheck.isChecked() bp_smoothen = float(self.ProfileSmoothen.text()) * 1e-15 override_quad_beamsize = self.OverrideQuadCheck.isChecked() quad_x_beamsize = [ float(self.QuadBeamsize1.text()) * 1e-6, float(self.QuadBeamsize2.text()) * 1e-6 ] tracker_kwargs = { 'magnet_file': magnet_dict, 'timestamp': timestamp, 'struct_lengths': struct_lengths, 'n_particles': n_particles, 'n_emittances': n_emittances, 'screen_bins': screen_bins, 'screen_cutoff': screen_cutoff, 'smoothen': smoothen, 'profile_cutoff': profile_cutoff, 'len_screen': len_screen, 'quad_wake': quad_wake, 'bp_smoothen': bp_smoothen, 'override_quad_beamsize': override_quad_beamsize, 'quad_x_beamsize': quad_x_beamsize, } return tracker_kwargs
import numpy as np np import matplotlib.pyplot as plt import elegant_matrix import tracking import gaussfit import misc from h5_storage import loadH5Recursive import myplotstyle as ms plt.close('all') hostname = socket.gethostname() elegant_matrix.set_tmp_dir('/home/philipp/tmp_elegant/') tt_halfrange = 200e-15 charge = -200e-12 screen_cutoff = 2e-3 profile_cutoff = 2e-2 len_profile = int(2e3) struct_lengths = [1., 1.] screen_bins = 400 smoothen = 30e-6 n_emittances = [900e-9, 500e-9] n_particles = int(100e3) n_streaker = 1 self_consistent = True quad_wake = True bp_smoothen = 1e-15
from collections import OrderedDict import numpy as np import pickle import matplotlib.pyplot as plt from h5_storage import loadH5Recursive import image_and_profile as iap import tracking import elegant_matrix import misc2 as misc import myplotstyle as ms plt.close('all') elegant_matrix.set_tmp_dir('~/tmp_elegant/') #data_dir = '/mnt/data/data_2021-03-16/' data_dir = '/sf/data/measurements/2021/03/16/' x0 = 0.0005552048387736093 profile_file = './backtrack_image_no_compensate.pkl' with open(profile_file, 'rb') as f: wake_dict = pickle.load(f) xx = wake_dict['xx'] lasing_on_file = data_dir+'20210316_202944_SARBD02-DSCR050_camera_snapshot.h5' lasing_off_file = data_dir+'20210316_204139_SARBD02-DSCR050_camera_snapshot.h5' lasing_on = loadH5Recursive(lasing_on_file)