def read_Value(self, attr): oned = self.oned # TODO: decide if we force the controller developers to store the # last acquired value in the controllers or we always will use # cache. This is due to the fact that the clients (MS) read the value # after the acquisition had finished. use_cache = oned.is_in_operation() and not self.Force_HW_Read # For the moment we just check if we recently receive ValueBuffer. # event. In this case, we use cache and clean the flag # so the cached value will be returned only at the first readout # after the acquisition. This is a workaround for the count executed # by the MacroServer e.g. step scans or ct which read the value after # the acquisition. if not use_cache and self._first_read_cache: use_cache = True self._first_read_cache = False value = oned.get_value(cache=use_cache, propagate=0) if value.error: Except.throw_python_exception(*value.exc_info) state = oned.get_state(cache=use_cache, propagate=0) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=value.value, quality=quality, timestamp=value.timestamp, priority=0)
def read_Value(self, attr): twod = self.twod # TODO: decide if we force the controller developers to store the # last acquired value in the controllers or we always will use # cache. This is due to the fact that the clients (MS) read the value # after the acquisition had finished. use_cache = twod.is_in_operation() and not self.Force_HW_Read # For the moment we just check if we recently receive ValueBuffer. # event. In this case, we use cache and clean the flag # so the cached value will be returned only at the first readout # after the acquisition. This is a workaround for the count executed # by the MacroServer e.g. step scans or ct which read the value after # the acquisition. if not use_cache and self._first_read_cache: use_cache = True self._first_read_cache = False value = twod.get_value(cache=use_cache, propagate=0) if value.error: Except.throw_python_exception(*value.exc_info) state = twod.get_state(cache=use_cache, propagate=0) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=value.value, quality=quality, timestamp=value.timestamp, priority=0)
def _to_motor_write_positions(self, pos): w_positions = [] for elem in self.motor_group.get_user_elements(): position = pos[elem] if position.in_error(): Except.throw_python_exception(*position.exc_info) w_positions.append(position.w_value) return w_positions
def _to_motor_write_positions(self, pos): w_positions = [] for elem in self.motor_group.get_user_elements(): position = pos[elem] if position.in_error(): Except.throw_python_exception(*position.exc_info) w_positions.append(position.w_value) return w_positions
def read_Value(self, attr): value = self.ior.get_value(cache=False) if value.error: Except.throw_python_exception(*value.exc_info) self.set_attribute(attr, value=value.value, w_value=value.w_value, priority=0, timestamp=value.timestamp)
def read_Value(self, attr): pseudo_counter = self.pseudo_counter use_cache = pseudo_counter.is_in_operation() and not self.Force_HW_Read value = pseudo_counter.get_value(cache=use_cache, propagate=0) if value.error: Except.throw_python_exception(*value.exc_info) quality = None state = pseudo_counter.get_state(cache=use_cache, propagate=0) if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=value.value, quality=quality, priority=0, timestamp=value.timestamp)
def read_DialPosition(self, attr): motor = self.motor use_cache = motor.is_in_operation() and not self.Force_HW_Read state = motor.get_state(cache=use_cache, propagate=0) dial_position = motor.get_dial_position(cache=use_cache, propagate=0) if dial_position.error: Except.throw_python_exception(*dial_position.exc_info) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=dial_position.value, quality=quality, priority=0, timestamp=dial_position.timestamp)
def read_Value(self, attr): twod = self.twod use_cache = twod.is_in_operation() and not self.Force_HW_Read value = twod.get_value(cache=use_cache, propagate=0) if value.error: Except.throw_python_exception(*value.exc_info) state = twod.get_state(cache=use_cache, propagate=0) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=value.value, quality=quality, timestamp=value.timestamp, priority=0)
def read_DialPosition(self, attr): motor = self.motor use_cache = motor.is_in_operation() and not self.Force_HW_Read state = motor.get_state(cache=use_cache, propagate=0) dial_position = motor.get_dial_position(cache=use_cache, propagate=0) if dial_position.error: Except.throw_python_exception(*dial_position.exc_info) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=dial_position.value, quality=quality, priority=0, timestamp=dial_position.timestamp)
def read_CurrentValue(self, attr): zerod = self.zerod #use_cache = ct.is_action_running() and not self.Force_HW_Read use_cache = self.get_state() == State.Moving and not self.Force_HW_Read value = zerod.get_current_value(cache=use_cache, propagate=0) if value.error: Except.throw_python_exception(*value.exc_info) quality = None state = zerod.get_state(cache=use_cache, propagate=0) if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=value.value, quality=quality, priority=0, timestamp=value.timestamp)
def throw_sardana_exception(exc): """Throws an exception as a tango exception""" if isinstance(exc, SardanaException): if exc.exc_info and not None in exc.exc_info: Except.throw_python_exception(*exc.exc_info) else: tb = "<Unknown>" if exc.traceback is not None: tb = str(exc.traceback) Except.throw_exception(exc.type, exc.msg, tb) elif hasattr(exc, 'exc_info'): Except.throw_python_exception(*exc.exc_info) else: raise exc
def throw_sardana_exception(exc): """Throws an exception as a tango exception""" if isinstance(exc, SardanaException): if exc.exc_info and not None in exc.exc_info: Except.throw_python_exception(*exc.exc_info) else: tb = "<Unknown>" if exc.traceback is not None: tb = str(exc.traceback) Except.throw_exception(exc.type, exc.msg, tb) elif hasattr(exc, 'exc_info'): Except.throw_python_exception(*exc.exc_info) else: raise exc
def read_ValueRef(self, attr): twod = self.twod value_ref = twod.get_value_ref() if value_ref.error: Except.throw_python_exception(*value_ref.exc_info) use_cache = twod.is_in_operation() and not self.Force_HW_Read state = twod.get_state(cache=use_cache, propagate=0) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=value_ref.value, quality=quality, timestamp=value_ref.timestamp, priority=0)
def read_CurrentValue(self, attr): zerod = self.zerod #use_cache = ct.is_action_running() and not self.Force_HW_Read use_cache = self.get_state() == State.Moving and not self.Force_HW_Read value = zerod.get_current_value(cache=use_cache, propagate=0) if value.error: Except.throw_python_exception(*value.exc_info) quality = None state = zerod.get_state(cache=use_cache, propagate=0) if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=value.value, quality=quality, priority=0, timestamp=value.timestamp)
def read_Position(self, attr): # if motors are moving their position is already being updated with a # high frequency so don't bother overloading and just get the cached # values motor_group = self.motor_group use_cache = motor_group.is_in_operation() and not self.Force_HW_Read position = motor_group.get_position(cache=use_cache, propagate=0) if position.error: Except.throw_python_exception(*position.exc_info) state = motor_group.get_state(cache=use_cache, propagate=0) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=position.value, w_value=position.w_value, quality=quality, priority=0, timestamp=position.timestamp)
def read_Value(self, attr): twod = self.twod # TODO: decide if we force the controller developers to store the # last acquired value in the controllers or we always will use # cache. This is due to the fact that the clients (MS) read the value # after the acquisition had finished. use_cache = twod.is_in_operation() and not self.Force_HW_Read value = twod.get_value(cache=use_cache, propagate=0) if value.error: Except.throw_python_exception(*value.exc_info) state = twod.get_state(cache=use_cache, propagate=0) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=value.value, quality=quality, timestamp=value.timestamp, priority=0)
def read_Value(self, attr): twod = self.twod # TODO: decide if we force the controller developers to store the # last acquired value in the controllers or we always will use # cache. This is due to the fact that the clients (MS) read the value # after the acquisition had finished. use_cache = twod.is_in_operation() and not self.Force_HW_Read value = twod.get_value(cache=use_cache, propagate=0) if value.error: Except.throw_python_exception(*value.exc_info) state = twod.get_state(cache=use_cache, propagate=0) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=value.value, quality=quality, timestamp=value.timestamp, priority=0)
def read_Position(self, attr): # if motors are moving their position is already being updated with a # high frequency so don't bother overloading and just get the cached # values motor_group = self.motor_group use_cache = motor_group.is_in_operation() and not self.Force_HW_Read position = motor_group.get_position(cache=use_cache, propagate=0) if position.error: Except.throw_python_exception(*position.exc_info) state = motor_group.get_state(cache=use_cache, propagate=0) quality = None if state == State.Moving: quality = AttrQuality.ATTR_CHANGING self.set_attribute(attr, value=position.value, w_value=position.w_value, quality=quality, priority=0, timestamp=position.timestamp)
def read_Value(self, attr): pseudo_counter = self.pseudo_counter use_cache = pseudo_counter.is_in_operation() and not self.Force_HW_Read value_attr = pseudo_counter.get_value(cache=use_cache, propagate=0) # first obtain the value - during this process it may # enter into the error state, either when updating the elements # values or when calculating the pseudo value value = value_attr.value if value_attr.error: Except.throw_python_exception(*value_attr.exc_info) quality = None state = pseudo_counter.get_state(cache=use_cache, propagate=0) if state == State.Moving: quality = AttrQuality.ATTR_CHANGING timestamp = value_attr.value self.set_attribute(attr, value=value, quality=quality, priority=0, timestamp=timestamp)
def read_Value(self, attr): pseudo_counter = self.pseudo_counter use_cache = pseudo_counter.is_in_operation() and not self.Force_HW_Read if not use_cache and self._first_read_cache: use_cache = True self._first_read_cache = False value_attr = pseudo_counter.get_value(cache=use_cache, propagate=0) # first obtain the value - during this process it may # enter into the error state, either when updating the elements # values or when calculating the pseudo value value = value_attr.value if value_attr.error: Except.throw_python_exception(*value_attr.exc_info) quality = None state = pseudo_counter.get_state(cache=use_cache, propagate=0) if state == State.Moving: quality = AttrQuality.ATTR_CHANGING timestamp = value_attr.timestamp self.set_attribute(attr, value=value, quality=quality, priority=0, timestamp=timestamp)
def read_Value(self, attr): value = self.ior.get_value(cache=False) if value.error: Except.throw_python_exception(*value.exc_info) self.set_attribute(attr, value=value.value, w_value=value.w_value, priority=0, timestamp=value.timestamp)