Exemple #1
0
###################
# define colormap #
###################
bad_color = '1.0'  # white background
colormap = gu.Colormap(bad_color=bad_color)
my_cmap = colormap.cmap
plt.ion()

######################
# create the lattice #
######################
pivot, _, q_values, lattice, peaks = simu.lattice(
    energy=energy,
    sdd=sdd,
    direct_beam=direct_beam,
    detector=detector,
    unitcell=unitcell,
    unitcell_param=unitcell_param,
    euler_angles=angles,
    offset_indices=False)
# peaks in the format [[h, l, k], ...]: CXI convention downstream , vertical up, outboard
for idx in range(len(peaks)):
    print('Miller indices:', peaks[idx], '    at pixels:', lattice[idx])

##############################################
# convolute the lattice with a 3D peak shape #
##############################################
# since we have a small list of peaks, do not use convolution (too slow) but for loop
peak_shape = pu.gaussian_kernel(ndim=3,
                                kernel_length=kernel_length,
                                sigma=3,
Exemple #2
0
##########################
# apply photon threshold #
##########################
data[data < photon_threshold] = 0
print('Sparsity of the data after photon threshold:',
      str('{:.2f}'.format((data == 0).sum() / (nz * ny * nx) * 100)), '%')

######################
# calculate q values #
######################
if unitcell == 'bct':
    pivot, _, q_values, _, _ = simu.lattice(
        energy=energy,
        sdd=sdd,
        direct_beam=direct_beam,
        detector=detector,
        unitcell=unitcell,
        unitcell_param=[unitcell_ranges[0], unitcell_ranges[2]],
        euler_angles=[0, 0, 0],
        offset_indices=True)
else:
    pivot, _, q_values, _, _ = simu.lattice(energy=energy,
                                            sdd=sdd,
                                            direct_beam=direct_beam,
                                            detector=detector,
                                            unitcell=unitcell,
                                            unitcell_param=unitcell_ranges[0],
                                            euler_angles=[0, 0, 0],
                                            offset_indices=True)

nbz, nby, nbx = len(q_values[0]), len(q_values[1]), len(q_values[2])