def snapshot_base(self, update=False): """ State of the station as a JSON-compatible dict. Args: update (bool): If True, update the state by querying the all the childs: f.ex. instruments, parameters, components, etc. If False, just use the latest values in memory. Returns: dict: base snapshot """ snap = { 'instruments': {}, 'parameters': {}, 'components': {}, 'default_measurement': _actions_snapshot(self.default_measurement, update) } for name, itm in self.components.items(): if isinstance(itm, (Instrument)): snap['instruments'][name] = itm.snapshot(update=update) elif isinstance(itm, (Parameter, ManualParameter, StandardParameter)): snap['parameters'][name] = itm.snapshot(update=update) else: snap['components'][name] = itm.snapshot(update=update) return snap
def snapshot_base(self, update: bool = False, params_to_skip_update: Optional[Sequence[str]] = None): return { '__class__': full_class(self), 'actions': _actions_snapshot(self._dummyLoop.actions, update) }
def snapshot_base(self, update=False): """ State of the station as a JSON-compatible dict. Args: update (bool): If True, update the state by querying the all the childs: f.ex. instruments, parameters, components, etc. If False, just use the latest values in memory. Returns: dict: base snapshot """ snap = { "instruments": {}, "parameters": {}, "components": {}, "default_measurement": _actions_snapshot(self.default_measurement, update), } for name, item in self.components.items(): if isinstance(item, (Instrument)): snap["instruments"][name] = item.snapshot(update=update) elif isinstance(item, _BaseParameter): snap["parameters"][name] = item.snapshot(update=update) else: snap["components"][name] = item.snapshot(update=update) return snap
def snapshot_base( self, update: Optional[bool] = True, params_to_skip_update: Optional[Sequence[str]] = None) -> Dict: """ State of the station as a JSON-compatible dictionary (everything that the custom JSON encoder class :class:`qcodes.utils.helpers.NumpyJSONEncoder` supports). Note: If the station contains an instrument that has already been closed, not only will it not be snapshotted, it will also be removed from the station during the execution of this function. Args: update: If ``True``, update the state by querying the all the children: f.ex. instruments, parameters, components, etc. If None only update if the state is known to be invalid. If ``False``, just use the latest values in memory and never update the state. params_to_skip_update: Not used. Returns: dict: Base snapshot. """ snap: Dict = { 'instruments': {}, 'parameters': {}, 'components': {}, 'config': self.config, 'default_measurement': _actions_snapshot(self.default_measurement, update) } components_to_remove = [] for name, itm in self.components.items(): if isinstance(itm, Instrument): # instruments can be closed during the lifetime of the # station object, hence this 'if' allows to avoid # snapshotting instruments that are already closed if Instrument.is_valid(itm): snap['instruments'][name] = itm.snapshot(update=update) else: components_to_remove.append(name) elif isinstance(itm, (Parameter, ManualParameter)): snap['parameters'][name] = itm.snapshot(update=update) else: snap['components'][name] = itm.snapshot(update=update) for c in components_to_remove: self.remove_component(c) return snap
def snapshot_base( self, update: bool = True, params_to_skip_update: Optional[Sequence[str]] = None) -> Dict: """ State of the station as a JSON-compatible dict. Note: in the station contains an instrument that has already been closed, not only will it not be snapshotted, it will also be removed from the station during the execution of this function. Args: update (bool): If True, update the state by querying the all the children: f.ex. instruments, parameters, components, etc. If False, just use the latest values in memory. params_to_skip_update: Not used Returns: dict: base snapshot """ snap = { 'instruments': {}, 'parameters': {}, 'components': {}, 'default_measurement': _actions_snapshot(self.default_measurement, update) } components_to_remove = [] for name, itm in self.components.items(): if isinstance(itm, Instrument): # instruments can be closed during the lifetime of the # station object, hence this 'if' allows to avoid # snapshotting instruments that are already closed if Instrument.is_valid(itm): snap['instruments'][name] = itm.snapshot(update=update) else: components_to_remove.append(name) elif isinstance(itm, (Parameter, ManualParameter, StandardParameter)): snap['parameters'][name] = itm.snapshot(update=update) else: snap['components'][name] = itm.snapshot(update=update) for c in components_to_remove: self.remove_component(c) return snap
def snapshot_base(self, update=False): return { '__class__': full_class(self), 'actions': _actions_snapshot(self._dummyLoop.actions, update) }