Exemplo n.º 1
0
# end of user parameters #
##########################

#################################################
# Initialize paths, detector, setup and logfile #
#################################################
kwargs = dict()  # create dictionnary
try:
    kwargs['is_series'] = is_series
except NameError:  # is_series not declared
    pass

detector = exp.Detector(name=detector, datadir='', template_imagefile=template_imagefile, binning=pre_binning, **kwargs)

setup = exp.SetupPreprocessing(beamline=beamline, rocking_angle=rocking_angle, distance=sdd, energy=energy,
                               beam_direction=beam_direction, sample_inplane=sample_inplane,
                               sample_outofplane=sample_outofplane,
                               offset_inplane=0)  # no need to worry about offsets, work relatively to the Bragg peak

print('\nScan', scan)
print('Setup: ', setup.beamline)
print('Detector: ', detector.name)
print('Pixel sizes after pre_binning (vertical, horizontal): ', detector.pixelsize_y, detector.pixelsize_x, '(m)')
print('Scan type: ', setup.rocking_angle)
print('Sample to detector distance: ', setup.distance, 'm')
print('Energy:', setup.energy, 'ev')

if simulation:
    detector.datadir = root_folder
    detector.savedir = root_folder
else:
    if setup.beamline != 'P10':
Exemplo n.º 2
0
except NameError:  # nb_pixel_y not declared
    pass
try:
    kwargs['is_series'] = is_series
except NameError:  # is_series not declared
    pass

detector = exp.Detector(name=detector, datadir='', template_imagefile=template_imagefile, roi=roi_detector,
                        binning=binning, **kwargs)

####################
# Initialize setup #
####################
setup = exp.SetupPreprocessing(beamline=beamline, energy=energy, rocking_angle=rocking_angle, distance=sdd,
                               beam_direction=beam_direction, sample_inplane=sample_inplane,
                               sample_outofplane=sample_outofplane, offset_inplane=offset_inplane,
                               custom_scan=custom_scan, custom_images=custom_images, sample_offsets=sample_offsets,
                               custom_monitor=custom_monitor, custom_motors=custom_motors)

#############################################
# Initialize geometry for orthogonalization #
#############################################
if rocking_angle == "energy":
    use_rawdata = False  # you need to interpolate the data in QxQyQz for energy scans
    print("Energy scan: defaulting use_rawdata to False, the data will be interpolated using xrayutilities")
if not use_rawdata:
    qconv, offsets = pru.init_qconversion(setup)
    detector.offsets = offsets
    hxrd = xu.experiment.HXRD(sample_inplane, sample_outofplane, qconv=qconv)  # x downstream, y outboard, z vertical
    # first two arguments in HXRD are the inplane reference direction along the beam and surface normal of the sample
    cch1 = cch1 - detector.roi[0]  # take into account the roi if the image is cropped
Exemplo n.º 3
0
#######################
# Initialize detector #
#######################
detector = exp.Detector(name=detector,
                        datadir='',
                        template_imagefile=template_imagefile,
                        roi=roi_detector)

####################
# Initialize setup #
####################
setup = exp.SetupPreprocessing(beamline=beamline,
                               energy=energy,
                               rocking_angle=rocking_angle,
                               distance=sdd,
                               beam_direction=beam_direction,
                               sample_inplane=sample_inplane,
                               sample_outofplane=sample_outofplane,
                               offset_inplane=offset_inplane)

#############################################
# Initialize geometry for orthogonalization #
#############################################
qconv, offsets = pru.init_qconversion(setup)
detector.offsets = offsets
hxrd = xrayutilities.experiment.HXRD(
    sample_inplane, sample_outofplane,
    qconv=qconv)  # x downstream, y outboard, z vertical
# first two arguments in HXRD are the inplane reference direction along the beam and surface normal of the sample
cch1 = cch1 - detector.roi[
    0]  # take into account the roi if the image is cropped
Exemplo n.º 4
0
plt.ion()
#######################
# Initialize detector #
#######################
detector = exp.Detector(name=detector,
                        datadir='',
                        template_imagefile=template_imagefile,
                        roi=roi_detector)

####################
# Initialize setup #
####################
setup_pre = exp.SetupPreprocessing(beamline=beamline,
                                   rocking_angle=rocking_angle,
                                   distance=sdd,
                                   energy=energy,
                                   beam_direction=beam_direction)

if setup_pre.beamline != 'P10':
    homedir = root_folder + sample_name + str(scan) + '/'
    detector.datadir = homedir + "data/"
else:
    specfile_name = specfile_name % scan
    homedir = root_folder + specfile_name + '/'
    detector.datadir = homedir + 'e4m/'
    template_imagefile = specfile_name + template_imagefile
    detector.template_imagefile = template_imagefile

print('\nScan', scan)
print('Setup: ', setup_pre.beamline)
Exemplo n.º 5
0
detector = exp.Detector(name=detector,
                        datadir='',
                        template_imagefile=template_imagefile,
                        roi=roi_detector)

