Exemplo n.º 1
0
    def _generate_UBList(self):
        CreateSingleValuedWorkspace(OutputWorkspace='__ub')
        LoadIsawUB('__ub', self.getProperty("UBMatrix").value)
        ub = mtd['__ub'].sample().getOrientedLattice().getUB().copy()
        DeleteWorkspace(Workspace='__ub')

        symOps = self.getProperty("SymmetryOps").value
        if symOps:
            try:
                symOps = SpaceGroupFactory.subscribedSpaceGroupSymbols(
                    int(symOps))[0]
            except ValueError:
                pass
            if SpaceGroupFactory.isSubscribedSymbol(symOps):
                symOps = SpaceGroupFactory.createSpaceGroup(
                    symOps).getSymmetryOperations()
            else:
                symOps = SymmetryOperationFactory.createSymOps(symOps)
            logger.information('Using symmetries: ' +
                               str([sym.getIdentifier() for sym in symOps]))

            ub_list = []
            for sym in symOps:
                UBtrans = np.zeros((3, 3))
                UBtrans[0] = sym.transformHKL([1, 0, 0])
                UBtrans[1] = sym.transformHKL([0, 1, 0])
                UBtrans[2] = sym.transformHKL([0, 0, 1])
                UBtrans = np.matrix(UBtrans.T)
                ub_list.append(ub * UBtrans)
            return ub_list
        else:
            return [ub]
    def _generate_UBList(self):
        CreateSingleValuedWorkspace(OutputWorkspace='__ub')
        LoadIsawUB('__ub',self.getProperty("UBMatrix").value)
        ub=mtd['__ub'].sample().getOrientedLattice().getUB().copy()
        DeleteWorkspace(Workspace='__ub')

        symOps = self.getProperty("SymmetryOps").value
        if symOps:
            try:
                symOps = SpaceGroupFactory.subscribedSpaceGroupSymbols(int(symOps))[0]
            except ValueError:
                pass
            if SpaceGroupFactory.isSubscribedSymbol(symOps):
                symOps = SpaceGroupFactory.createSpaceGroup(symOps).getSymmetryOperations()
            else:
                symOps = SymmetryOperationFactory.createSymOps(symOps)
            logger.information('Using symmetries: '+str([sym.getIdentifier() for sym in symOps]))

            ub_list=[]
            for sym in symOps:
                UBtrans = np.zeros((3,3))
                UBtrans[0] = sym.transformHKL([1,0,0])
                UBtrans[1] = sym.transformHKL([0,1,0])
                UBtrans[2] = sym.transformHKL([0,0,1])
                UBtrans=np.matrix(UBtrans.T)
                ub_list.append(ub*UBtrans)
            return ub_list
        else:
            return [ub]
Exemplo n.º 3
0
from mantid.geometry import SymmetryOperationFactory
import numpy as np

# Get UBs
LoadEmptyInstrument(
    Filename=
    '/SNS/CORELLI/shared/Calibration/CORELLI_Definition_cal_20160310.xml',
    OutputWorkspace='ub')
LoadIsawUB(InputWorkspace='ub',
           Filename="/SNS/users/rwp/benzil/benzil_Hexagonal.mat")
ub = mtd['ub'].sample().getOrientedLattice().getUB()
print "Starting UB :"
print ub

symOps = SymmetryOperationFactory.createSymOps(
    "x,y,z; -y,x-y,z+1/3; -x+y,-x,z+2/3; y,x,-z; x-y,-y,-z+2/3; -x,-x+y,-z+1/3"
)
ub_list = []
for sym in symOps:
    UBtrans = np.zeros((3, 3))
    UBtrans[0] = sym.transformHKL([1, 0, 0])
    UBtrans[1] = sym.transformHKL([0, 1, 0])
    UBtrans[2] = sym.transformHKL([0, 0, 1])
    UBtrans = np.matrix(UBtrans.T)
    new_ub = ub * UBtrans
    print "Symmetry transform for " + sym.getIdentifier()
    print UBtrans
    print "New UB:"
    print new_ub
    ub_list.append(new_ub)
Exemplo n.º 4
0
    Filename=
    '/SNS/CORELLI/shared/Calibration/CORELLI_Definition_cal_20160310.xml',
    OutputWorkspace='ub')
LoadIsawUB(InputWorkspace='ub', Filename=UBfile)
ub = mtd['ub'].sample().getOrientedLattice().getUB()
print "Starting UB :"
print ub

#DTO   Fd-3m (227)  general position has 192 symmety operations.
symOps = SymmetryOperationFactory.createSymOps(\
     "x,y,z; -x,-y,z; -x,y,-z; x,-y,-z;\
    z,x,y; z,-x,-y; -z,-x,y; -z,x,-y;\
    y,z,x; -y,z,-x; y,-z,-x; -y,-z,x;\
    y,x,-z; -y,-x,-z; y,-x,z; -y,x,z;\
    x,z,-y; -x,z,y; -x,-z,-y; x,-z,y;\
    z,y,-x; z,-y,x; -z,y,x; -z,-y,-x;\
    -x,-y,-z; x,y,-z; x,-y,z; -x,y,z;\
    -z,-x,-y; -z,x,y; z,x,-y; z,-x,y;\
    -y,-z,-x; y,-z,x; -y,z,x; y,z,-x;\
    -y,-x,z; y,x,z; -y,x,-z; y,-x,-z;\
    -x,-z,y; x,-z,-y; x,z,y; -x,z,-y;\
    -z,-y,x; -z,y,-x; z,-y,-x; z,y,x"                                     )

