def reconstruct_all_lasing(self): self.clear_all_lasing_plots() screen_x0 = self.screen_x0 beamline, n_streaker = self.beamline, self.n_streaker charge = self.charge streaker_offset = self.streaker_means[n_streaker] delta_gap = self.delta_gaps[n_streaker] pulse_energy = float(self.LasingEnergyInput.text()) * 1e-6 slice_factor = int(self.LasingReconstructionSliceFactor.text()) file_on = self.LasingOnDataLoad.text() file_off = self.LasingOffDataLoad.text() lasing_off_dict = h5_storage.loadH5Recursive(file_off) lasing_on_dict = h5_storage.loadH5Recursive(file_on) tracker_kwargs = self.get_tracker_kwargs() recon_kwargs = self.get_gauss_kwargs() las_rec_images = {} for main_ctr, (data_dict, title) in enumerate([(lasing_off_dict, 'Lasing Off'), (lasing_on_dict, 'Lasing On')]): rec_obj = lasing.LasingReconstructionImages( screen_x0, beamline, n_streaker, streaker_offset, delta_gap, tracker_kwargs, recon_kwargs=recon_kwargs, charge=charge, subtract_median=True, slice_factor=slice_factor) rec_obj.add_dict(data_dict) if main_ctr == 1: rec_obj.profile = las_rec_images['Lasing Off'].profile rec_obj.ref_slice_dict = las_rec_images[ 'Lasing Off'].ref_slice_dict rec_obj.process_data() las_rec_images[title] = rec_obj #rec_obj.plot_images('raw', title) #rec_obj.plot_images('tE', title) las_rec = lasing.LasingReconstruction(las_rec_images['Lasing Off'], las_rec_images['Lasing On'], pulse_energy, current_cutoff=1.5e3) las_rec.plot(plot_handles=self.all_lasing_plot_handles) self.all_lasing_canvas.draw()
n_streaker, streaker_offset, delta_gap, tracker_kwargs, recon_kwargs=gauss_kwargs, charge=charge, subtract_median=True) rec_obj.add_dict(data_dict) if main_ctr == 1: rec_obj.profile = las_rec_images['Lasing Off'].profile rec_obj.process_data() las_rec_images[title] = rec_obj #rec_obj.plot_images('raw', title) rec_obj.plot_images('tE', title) ms.saveall('./album063d/%s_imagestE' % os.path.basename(lasing_on_file), empty_suptitle=False) ms.closeall() las_rec = lasing.LasingReconstruction(las_rec_images['Lasing Off'], las_rec_images['Lasing On'], pulse_energy, current_cutoff=1.0e3) las_rec.plot() ms.saveall('./album063d/%s_lasing' % os.path.basename(lasing_on_file), empty_suptitle=False) ms.closeall() ms.show()
# rec_obj.do_recon_plot = True rec_obj.add_dict(data_dict) if main_ctr == 1: rec_obj.profile = las_rec_images['Lasing Off'].profile rec_obj.ref_slice_dict = las_rec_images[ 'Lasing Off'].ref_slice_dict rec_obj.ref_y = np.mean(las_rec_images['Lasing Off'].ref_y_list) rec_obj.process_data() las_rec_images[title] = rec_obj #rec_obj.plot_images('raw', title) #rec_obj.plot_images('tE', title) las_rec = lasing.LasingReconstruction(las_rec_images['Lasing Off'], las_rec_images['Lasing On'], pulse_energy, current_cutoff=curr_lim, norm_factor=norm_factor) las_rec.plot() if ctr == 0: norm_factor = las_rec.norm_factor if ctr == rec_ctr: lasing_off_dict_fb = lasing_off_dict las_rec_fb = las_rec rec_obj_fb = las_rec_images['Lasing Off'] ms.plt.figure(main_fig.number) sp = subplot(sp_ctr, title=main_title, xlabel='t (fs)', ylabel='$\Delta$E (MeV)',
tracker_kwargs, recon_kwargs=recon_kwargs, charge=charge, subtract_median=True) rec_obj.add_dict(data_dict) if main_ctr == 1: rec_obj.profile = las_rec_images['Lasing Off'].profile rec_obj.process_data() las_rec_images[title] = rec_obj rec_obj.plot_images('raw', title) rec_obj.plot_images('tE', title, log=False) las_rec = lasing.LasingReconstruction(las_rec_images['Lasing Off'], las_rec_images['Lasing On'], pulse_energy, current_cutoff=1.5e3, key_mean='slice_mean_rms', key_sigma='slice_rms_sq') las_rec.plot(plot_loss=False) ms.plt.suptitle('RMS') las_rec2 = lasing.LasingReconstruction(las_rec_images['Lasing Off'], las_rec_images['Lasing On'], pulse_energy, current_cutoff=1.5e3, key_mean='slice_mean', key_sigma='slice_sigma_sq') las_rec2.plot(plot_loss=False) ms.plt.suptitle('GF') las_rec2 = lasing.LasingReconstruction(las_rec_images['Lasing Off'],