Exemplo n.º 1
0
    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()
Exemplo n.º 2
0
    lasing_on_file = data_dir1 + os.path.basename(lasing_on_file)
    lasing_off_file = data_dir1 + os.path.basename(lasing_off_file)
    lasing_off_dict = h5_storage.loadH5Recursive(lasing_off_file)
    lasing_on_dict = h5_storage.loadH5Recursive(lasing_on_file)

    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(n_slices,
                                                    screen_x0,
                                                    beamline,
                                                    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)