本文整理汇总了Python中mantid.geometry.SpaceGroupFactory.subscribedSpaceGroupSymbols方法的典型用法代码示例。如果您正苦于以下问题:Python SpaceGroupFactory.subscribedSpaceGroupSymbols方法的具体用法?Python SpaceGroupFactory.subscribedSpaceGroupSymbols怎么用?Python SpaceGroupFactory.subscribedSpaceGroupSymbols使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mantid.geometry.SpaceGroupFactory
的用法示例。
在下文中一共展示了SpaceGroupFactory.subscribedSpaceGroupSymbols方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _generate_UBList
# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import subscribedSpaceGroupSymbols [as 别名]
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]
示例2: _getSpaceGroupFromNumber
# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import subscribedSpaceGroupSymbols [as 别名]
def _getSpaceGroupFromNumber(self, cifData):
spaceGroupNumber = [int(cifData[x]) for x in
[u'_space_group_it_number', u'_symmetry_int_tables_number'] if
x in cifData.keys()]
if len(spaceGroupNumber) == 0:
raise RuntimeError('No space group symbol in CIF.')
possibleSpaceGroupSymbols = SpaceGroupFactory.subscribedSpaceGroupSymbols(spaceGroupNumber[0])
if len(possibleSpaceGroupSymbols) != 1:
raise RuntimeError(
'Can not use space group number to determine space group for no. {0}'.format(spaceGroupNumber))
return SpaceGroupFactory.createSpaceGroup(possibleSpaceGroupSymbols[0]).getHMSymbol()
示例3: _punch_and_fill
# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import subscribedSpaceGroupSymbols [as 别名]
def _punch_and_fill(self, signal, dimX, dimY, dimZ): # noqa
Xmin, Xmax, _, Xwidth = self._get_dim_params(dimX)
Ymin, Ymax, _, Ywidth = self._get_dim_params(dimY)
Zmin, Zmax, _, Zwidth = self._get_dim_params(dimZ)
X, Y, Z = self._get_XYZ_ogrid(dimX, dimY, dimZ)
size = self.getProperty("Size").value
if len(size)==1:
size = np.repeat(size, 3)
size/=2.0 # We want radii or half box width
cut_shape = self.getProperty("Shape").value
space_group = self.getProperty("SpaceGroup").value
if space_group:
check_space_group = True
try:
space_group=SpaceGroupFactory.subscribedSpaceGroupSymbols(int(space_group))[0]
except ValueError:
pass
logger.information('Using space group: '+space_group)
sg=SpaceGroupFactory.createSpaceGroup(space_group)
else:
check_space_group = False
if cut_shape == 'cube':
for h in range(int(np.ceil(Xmin)), int(Xmax)+1):
for k in range(int(np.ceil(Ymin)), int(Ymax)+1):
for l in range(int(np.ceil(Zmin)), int(Zmax)+1):
if not check_space_group or sg.isAllowedReflection([h,k,l]):
signal[int((h-size[0]-Xmin)/Xwidth+1):int((h+size[0]-Xmin)/Xwidth),
int((k-size[1]-Ymin)/Ywidth+1):int((k+size[1]-Ymin)/Ywidth),
int((l-size[2]-Zmin)/Zwidth+1):int((l+size[2]-Zmin)/Zwidth)]=np.nan
else: # sphere
mask=((X-np.round(X))**2/size[0]**2 + (Y-np.round(Y))**2/size[1]**2 + (Z-np.round(Z))**2/size[2]**2 < 1)
# Unmask invalid reflections
if check_space_group:
for h in range(int(np.ceil(Xmin)), int(Xmax)+1):
for k in range(int(np.ceil(Ymin)), int(Ymax)+1):
for l in range(int(np.ceil(Zmin)), int(Zmax)+1):
if not sg.isAllowedReflection([h,k,l]):
mask[int((h-0.5-Xmin)/Xwidth+1):int((h+0.5-Xmin)/Xwidth),
int((k-0.5-Ymin)/Ywidth+1):int((k+0.5-Ymin)/Ywidth),
int((l-0.5-Zmin)/Zwidth+1):int((l+0.5-Zmin)/Zwidth)]=False
signal[mask]=np.nan
return signal
示例4: PyExec
# 需要导入模块: from mantid.geometry import SpaceGroupFactory [as 别名]
# 或者: from mantid.geometry.SpaceGroupFactory import subscribedSpaceGroupSymbols [as 别名]
def PyExec(self): # noqa
progress = Progress(self, 0.0, 1.0, 5)
inWS = self.getProperty("InputWorkspace").value
signal = inWS.getSignalArray().copy()
dimX=inWS.getXDimension()
dimY=inWS.getYDimension()
dimZ=inWS.getZDimension()
Xmin=dimX.getMinimum()
Ymin=dimY.getMinimum()
Zmin=dimZ.getMinimum()
Xmax=dimX.getMaximum()
Ymax=dimY.getMaximum()
Zmax=dimZ.getMaximum()
Xbins=dimX.getNBins()
Ybins=dimY.getNBins()
Zbins=dimZ.getNBins()
Xwidth=dimX.getBinWidth()
Ywidth=dimY.getBinWidth()
Zwidth=dimZ.getBinWidth()
X=np.linspace(Xmin,Xmax,Xbins+1)
Y=np.linspace(Ymin,Ymax,Ybins+1)
Z=np.linspace(Zmin,Zmax,Zbins+1)
X, Y, Z = np.ogrid[(dimX.getX(0)+dimX.getX(1))/2:(dimX.getX(Xbins)+dimX.getX(Xbins-1))/2:Xbins*1j,
(dimY.getX(0)+dimY.getX(1))/2:(dimY.getX(Ybins)+dimY.getX(Ybins-1))/2:Ybins*1j,
(dimZ.getX(0)+dimZ.getX(1))/2:(dimZ.getX(Zbins)+dimZ.getX(Zbins-1))/2:Zbins*1j]
if self.getProperty("RemoveReflections").value:
progress.report("Removing Reflections")
size = self.getProperty("Size").value
if len(size)==1:
size = np.repeat(size, 3)
size/=2.0 # We want radii or half box width
cut_shape = self.getProperty("Shape").value
space_group = self.getProperty("SpaceGroup").value
if space_group:
check_space_group = True
try:
space_group=SpaceGroupFactory.subscribedSpaceGroupSymbols(int(space_group))[0]
except ValueError:
pass
logger.information('Using space group: '+space_group)
sg=SpaceGroupFactory.createSpaceGroup(space_group)
else:
check_space_group = False
if cut_shape == 'cube':
for h in range(int(np.ceil(Xmin)), int(Xmax)+1):
for k in range(int(np.ceil(Ymin)), int(Ymax)+1):
for l in range(int(np.ceil(Zmin)), int(Zmax)+1):
if not check_space_group or sg.isAllowedReflection([h,k,l]):
signal[int((h-size[0]-Xmin)/Xwidth+1):int((h+size[0]-Xmin)/Xwidth),
int((k-size[1]-Ymin)/Ywidth+1):int((k+size[1]-Ymin)/Ywidth),
int((l-size[2]-Zmin)/Zwidth+1):int((l+size[2]-Zmin)/Zwidth)]=np.nan
else: # sphere
mask=((X-np.round(X))**2/size[0]**2 + (Y-np.round(Y))**2/size[1]**2 + (Z-np.round(Z))**2/size[2]**2 < 1)
# Unmask invalid reflections
if check_space_group:
for h in range(int(np.ceil(Xmin)), int(Xmax)+1):
for k in range(int(np.ceil(Ymin)), int(Ymax)+1):
for l in range(int(np.ceil(Zmin)), int(Zmax)+1):
if not sg.isAllowedReflection([h,k,l]):
mask[int((h-0.5-Xmin)/Xwidth+1):int((h+0.5-Xmin)/Xwidth),
int((k-0.5-Ymin)/Ywidth+1):int((k+0.5-Ymin)/Ywidth),
int((l-0.5-Zmin)/Zwidth+1):int((l+0.5-Zmin)/Zwidth)]=False
signal[mask]=np.nan
if self.getProperty("CropSphere").value:
progress.report("Cropping to sphere")
sphereMin = self.getProperty("SphereMin").value
if sphereMin[0] < Property.EMPTY_DBL:
if len(sphereMin)==1:
sphereMin = np.repeat(sphereMin, 3)
signal[X**2/sphereMin[0]**2 + Y**2/sphereMin[1]**2 + Z**2/sphereMin[2]**2 < 1]=np.nan
sphereMax = self.getProperty("SphereMax").value
if sphereMax[0] < Property.EMPTY_DBL:
if len(sphereMax)==1:
sphereMax = np.repeat(sphereMax, 3)
if self.getProperty("FillValue").value == Property.EMPTY_DBL:
fill_value = np.nan
else:
fill_value = self.getProperty("FillValue").value
signal[X**2/sphereMax[0]**2 + Y**2/sphereMax[1]**2 + Z**2/sphereMax[2]**2 > 1]=fill_value
if self.getProperty("Convolution").value:
progress.report("Convoluting signal")
signal = self._convolution(signal)
if self.getPropertyValue("IntermediateWorkspace"):
cloneWS_alg = self.createChildAlgorithm("CloneMDWorkspace", enableLogging=False)
cloneWS_alg.setProperty("InputWorkspace",inWS)
cloneWS_alg.execute()
#.........这里部分代码省略.........