ub_list = []
for sym in symOps:
    UBtrans = np.zeros((3, 3))
    UBtrans[0] = sym.transformHKL([1, 0, 0])
    UBtrans[1] = sym.transformHKL([0, 1, 0])
    UBtrans[2] = sym.transformHKL([0, 0, 1])
    UBtrans = np.matrix(UBtrans.T)
    new_ub = ub * UBtrans
from mantid.simpleapi import *
from mantid.geometry import SymmetryOperationFactory
import numpy as np

# Get UBs
LoadEmptyInstrument(Filename='/SNS/CORELLI/shared/Calibration/CORELLI_Definition_cal_20160310.xml', OutputWorkspace='ub')
LoadIsawUB(InputWorkspace='ub', Filename="/SNS/users/rwp/benzil/benzil_Hexagonal.mat")
ub=mtd['ub'].sample().getOrientedLattice().getUB()
print "Starting UB :"
print ub

symOps = SymmetryOperationFactory.createSymOps("x,y,z; -y,x-y,z+1/3; -x+y,-x,z+2/3; y,x,-z; x-y,-y,-z+2/3; -x,-x+y,-z+1/3")
ub_list=[]
for sym in symOps:
    UBtrans = np.zeros((3,3))
    UBtrans[0] = sym.transformHKL([1,0,0])
    UBtrans[1] = sym.transformHKL([0,1,0])
    UBtrans[2] = sym.transformHKL([0,0,1])
    UBtrans=np.matrix(UBtrans.T)
    new_ub = ub*UBtrans
    print "Symmetry transform for "+sym.getIdentifier()
    print UBtrans
    print "New UB:"
    print new_ub
    ub_list.append(new_ub)

outputdir="/SNS/CORELLI/IPTS-15526/shared/"
LoadNexus(Filename='/SNS/CORELLI/shared/Vanadium/2016B/SolidAngle20160720NoCC.nxs', OutputWorkspace='sa')
LoadNexus(Filename='/SNS/CORELLI/shared/Vanadium/2016B/Spectrum20160720NoCC.nxs', OutputWorkspace='flux')

#MaskBTP(workspace='sa',Pixel='1-16,241-256')
Exemplo n.º 6
0
#for op in symOps:
#        print op.getIdentifier()

#  three different symmetry operation expressions
#symOps='206'
#symOps='x,y,z; -y,x-y,z+1/3; -x+y,-x,z+2/3; y,x,-z; x-y,-y,-z+2/3; -x,-x+y,-z+1/3'
symOps = 'I a -3'

try:
    symOps = SpaceGroupFactory.subscribedSpaceGroupSymbols(int(symOps))[0]
except ValueError:
    pass
if SpaceGroupFactory.isSubscribedSymbol(symOps):
    symOps = SpaceGroupFactory.createSpaceGroup(symOps).getSymmetryOperations()
else:
    symOps = SymmetryOperationFactory.createSymOps(symOps)

#print "Number of operations:", len(symOps)
#print "Operations:"
#for op in symOps:
#    print op.getIdentifier()

totcoordinate = []
coordinates = [0, 0, 0]
for op in symOps:
    coordinatesPrime = op.transformCoordinates(coordinates)
    print('{:<20s},{:10s}').format(op.getIdentifier(), coordinatesPrime)
    if coordinatesPrime not in totcoordinate:
        totcoordinate.append(coordinatesPrime)

unique_coordinate = np.unique(totcoordinate, axis=0)
Exemplo n.º 7
0
LoadNexus(Filename='/SNS/CORELLI/shared/Vanadium/SolidAngle20161123_cc.nxs',
          OutputWorkspace='sa')

# Get UBs
LoadEmptyInstrument(
    Filename=
    '/SNS/CORELLI/shared/Calibration/CORELLI_Definition_cal_20160310.xml',
    OutputWorkspace='ub')
LoadIsawUB(InputWorkspace='ub', Filename=outputdir + UBname)
ub = mtd['ub'].sample().getOrientedLattice().getUB()
print "Starting UB :"
print ub

#symOps = SymmetryOperationFactory.createSymOps(" x, y, z;  -x ,-y, z;  -x,y,-z;  x,-y,-z;-x,-y,-z;  x,y,-z; x,-y,z; -x,y,z")
#symOps = SymmetryOperationFactory.createSymOps("x, y, z;x,-y,-z; x,y,-z; x,-y,z")
symOps = SymmetryOperationFactory.createSymOps("x, y, z")  #;-x,-y,-z")
ub_list = []
for sym in symOps:
    UBtrans = np.zeros((3, 3))
    UBtrans[0] = sym.transformHKL([1, 0, 0])
    UBtrans[1] = sym.transformHKL([0, 1, 0])
    UBtrans[2] = sym.transformHKL([0, 0, 1])
    UBtrans = np.matrix(UBtrans.T)
    new_ub = ub * UBtrans
    print "Symmetry transform for " + sym.getIdentifier()
    print UBtrans
    print "New UB:"
    print new_ub
    ub_list.append(new_ub)

if mtd.doesExist('normMD'):