def from_dict(cls, obj): assert obj['__id__'] == 'XSweep' return_obj = cls(name=None, sample=None, wavelength=None) for k, v in obj.iteritems(): if k in ('_indexer', '_refiner', '_integrater') 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 k == '_indexer': v.add_indexer_sweep(return_obj) elif k == '_refiner': v.add_refiner_sweep(return_obj) elif k == '_integrater': v.set_integrater_sweep(return_obj, reset=False) if isinstance(v, dict): #if v.get('__id__') == 'ExperimentList': #from dxtbx.model.experiment.experiment_list import ExperimentListFactory #v = ExperimentListFactory.from_dict(v) if 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) if return_obj._indexer is not None and return_obj._integrater is not None: return_obj._integrater._intgr_indexer = return_obj._indexer if return_obj._integrater is not None and return_obj._refiner is not None: return_obj._integrater._intgr_refiner = return_obj._refiner if return_obj._indexer is not None and return_obj._refiner is not None: return_obj._refiner._refinr_indexers[return_obj.get_epoch(1)] \ = return_obj._indexer return return_obj
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_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
def from_dict(cls, obj): assert obj['__id__'] == 'XSweep' return_obj = cls(name=None, sample=None, wavelength=None) for k, v in obj.iteritems(): if k in ('_indexer', '_refiner', '_integrater') 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 k == '_indexer': v.add_indexer_sweep(return_obj) elif k == '_refiner': v.add_refiner_sweep(return_obj) elif k == '_integrater': v.set_integrater_sweep(return_obj, reset=False) if isinstance(v, dict): #if v.get('__id__') == 'ExperimentList': #from dxtbx.model.experiment_list import ExperimentListFactory #v = ExperimentListFactory.from_dict(v) if 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) if return_obj._indexer is not None and return_obj._integrater is not None: return_obj._integrater._intgr_indexer = return_obj._indexer if return_obj._integrater is not None and return_obj._refiner is not None: return_obj._integrater._intgr_refiner = return_obj._refiner if return_obj._indexer is not None and return_obj._refiner is not None: return_obj._refiner._refinr_indexers[return_obj.get_epoch(1)] \ = return_obj._indexer return return_obj
def imageset_from_string(string, directory=None): """Load the string and return the models. Params: string The JSON string to load Returns: The models """ return imageset_from_dict(json.loads(string, object_hook=_decode_dict), directory=directory)
def imageset_from_string(string): ''' Load the string and return the models. Params: string The JSON string to load Returns: The models ''' import json from dxtbx.serialize.imageset import imageset_from_dict return imageset_from_dict(json.loads(string, object_hook=_decode_dict))
def imageset(filename): """Load the given JSON file. Params: infile The input filename Returns: The models """ # If the input is a string then open and read from that file filename = os.path.abspath(filename) directory = os.path.dirname(filename) with open(filename) as infile: return imageset_from_dict(json.load(infile), directory=directory)
def imageset_from_string(string, directory=None): """Load the string and return the models. Params: string The JSON string to load Returns: The models """ warnings.warn( "This function is deprecated and will be removed in the next release", DeprecationWarning, stacklevel=2, ) return imageset_from_dict(json.loads(string), directory=directory)
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
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_list import ExperimentListFactory v = ExperimentListFactory.from_dict(v, check_format=False) setattr(return_obj, k, v) return return_obj
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
def from_dict(cls, obj): assert obj["__id__"] == "Indexer" assert obj["__name__"] == cls.__name__ return_obj = cls() for k, v in obj.items(): if k == "_indxr_helper" and v is not None: 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_list import ExperimentListFactory v = ExperimentListFactory.from_dict(v, check_format=False) setattr(return_obj, k, v) return return_obj