Exemple #1
0
 def mirror_limits(self, input_range):
   """
   Return the mirror stage position limits that fully accomodate the
   given input x-position range.
   """
   limit_candidates = []
   for scan_limit in input_range:
     beam_pair = []
     for beam in self.mirror_positions([scan_limit, 0, 0]):
       beam_pair.append(clamp(beam[0].value, -250, 250))
     limit_candidates.append(beam_pair)
   if input_range[1] > input_range[0]:
     return (max(limit_candidates[0]), min(limit_candidates[1]))
   else:
     return (min(limit_candidates[0]), max(limit_candidates[1]))
Exemple #2
0
  def position(self, position=None, wait=False):
    """Moves the stage to an absolute position. If no argument is
    given, the current position of the stage is returned.

    If the given position is outside the range of the stage, the
    stage is moved to its limit.
    """
    if position is None:
      self.send('TP')
      position = float(self.controller.read())
    else:
      if self.limits is not None:
        position = clamp(position, self.limits.lower, self.limits.upper)
      self.send('PA', '{:03.5f}'.format(float(position)))
    if wait:
      self.pause_for_stage()
    return Value(position, self.resolution)