def _from_memoized_dict(cls, mm_dict, serial_memo): state_space = _statespace.StateSpace.from_nice_serialization( mm_dict['state_space']) basis = _Basis.from_nice_serialization(mm_dict['basis']) return cls(state_space, basis, mm_dict['evotype'], mm_dict['rates'], seed_or_state=None)
def _from_nice_serialization(cls, state): state_space = _StateSpace.from_nice_serialization(state['state_space']) layer_rules = _LayerRules.from_nice_serialization(state['layer_rules']) basis = _Basis.from_nice_serialization(state['basis']) modelmembers = _MMGraph.load_modelmembers_from_serialization_dict( state['modelmembers']) simulator = _FSim.from_nice_serialization(state['simulator']) mdl = cls(state_space, layer_rules, basis, simulator, state['evotype']) root_dicts = { 'prep_blks': mdl.prep_blks, 'povm_blks': mdl.povm_blks, 'operation_blks': mdl.operation_blks, 'instrument_blks': mdl.instrument_blks, 'factories': mdl.factories, } for mm_key, mm_dict in modelmembers.items(): root_key, sub_key = mm_key.split('|') root_dicts[root_key][sub_key].update( mm_dict) # Note: sub_keys should already be created return mdl
def _from_memoized_dict(cls, mm_dict, serial_memo): vec = _np.array(mm_dict['dense_state_vector']) state_space = _statespace.StateSpace.from_nice_serialization(mm_dict['state_space']) basis = _Basis.from_nice_serialization(mm_dict['basis']) truncate = False # shouldn't need to since we're loading a valid object return cls(vec, basis, truncate, mm_dict['evotype'], state_space)
def _from_memoized_dict(cls, mm_dict, serial_memo): vec = cls._decodemx(mm_dict['dense_state_vector']) state_space = _statespace.StateSpace.from_nice_serialization( mm_dict['state_space']) basis = _Basis.from_nice_serialization(mm_dict['basis']) return cls(vec, basis, mm_dict['evotype'], state_space)
def _from_memoized_dict(cls, mm_dict, serial_memo): state_space = _statespace.StateSpace.from_nice_serialization( mm_dict['state_space']) basis = _Basis.from_nice_serialization(mm_dict['basis']) return cls(_np.array(mm_dict['zvals']), basis, mm_dict['evotype'], state_space)
def _from_nice_serialization(cls, state): basis = _Basis.from_nice_serialization(state['basis']) return cls(_statespace.default_space_for_dim(state['state_space_dimension']), basis, state['evotype'])