####################
# Initialize setup #
####################
setup = exp.SetupPreprocessing(beamline=beamline,
                               energy=energy,
                               rocking_angle=rocking_angle,
                               distance=sdd,
                               beam_direction=beam_direction,
                               sample_inplane=sample_inplane,
                               sample_outofplane=sample_outofplane,
                               sample_offsets=(offset_chi, offset_phi,
                                               offset_eta),
                               offset_inplane=offset_inplane,
                               custom_scan=custom_scan,
                               custom_images=custom_images,
                               custom_monitor=custom_monitor,
                               custom_motors=custom_motors,
                               filtered_data=filtered_data,
                               is_orthogonal=is_orthogonal)

#############################################
# Initialize geometry for orthogonalization #
#############################################
qconv, offsets = pru.init_qconversion(setup)
detector.offsets = offsets
hxrd = xu.experiment.HXRD(sample_inplane, sample_outofplane,
                          qconv=qconv)  # x downstream, y outboard, z vertical
Exemplo n.º 6
0
    pass

detector = exp.Detector(name=detector,
                        datadir='',
                        template_imagefile=template_imagefile,
                        roi=roi_detector,
                        sum_roi=normalize_roi,
                        binning=binning,
                        **kwargs)

####################
# Initialize setup #
####################
setup = exp.SetupPreprocessing(beamline=beamline,
                               energy=energy,
                               rocking_angle=rocking_angle,
                               distance=sdd,
                               direct_beam=direct_beam)

############################################
# Initialize values for callback functions #
############################################
flag_mask = False
flag_aliens = False
plt.rcParams["keymap.quit"] = [
    "ctrl+w", "cmd+w"
]  # this one to avoid that q closes window (matplotlib default)

############################
# start looping over scans #
############################
Exemplo n.º 7
0
my_cmap = colormap.cmap
plt.ion()

#################################################
# initialize detector, setup, paths and logfile #
#################################################
kwargs = dict()  # create dictionnary
kwargs['is_series'] = is_series
detector = exp.Detector(name=detector,
                        datadir='',
                        template_imagefile=template_imagefile,
                        sum_roi=sum_roi,
                        binning=[1, binning[0], binning[1]],
                        **kwargs)

setup = exp.SetupPreprocessing(beamline=beamline)

if setup.beamline == 'P10':
    specfile_name = sample_name + '_{:05d}'.format(scan)
    homedir = root_folder + specfile_name + '/'
    detector.datadir = homedir + 'e4m/'
    template_imagefile = specfile_name + template_imagefile
    detector.template_imagefile = template_imagefile
elif setup.beamline == 'SIXS_2018' or setup.beamline == 'SIXS_2019':
    homedir = root_folder
    detector.datadir = homedir + "align/"
else:
    homedir = root_folder + sample_name + str(scan) + '/'
    detector.datadir = homedir + "data/"

if savedir == '':
Exemplo n.º 8
0
bad_color = '1.0'  # white background
colormap = gu.Colormap(bad_color=bad_color)
my_cmap = colormap.cmap
plt.ion()

#################################################
# Initialize detector, setup, paths and logfile #
#################################################
detector = exp.Detector(name=detector,
                        datadir='',
                        template_imagefile=template_imagefile,
                        is_series=is_series)

setup = exp.SetupPreprocessing(beamline=beamline,
                               rocking_angle=rocking_angle,
                               custom_scan=custom_scan,
                               custom_images=custom_images,
                               custom_monitor=custom_monitor,
                               custom_motors=custom_motors)

if setup.beamline == 'P10':
    specfile_name = specfile_name % scan
    homedir = root_folder + specfile_name + '/'
    detector.datadir = homedir + 'e4m/'
    template_imagefile = specfile_name + template_imagefile
    detector.template_imagefile = template_imagefile
elif setup.beamline == 'SIXS_2018' or setup.beamline == 'SIXS_2019':
    homedir = root_folder
    detector.datadir = homedir + "align/"
else:
    homedir = root_folder + sample_name + str(scan) + '/'
    detector.datadir = homedir + "data/"
Exemplo n.º 9
0
# Initialize detector #
#######################
detector = exp.Detector(name=detector,
                        datadir='',
                        template_imagefile=template_imagefile,
                        roi=roi_detector,
                        is_series=is_series)

####################
# Initialize setup #
####################
setup_pre = exp.SetupPreprocessing(beamline=beamline,
                                   rocking_angle=rocking_angle,
                                   distance=sdd,
                                   energy=energy,
                                   beam_direction=beam_direction,
                                   custom_scan=custom_scan,
                                   custom_images=custom_images,
                                   custom_monitor=custom_monitor,
                                   custom_motors=custom_motors)

if setup_pre.beamline != 'P10':
    homedir = root_folder + sample_name + str(scan) + '/'
    detector.datadir = homedir + "data/"
else:
    specfile_name = specfile_name % scan
    homedir = root_folder + specfile_name + '/'
    detector.datadir = homedir + 'e4m/'
    template_imagefile = specfile_name + template_imagefile
    detector.template_imagefile = template_imagefile