$$\renewcommand\AA{\unicode{x212B}}$$

# FindUBUsingIndexedPeaks v1¶

## Summary¶

Calculate the UB matrix from a peaks workspace, containing indexed peaks.

## Properties¶

Name

Direction

Type

Default

Description

PeaksWorkspace

InOut

IPeaksWorkspace

Mandatory

Input Peaks Workspace

Tolerance

Input

number

0.1

Indexing Tolerance (0.1)

ToleranceForSatellite

Input

number

0.1

Indexing Tolerance for satellite (0.1)

CommonUBForAll

Input

boolean

False

Used when evaluating the uncertainty of modHKL

## Description¶

Given a set of peaks at least three of which have been assigned Miller indices, this algorithm will find the UB matrix, that best maps the integer (h,k,l) values to the corresponding Q vectors. The set of indexed peaks must include three linearly independent Q vectors. The (h,k,l) values from the peaks are first rounded to form integer (h,k,l) values. The algorithm then forms a possibly over-determined linear system of equations representing the mapping from (h,k,l) to Q for each indexed peak. The system of linear equations is then solved in the least squares sense, using QR factorization.

The option CommonUBForAll only effects the calculation of the uncertainty in the modulation UB. If True the UB will be optimized separately for each subset of runs before calculating the error.

## Usage¶

Example:

ws=LoadIsawPeaks("TOPAZ_3007.peaks")
print("After LoadIsawPeaks does the workspace have an orientedLattice: %s" % ws.sample().hasOrientedLattice())

FindUBUsingIndexedPeaks(ws)
print("After FindUBUsingIndexedPeaks does the workspace have an orientedLattice: %s" % ws.sample().hasOrientedLattice())

print(ws.sample().getOrientedLattice().getUB())


Output:

After LoadIsawPeaks does the workspace have an orientedLattice: False
After FindUBUsingIndexedPeaks does the workspace have an orientedLattice: True
[[-0.04542062  0.04061954 -0.01223576]
[ 0.00140377 -0.00318446  0.11654506]
[ 0.05749773  0.03223779  0.02737294]]


Categories: AlgorithmIndex | Crystal\UBMatrix