def Find_UB_FFT(rnum, MinD, MaxD, Tolerance, Centering, CellType):
    mantid.FindUBUsingFFT(PeaksWorkspace='WISH000' + str(rnum) + '_find_peaks', MinD=MinD, MaxD=MaxD,
                          Tolerance=Tolerance)
    mantid.SelectCellOfType(PeaksWorkspace='WISH000' + str(rnum) + '_find_peaks', Centering=Centering, Apply=True,
                            CellType=CellType)
    # OptimizeCrystalPlacement(PeaksWorkspace='WISH000'+str(rnum)+'_find_peaks', ModifiedPeaksWorkspace='WISH000'
    # +str(rnum)+'_find_peaks', AdjustSampleOffsets=True)
    mantid.OptimizeLatticeForCellType(PeaMinWavelengthksWorkspace='WISH000' + str(rnum) + '_find_peaks', Apply=True,
                                      CellType=CellType, Tolerance=Tolerance)
# Save for SHELX
mantid.SaveHKL(InputWorkspace=PeaksLattice, Filename=ws_name + '.hkl')

# ------------------------------------------------------------------------------------------------------------------------------------------
# Part 2. Alternative/Advanced Processing Steps

# Find peaks again for FFT
PeaksLatticeFFT = mantid.FindPeaksMD(InputWorkspace=LabQ, MaxPeaks=100)

# 3d integration to centroid peaks
PeaksLatticeFFT = mantid.CentroidPeaksMD(InputWorkspace=LabQ,
                                         PeakRadius=0.12,
                                         PeaksWorkspace=PeaksLatticeFFT)

# Find the UB matrix using FFT
mantid.FindUBUsingFFT(PeaksWorkspace=PeaksLatticeFFT, MinD=3.0, MaxD=14.0)

# And index to HKL
mantid.IndexPeaks(PeaksWorkspace=PeaksLatticeFFT, Tolerance=0.12)

# Integrate peaks in Q space using spheres
PeaksLatticeFFT = mantid.IntegratePeaksMD(InputWorkspace=LabQ,
                                          PeakRadius=0.12,
                                          BackgroundOuterRadius=0.18,
                                          BackgroundInnerRadius=0.15,
                                          PeaksWorkspace=PeaksLatticeFFT)

# Save for SHELX
mantid.SaveHKL(InputWorkspace=PeaksLatticeFFT, Filename=ws_name + '.hkl')

# ------------------------------------------------------------------------------------------------------------------------------------------
Exemple #3
0
#  Fewer peaks index if Centroiding is used.  This indicates that there may be an error in the centroiding algorithm,
#  since the peaks seem to be less accurate.
#
# peaks_qLab = CentroidPeaksMD(InputWorkspace='QLab',PeaksWorkspace=peaks_qLab)

use_fft = True
use_cubic_lat_par = False
use_Niggli_lat_par = False

#
# Note: Reduced tolerance on  FindUBUsingFFT will omit peaks not near the lattice.  This seems to help
# find the Niggli cell correctly, with all angle 60 degrees, and all sides 3.99
#
if use_fft:
    mantid.FindUBUsingFFT(PeaksWorkspace=peaks_qLab,
                          MinD='3',
                          MaxD='5',
                          Tolerance=0.08)
    print('\nNiggli cell found from FindUBUsingFFT:')

if use_cubic_lat_par:
    mantid.FindUBUsingLatticeParameters(PeaksWorkspace=peaks_qLab,
                                        a=5.6402,
                                        b=5.6402,
                                        c=5.6402,
                                        alpha=90,
                                        beta=90,
                                        gamma=90,
                                        NumInitial=25,
                                        Tolerance=0.12)
    print('\nCubic cell found directly from FindUBUsingLatticeParameters')