本文整理汇总了Python中dxtbx.model.experiment.experiment_list.ExperimentListFactory.from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python ExperimentListFactory.from_dict方法的具体用法?Python ExperimentListFactory.from_dict怎么用?Python ExperimentListFactory.from_dict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dxtbx.model.experiment.experiment_list.ExperimentListFactory
的用法示例。
在下文中一共展示了ExperimentListFactory.from_dict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_dict
# 需要导入模块: from dxtbx.model.experiment.experiment_list import ExperimentListFactory [as 别名]
# 或者: from dxtbx.model.experiment.experiment_list.ExperimentListFactory import from_dict [as 别名]
def from_dict(cls, obj):
import json
assert obj['__id__'] == 'Refiner'
return_obj = cls()
for k, v in obj.iteritems():
if k == '_refinr_indexers':
v_new = {}
for k_, v_ in v.iteritems():
from libtbx.utils import import_python_object
integrater_cls = import_python_object(
import_path=".".join((v_['__module__'], v_['__name__'])),
error_prefix='', target_must_be='', where_str='').object
v_new[float(k_)] = integrater_cls.from_dict(v_)
v = v_new
elif k == '_refinr_payload':
v_new = {}
for k_, v_ in v.iteritems():
try:
v_new[float(k_)] = v_
except ValueError, e:
v_new[k_] = v_
v = v_new
if isinstance(v, dict):
if v.get('__id__', None) == 'ExperimentList':
from dxtbx.model.experiment.experiment_list import ExperimentListFactory
v = ExperimentListFactory.from_dict(v, check_format=False)
setattr(return_obj, k, v)
示例2: from_dict
# 需要导入模块: from dxtbx.model.experiment.experiment_list import ExperimentListFactory [as 别名]
# 或者: from dxtbx.model.experiment.experiment_list.ExperimentListFactory import from_dict [as 别名]
def from_dict(cls, obj):
assert obj['__id__'] == 'Indexer'
assert obj['__name__'] == cls.__name__
return_obj = cls()
for k, v in obj.iteritems():
if k == '_indxr_helper' and v is not None:
from xia2.Schema.Interfaces.Indexer import _IndexerHelper
v = _IndexerHelper(v)
if k == '_indxr_imagesets' and len(v):
assert v[0].get('__id__') == 'imageset'
from dxtbx.serialize.imageset import imageset_from_dict
v = [imageset_from_dict(v_, check_format=False) for v_ in v]
if isinstance(v, dict):
if v.get('__id__') == 'ExperimentList':
from dxtbx.model.experiment.experiment_list import ExperimentListFactory
v = ExperimentListFactory.from_dict(v, check_format=False)
setattr(return_obj, k, v)
return return_obj
示例3: from_dict
# 需要导入模块: from dxtbx.model.experiment.experiment_list import ExperimentListFactory [as 别名]
# 或者: from dxtbx.model.experiment.experiment_list.ExperimentListFactory import from_dict [as 别名]
def from_dict(cls, obj):
assert obj['__id__'] == 'Integrater'
return_obj = cls()
for k, v in obj.iteritems():
if k in ('_intgr_indexer', '_intgr_refiner') and v is not None:
from libtbx.utils import import_python_object
cls = import_python_object(
import_path=".".join((v['__module__'], v['__name__'])),
error_prefix='', target_must_be='', where_str='').object
v = cls.from_dict(v)
if isinstance(v, dict):
if v.get('__id__') == 'ExperimentList':
from dxtbx.model.experiment.experiment_list import ExperimentListFactory
v = ExperimentListFactory.from_dict(v)
elif v.get('__id__') == 'imageset':
from dxtbx.serialize.imageset import imageset_from_dict
v = imageset_from_dict(v, check_format=False)
setattr(return_obj, k, v)
return return_obj