data_dir = '/mnt/data/data_2021-05-18/'

data_dir2 = data_dir.replace('18', '19')

all_streaker_calib = [
        #(data_dir+'2021_05_18-17_08_40_Calibration_data_SARUN18-UDCP020.h5',),
        #'2021_05_18-21_58_48_Calibration_data_SARUN18-UDCP020.h5', Bad saved data
        (data_dir+'2021_05_18-22_11_36_Calibration_SARUN18-UDCP020.h5',),
        #(data_dir+'2021_05_18-23_07_20_Calibration_SARUN18-UDCP020.h5', data_dir+'2021_05_18-23_32_12_Calibration_SARUN18-UDCP020.h5'), # Affected but ok
        #'2021_05_19-00_13_25_Calibration_SARUN18-UDCP020.h5', # Bad data
        #'2021_05_19-00_24_47_Calibration_SARUN18-UDCP020.h5', # Bad data maybe
        #(data_dir2+'2021_05_19-14_14_22_Calibration_SARUN18-UDCP020.h5', data_dir2+'2021_05_19-14_24_05_Calibration_SARUN18-UDCP020.h5',),
        ]

blmeas_file = data_dir+'119325494_bunch_length_meas.h5'
tracker_kwargs = config.get_default_tracker_settings()
gauss_kwargs = config.get_default_gauss_recon_settings()
tracker = tracking.Tracker(**tracker_kwargs)

for streaker_calib_files in all_streaker_calib:
    sc = streaker_calibration.StreakerCalibration('Aramis', 1, 10e-3)
    for scf in streaker_calib_files:
        sc.add_file(scf)
    sc.fit()
    sc.forward_propagate(blmeas_file, gauss_kwargs['tt_halfrange'], 200e-12, tracker, blmeas_cutoff=5e-2)
    sc.plot_streaker_calib()
    ms.plt.suptitle(scf)

ms.show()

示例#2
0
gauss_kwargs = config.get_default_gauss_recon_settings()
tt_halfrange = gauss_kwargs['tt_halfrange']
tracker = tracking.Tracker(**tracker_kwargs)
n_streaker = 1
#offset_index = -1

#streaker_calib_files = (data_dir2+'2021_05_19-14_14_22_Calibration_SARUN18-UDCP020.h5', data_dir2+'2021_05_19-14_24_05_Calibration_SARUN18-UDCP020.h5',)
#streaker_calib_files = (data_dir+'2021_05_18-23_07_20_Calibration_SARUN18-UDCP020.h5', data_dir+'2021_05_18-23_32_12_Calibration_SARUN18-UDCP020.h5')
#streaker_calib_files = (data_dir+'2021_05_18-22_11_36_Calibration_SARUN18-UDCP020.h5',)

streaker_calib_files = all_streaker_calib[file_index]

sc = streaker_calibration.StreakerCalibration(
    'Aramis',
    n_streaker,
    10e-3,
    fit_gap=False,
    fit_order=False,
    proj_cutoff=tracker.screen_cutoff)
for scf in streaker_calib_files:
    sc.add_file(scf)

streaker = config.streaker_names[sc.beamline][sc.n_streaker]
self = sc

gap_arr = np.arange(9.87, 10.05001, 0.01) * 1e-3
tracker.set_simulator(self.meta_data)
gauss_kwargs['n_streaker'] = self.n_streaker
gauss_kwargs['method'] = method

ms.figure('Gap reconstruction with current reconstruction', figsize=(20, 16))
hostname = gethostname()
if hostname == 'desktop':
    data_dir = '/storage/data_2021-06-19/'
elif hostname == 'pc11292.psi.ch':
    data_dir = '/sf/data/measurements/2021/06/19/'
elif hostname == 'pubuntu':
    data_dir = '/mnt/data/data_2021-06-19/'


data_files = [
        (data_dir+ '2021_06_19-17_30_57_Calibration_SARUN18-UDCP020.h5', data_dir + '2021_06_19-17_50_16_Calibration_SARUN18-UDCP020.h5'),
        ]


for files in data_files:
    calibrator = sc = streaker_calibration.StreakerCalibration('Aramis', 1, 10e-3, fit_gap=True, fit_order=False)
    for _file in files:
        calibrator.add_file(_file)

    calibrator.fit()
    streaker_center = calibrator.fit_dicts_gap_order['centroid'][sc.fit_gap][sc.fit_order]['streaker_offset']
    gap_arr = np.array([10e-3-150e-6, 10e-3+50e-6])
    tracker_kwargs = config.get_default_tracker_settings()
    gauss_kwargs = config.get_default_gauss_recon_settings()
    gauss_kwargs['sig_t_range'] = np.arange(5, 65.01, 5)*1e-15
    tracker = tracking.Tracker(**tracker_kwargs)
    meta_data = calibrator.meta_data
    tracker.set_simulator(meta_data)

    gap_recon_dict = calibrator.gap_reconstruction2(gap_arr, tracker, gauss_kwargs, streaker_center)