def close(self, **kwargs): """Close the instrument""" log_info("CLOSE: {0}".format(self.name)) self.status="Closed" self.closer(self, **kwargs)
def run_measurement(self): log_info("Master started") do_it_if_needed(self, self.run) log_info("Master finished")
def boot(self, **kwargs): """Boot the instrument""" log_info("BOOT: {0}".format(self.name)) self.status="Active" self.booter(self, **kwargs)
def receive_log(self, name): """Log for receiving. can be overwritten in child classes for customization of message""" label = get_tag(self, name, 'label', name) log_info("RECEIVE: {instr} {label}".format(instr=self.name, label=label))
def _observe_abort(self, change): if self.abort == True: log_info("abort fired")
def run_measurement(self): log_info("Master started") do_it_if_needed(self, self.run) log_info("Master finished")
def update_log(self, instr, kwargs): """update log function called by __call__. can be overwritten in subclasses to customize message""" log_info('RAN: {instr} {name}: {kwargs}'.format( instr=instr.name, name=self.f.func_name, kwargs=kwargs))
def run_measurement(self): log_info("Measurement started") self.prepare() self.run() self.finish() log_info("Measurement finished")
def send_log(self, name): """Log for sending. can be overwritten in child classes to allow customization of message""" label = self.get_tag(name, 'label', name) log_info("SEND: {instr} {label}".format(instr=self.name, label=label))
def run_measurement(self): log_info("Measurement started") self.prepare() self.run() self.finish() log_info("Measurement finished")
def run_measurement(self): log_info("EBL Master started") self.run() log_info("EBL Master finished")
def run_measurement(self): log_info("Master started") self.run() log_info("Master finished")
def update_log(self, instr, kwargs): """update log function called by __call__. can be overwritten in subclasses to customize message""" log_info('RAN: {instr} {name}: {kwargs}'.format( instr=instr.name, name=self.f.func_name, kwargs=kwargs))
def set_log(self, name, value): """called when parameter of given name is set to value i.e. instr.parameter=value. Customized messages for different types. Also saves data""" if self.get_tag(name, 'log', True): label=self.get_tag(name, 'label', name) unit=self.get_tag(name, 'unit', "") if self.get_type(name)==ContainerList: log_info("Set {instr} {label} to {length} list {unit}".format( instr=self.name, label=label, length=shape(getattr(self, name)), unit=unit)) elif self.get_type(name)==ndarray: log_info("Set {instr} {label} to {length} array {unit}".format( instr=self.name, label=label, length=shape(getattr(self, name)), unit=unit)) elif self.get_type(name)==Callable: pass elif self.get_type(name)==Enum: log_info("Set {instr} {label} to {value} ({map_val}) {unit}".format( instr=self.name, label=label, value=value, map_val=self.get_map(name, value), unit=unit)) elif self.get_type(name)==Dict: log_info("Set {instr} {label}".format(instr=self.name, label=label)) elif self.get_type(name)==Str: log_info("Set {instr} {label} to {length} string".format(instr=self.name, label=label, length=len(value))) elif self.get_type(name) in (Float, FloatRange): unit_factor=self.get_tag(name, 'unit_factor', 1.0) log_info("Set {instr} {label} to {value} {unit}".format( instr=self.name, label=label, value=value/unit_factor, unit=unit)) elif self.get_type(name) in (Int, Range): unit_factor=self.get_tag(name, 'unit_factor', 1) log_info("Set {instr} {label} to {value} {unit}".format( instr=self.name, label=label, value=value/unit_factor, unit=unit)) else: log_info("Set {instr} {label} to {value} {unit}".format( instr=self.name, label=label, value=value, unit=unit)) self.data_save(name, value)
def receive_log(self, name): """Log for receiving. can be overwritten in child classes for customization of message""" label=self.get_tag(name, 'label', name) log_info("RECEIVE: {instr} {label}".format( instr=self.name, label=label))
def boot(self, **kwargs): """Boot the instrument""" log_info("BOOT: {0}".format(self.name)) self.status = "Active" if self.booter is not None: self.booter(self, **kwargs)
def send_log(self, name): """Log for sending. can be overwritten in child classes to allow customization of message""" label=self.get_tag(name, 'label', name) log_info("SEND: {instr} {label}".format( instr=self.name, label=label))
def close(self, **kwargs): """Close the instrument""" log_info("CLOSE: {0}".format(self.name)) self.status = "Closed" if self.closer is not None: self.closer(self, **kwargs)
def _observe_abort(self, change): if self.abort==True: log_info("abort fired")
def set_log(self, name, value): """called when parameter of given name is set to value i.e. instr.parameter=value. Customized messages for different types. Also saves data""" if self.get_tag(name, 'log', True): label=self.get_tag(name, 'label', name) unit=self.get_tag(name, 'unit', "") if self.get_type(name)==ContainerList: log_info("Set {instr} {label} to {length} list {unit}".format( instr=self.name, label=label, length=shape(getattr(self, name)), unit=unit)) elif self.get_type(name)==ndarray: log_info("Set {instr} {label} to {length} array {unit}".format( instr=self.name, label=label, length=shape(getattr(self, name)), unit=unit)) elif self.get_type(name)==Callable: pass elif self.get_type(name)==Enum: log_info("Set {instr} {label} to {value} ({map_val}) {unit}".format( instr=self.name, label=label, value=value, map_val=self.get_map(name, value), unit=unit)) elif self.get_type(name)==Dict: log_info("Set {instr} {label}".format(instr=self.name, label=label)) elif self.get_type(name)==Str: log_info("Set {instr} {label} to {length} string".format(instr=self.name, label=label, length=len(value))) else: log_info("Set {instr} {label} to {value} {unit}".format( instr=self.name, label=label, value=value, unit=unit)) self.data_save(name, value)