\(\renewcommand\AA{\unicode{x212B}}\)
LoadIsawUB v1¶
Summary¶
Load an ISAW-style ASCII UB matrix and lattice parameters file, and place its information into a workspace.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
InOut |
Mandatory |
An input workspace to which to add the lattice information. |
|
Filename |
Input |
string |
Mandatory |
Path to an ISAW-style UB matrix text file. Allowed extensions: [‘.mat’, ‘.ub’, ‘.txt’] |
CheckUMatrix |
Input |
boolean |
True |
If True (default) then a check is performed to ensure the U matrix is a proper rotation matrix |
Description¶
Loads the UB matrix into a workspace from an ISAW-style UB matrix ASCII file.
You can use the SaveIsawUB v1 algorithm to save to this format.
The matrix in the file is the transpose of the UB matrix. The UB matrix maps the column vector (h,k,l ) to the column vector (q’x,q’y,q’z). |Q’|=1/dspacing and its coordinates are a right-hand coordinate system where x is the beam direction and z is vertically upward. (IPNS convention)
Note: for an MDEventWorkspace, all experimentInfo objects will contain the oriented lattice loaded from the IsawUB file
Usage¶
#Write a ISAW UB file
import mantid
filename=mantid.config.getString("defaultsave.directory")+"loadIsawUBTest.mat"
f=open(filename,'w')
f.write("0.0 0.5 0.0 \n")
f.write("0.0 0.0 0.25 \n")
f.write("0.2 0.0 0.0 \n")
f.write("2.0 4.0 5.0 90 90 90 40 \n")
f.write("0.0 0.0 0.0 0 0 0 0 \n")
f.write("\n\nsome text about IPNS convention")
f.close()
w=CreateSingleValuedWorkspace()
LoadIsawUB(w,filename)
#check the results
ol=w.sample().getOrientedLattice()
print("a= {}".format(ol.a()))
print("b= {}".format(ol.b()))
print("c= {}".format(ol.c()))
print("alpha= {}".format(ol.alpha()))
print("beta= {}".format(ol.beta()))
print("gamma= {}".format(ol.gamma() ))
print("The following vectors are in the horizontal plane: {} {}".format(ol.getuVector(), ol.getvVector()))
Output:
a= 2.0
b= 4.0
c= 5.0
alpha= 90.0
beta= 90.0
gamma= 90.0
The following vectors are in the horizontal plane: [0,0,5] [2,0,0]
Categories: AlgorithmIndex | Crystal\DataHandling | DataHandling\Isaw | Crystal\UBMatrix
Source¶
C++ header: LoadIsawUB.h
C++ source: LoadIsawUB.cpp