Exemplo n.º 1
0
            q_values = []  # cannot orthogonalize since we do not know the original array size
        center_fft = 'skip'  # we assume that crop/pad/centering was already performed
        frames_logical = np.ones(data.shape[0])  # we assume that all frames will be used
        fix_size = []  # we assume that crop/pad/centering was already performed
        normalize_flux = False  # we assume that normalization was already performed
        monitor = []  # we assume that normalization was already performed

        np.savez_compressed(savedir + 'S' + str(scans[scan_nb]) + '_pynx_previous' + comment, data=data)
        np.savez_compressed(savedir + 'S' + str(scans[scan_nb]) + '_maskpynx_previous', mask=mask)

    else:  # new masking process

        flatfield = pru.load_flatfield(flatfield_file)
        hotpix_array = pru.load_hotpixels(hotpixels_file)

        logfile = pru.create_logfile(setup=setup, detector=detector, scan_number=scans[scan_nb],
                                     root_folder=root_folder, filename=specfile)

        if use_rawdata:
            q_values, data, _, mask, _, frames_logical, monitor = \
                pru.gridmap(logfile=logfile, scan_number=scans[scan_nb], detector=detector, setup=setup,
                            flatfield=flatfield, hotpixels=hotpix_array, hxrd=None, follow_bragg=follow_bragg,
                            normalize=normalize_flux, debugging=debug, orthogonalize=False)
        else:
            q_values, rawdata, data, _, mask, frames_logical, monitor = \
                pru.gridmap(logfile=logfile, scan_number=scans[scan_nb], detector=detector, setup=setup,
                            flatfield=flatfield, hotpixels=hotpix_array, hxrd=hxrd, follow_bragg=follow_bragg,
                            normalize=normalize_flux, debugging=debug, orthogonalize=True)

            np.savez_compressed(savedir+'S'+str(scans[scan_nb])+'_data_before_masking_stack', data=rawdata)
            if save_to_mat:
                # save to .mat, the new order is x y z (outboard, vertical up, downstream)
Exemplo n.º 2
0
print('\nScan', scan)
print('Setup: ', setup_pre.beamline)
print('Detector: ', detector.name)
print('Pixel Size: ', detector.pixelsize, 'm')
print('Scan type: ', setup_pre.rocking_angle)
print('Sample to detector distance: ', setup_pre.distance, 'm')
print('Energy:', setup_pre.energy, 'ev')
##############
# load files #
##############
flatfield = pru.load_flatfield(flatfield_file)
hotpix_array = pru.load_hotpixels(hotpixels_file)

logfile = pru.create_logfile(beamline=setup_pre.beamline,
                             detector=detector,
                             scan_number=scan,
                             root_folder=root_folder,
                             filename=specfile_name)

if filtered_data == 0:
    _, data, _, mask, _, frames_logical, monitor = \
        pru.gridmap(logfile=logfile, scan_number=scan, detector=detector, setup=setup_pre,
                    flatfield=flatfield, hotpixels=hotpix_array, hxrd=None, follow_bragg=False,
                    debugging=False, orthogonalize=False)
else:
    root = tk.Tk()
    root.withdraw()
    file_path = filedialog.askopenfilename(initialdir=homedir + "pynxraw/",
                                           title="Select 3D data",
                                           filetypes=[("NPZ", "*.npz")])
    data = np.load(file_path)['data']