def CalcAllPhysical(self, pseudo_positions): """Returns the physical motor positions for the given pseudo motor position(s)""" result = self.pseudo_motor.calc_physical(pseudo_positions) if result.error: throw_sardana_exception(result) return result.value
def read_RecordData(self, attr): try: macro_data = self.door.get_macro_data() codec = CodecFactory().getCodec('bz2_pickle') data = codec.encode(('', macro_data)) except MacroServerException, mse: throw_sardana_exception(mse)
def CalcPseudo(self, physical_positions): """Returns the pseudo motor position for the given physical positions""" if not len(physical_positions): physical_positions = None result = self.pseudo_motor.calc_pseudo(physical_positions=physical_positions) if result.error: throw_sardana_exception(result) return result.value
def CalcPhysical(self, pseudo_position): """Returns the physical motor positions for the given pseudo motor position assuming the current pseudo motor write positions for all the other sibling pseudo motors""" result = self.pseudo_motor.calc_physical(pseudo_position) if result.error: throw_sardana_exception(result) return result.value
def CalcAllPseudo(self, physical_values): """Returns the pseudo counter values for the given physical counters""" if not len(physical_values): physical_values = None result = self.pseudo_counter.calc(physical_values=physical_values) if result.error: throw_sardana_exception(result) return result.value
def CalcPseudo(self, physical_positions): """Returns the pseudo motor position for the given physical positions""" if not len(physical_positions): physical_positions = None result = self.pseudo_motor.calc_pseudo( physical_positions=physical_positions) if result.error: throw_sardana_exception(result) return result.value
def write_Value(self, attr): self.in_write_value = True value = attr.get_write_value() try: self.ior.set_value(value) # manually store write value in the database self.set_write_value_to_db() except PoolException as pe: throw_sardana_exception(pe) finally: self.in_write_value = False
def read_Position(self, attr): pseudo_motor = self.pseudo_motor use_cache = pseudo_motor.is_in_operation() and not self.Force_HW_Read position = pseudo_motor.get_position(cache=use_cache, propagate=0) if position.error: throw_sardana_exception(position) state = pseudo_motor.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_RecordData(self, attr): try: macro_data = self.door.get_macro_data() codec = CodecFactory().getCodec('bz2_pickle') data = codec.encode(('', macro_data)) except MacroServerException as mse: throw_sardana_exception(mse) attr.set_value(*data) # workaround for a bug in PyTango (tango-controls/pytango#147), # i.e. temporary solution for issue #447 # (storing reference to data so it can not be destroyed by GC) self.__buf_data = data
def write_Position(self, attr): self.in_write_position = True try: position = attr.get_write_value() self.debug("write_Position(%s)", position) try: self.wait_for_operation() except: raise Exception("Cannot move: already in motion") try: self.motor_group.position = position except PoolException, pe: throw_sardana_exception(pe) finally: self.in_write_position = False
def write_Position(self, attr): self.in_write_position = True position = attr.get_write_value() try: self.info("write_Position(%s)", position) try: self.wait_for_operation() except: raise Exception("Cannot move: already in motion") try: self.motor.position = position except PoolException, pe: throw_sardana_exception(pe) # manually store write dial position in the database self.set_write_dial_position_to_db()
def write_Position(self, attr): self.in_write_position = True try: position = attr.get_write_value() self.debug("write_Position(%s)", position) try: self.wait_for_operation() except: raise Exception("Cannot move: already in motion") pseudo_motor = self.pseudo_motor try: pseudo_motor.position = position except SardanaException as se: throw_sardana_exception(se) finally: self.in_write_position = False
def CalcAllPseudo(self, physical_positions): """Returns the pseudo motor position(s) for the given physical positions""" result = self.pseudo_motor.calc_all_pseudo(physical_positions) if result.error: throw_sardana_exception(result) return result.value