本文整理汇总了Python中dxtbx.datablock.DataBlockFactory.from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python DataBlockFactory.from_dict方法的具体用法?Python DataBlockFactory.from_dict怎么用?Python DataBlockFactory.from_dict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dxtbx.datablock.DataBlockFactory
的用法示例。
在下文中一共展示了DataBlockFactory.from_dict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: to_datablocks
# 需要导入模块: from dxtbx.datablock import DataBlockFactory [as 别名]
# 或者: from dxtbx.datablock.DataBlockFactory import from_dict [as 别名]
def to_datablocks(self):
''' Return the experiment list as a datablock list.
This assumes that the experiment contains 1 datablock.'''
from dxtbx.datablock import DataBlockFactory
# Convert the experiment list to dict
obj = self.to_dict()
# Convert the dictionary to a datablock dictionary
obj['__id__'] = 'DataBlock'
for e in obj['experiment']:
iid = e['imageset']
imageset = obj['imageset'][iid]
if 'beam' in e:
imageset['beam'] = e['beam']
if 'detector' in e:
imageset['detector'] = e['detector']
if 'goniometer' in e:
imageset['goniometer'] = e['goniometer']
if 'scan' in e:
imageset['scan'] = e['scan']
# Remove the experiments
del obj['experiment']
# Create the datablock
return DataBlockFactory.from_dict([obj])