def wrapper(*args, **kwargs): try: f(*args, **kwargs) except Exception as e: fn = f.__name__ en = typename(e) print(f"skipped persist {fn} as it caused: {en}: {e}")
def __repr__(self): tname = typename(self) name = self.name head = f"{tname} \"{name}\"" to_print = {ax_name: ax.get_current_value() for ax_name, ax in self.axes.items()} return printable_dict(to_print, head)
def __repr__(self): tname = typename(self) name = self.pvname n = 12 user = time_to_str(self.get(), n=n) dial = time_to_str(self.get_dial(), n=n) units = "sec" return f"{tname} \"{name}\" at {user} {units} (dial at {dial} {units})"
def _wait_for_ready(self): if not self._pcm: return timeout = self.timeout + time() for _ in self._pcm.start(): sleep(self.wait_time) if time() >= timeout: self._pcm.stop() tname = typename(self) raise AdjustableError(f"waiting for {tname} \"{self.name}\" to be ready for change to {value} {self.units} timed out")
def set_target_value(self, value): self._wait_for_ready() ret = self.pvs.setvalue.put(value, wait=True, use_complete=True) # use_complete=True enables status in PV.put_complete error = handle_put_return_value(ret) if error is not None: tname = typename(self) raise AdjustableError(f"changing {tname} \"{self.name}\" to {value} {self.units} failed due to {error}") sleep(self.process_time) self._wait_for_done()
def on_enter(self, event): val = self.GetValue() self._unset_alarm() try: val = arithmetic_eval(val) except SyntaxError as e: en = typename(e) msg = e.args[0] msg = f"{en}: {msg}" self._set_alarm(msg) self.SetInsertionPoint(e.offset) except Exception as e: en = typename(e) msg = f"{en}: {e}" self._set_alarm(msg) self.SetInsertionPointEnd() else: self.SetValue(val) self._last_good_value = val event.Skip()
def set_target_value(self, value): wait_time = self.wait_time timeout = self.timeout + time.time() self._move_requested = True self.pvs.drive.put(value, wait=True) # wait for start while self._move_requested and not self.is_moving(): time.sleep(wait_time) if time.time() >= timeout: tname = typename(self) self.stop() raise SmarActError(f"starting to move {tname} \"{self.name}\" to {value} {self.units} timed out") # wait for move done while self._move_requested and self.is_moving(): if self.is_holding(): # holding == arrived at target! break time.sleep(wait_time) self._move_requested = False
def __repr__(self): name = typename(self) return "{}: {}".format(name, self.status)
def __repr__(self): tn = typename(self) used = "\n- ".join( repr(i) for i in self.default_acquisitions + [self.condition]) return f"{tn} using:\n- {used}"
def __repr__(self): name = typename(self) status = "happy" if self.check() else "unhappy" return f"{name} \"{self.channel}\": {status}"
def _printable_name(self): tname = typename(self) name = self.name return f"{tname} \"{name}\"" if name is not None else tname
def __repr__(self): tname = typename(self) name = self.pvname value = self.get() units = self.units return f"{tname} \"{name}\" at {value} {units}"
def __repr__(self): return typename(self)
def __repr__(self): tn = typename(self) return f"{tn} \"{self.ID}\" is {self.status}"
def __repr__(self): tn = typename(self) return f"{tn}(\"{self.pvname}\", inverted={self.inverted}): state={self.state}"
def __repr__(self): name = typename(self) status = "happy" if self.check() else "unhappy" return f"{name}: {status}" #TODO
def __repr__(self): name = typename(self) return "{}: {}/{}".format(name, self.instrument, self.pgroup) #TODO