예제 #1
0
    def moveX(self, x):
        """ whole ladm move horizontally and keep same Z distance from diff  """
        if ((x <= self.__lowlimX) or (x >= self.__hilimX)):
            logprint("Asked to move %s (pv %s) outside limit, aborting" %
                     (self.XT.name, self.XT.pvname),
                     print_screen=1)
        else:
            try:

                x1 = xTox12(x)
                x2 = xTox12(x)
                z = xToz(x)
                z_now = self.z.wm()
                if z > z_now:
                    print 'moving z to %+4.f\n' % z
                    self.z.mv(z)
                    self.z.wait()
                    print 'moving x1 to %+4.f and x2 to %.4f\n' % (x1, x2)
                    self.x1.mv(x1)
                    self.x2.mv(x2)
                else:
                    print 'moving x1 to %+4.f and x2 to %.4f\n' % (x1, x2)
                    self.x1.mv(x1)
                    self.x2.mv(x2)
                    self.x1.wait()
                    self.x2.wait()
                    print 'moving z to %+4.f\n' % z
                    self.z.mv(z)
            except KeyboardInterrupt:
                self.stop()
예제 #2
0
 def move_dial(self, value):
     if (self.low_dial_lim is not None):
         check_low = (value >= self.low_dial_lim)
     else:
         check_low = True
     if (self.high_dial_lim is not None):
         check_high = (value <= self.high_dial_lim)
     else:
         check_high = True
     check = check_low and check_high
     if (not check):
         logprint(
             "Asked to move %s (pv %s) to dial %f that is outside limits, aborting"
             % (self.name, self.pvname, value),
             print_screen=1)
     else:
         self._join_thread()
         if not self._unattended:
             self._move_dial(value)
             if self.pvpos is not None:
                 self._movethread = PycaThread(
                     target=self.__wait_and_update_user_PV)
                 self._movethread.start()
             else:
                 self.wm()
         else:
             self._movethread = PycaThread(
                 target=self._move_dial_and_update_user_PV, args=(value, ))
             self._movethread.start()
예제 #3
0
 def trip(self, value=None):
     """ Sets or Returns the gauge trip point for the vacuum PLC """
     previous_trip = Pv.get(self.__pstatsprbck)
     if (value is not None):
         Pv.put(self.__pstatspdes, value)
         s = "Resetting PLC trip point of `%s` from %.4g to %.4g" % (
             self.name, previous_trip, value)
         logprint(s, print_screen=True)
     else:
         print "%s trip point is %.4g" % (self.name, previous_trip)
예제 #4
0
 def setE(self, E=None):
     """ set the energy (in keV) for calculation of transmission
     if called without parameter, it reads the value from the
     machine """
     if (E is None):
         Pv.put('SATT:FEE1:320:EACT.SCAN', '1 second')
     else:
         Pv.put('SATT:FEE1:320:EACT.SCAN', 'Passive')
         Pv.put('SATT:FEE1:320:EDES', E * 1e3)
     self.__E_pv.wait_until_change()
     logprint(
         "lusiatt: setting energy for transmission calculation to %.3f keV"
         % self.__E)
     return self.__E
예제 #5
0
 def create_ami(self, type):
     try:
         if type == "Scalar":
             if self.__filter_string is None:
                 self.pyamiE = pyami.Entry(self.aminame, "Scalar")
             else:
                 self.pyamiE = pyami.Entry(self.aminame, "Scalar",
                                           self.__filter_string)
         elif type == "SingleImage":
             self.pyamiE = pyami.Entry(det_id=self.aminame,
                                       channel=self.channel,
                                       op='single')
         else:
             self.pyamiE = pyami.Entry(self.aminame, self.channel)
     except RuntimeError:
         s = "detector %s cannot be found" % self.name
         logprint(s, print_screen=True)
         self.pyamiE = None
예제 #6
0
 def setE(self, E=None, use3rd=False):
   """ set the energy (in keV) for calculation of transmission
       if called without parameter, it reads the value from the
       machine """
   if ( E is None ):
     self.put_par("Eget", "1 second", wait=True)
     # wait for the changes to propogate through the sequence
     self.wait_par('EU1st')
     self.wait_par('E1st')
     self.use3rd = False
     logprint("lusiatt: setting energy for transmission calculation to %.3f keV" % self.__E)
     return self.__E
   else:
     if use3rd:
       self.__E3 = E
     else:
       self.__E = E
     logprint("lusiatt: setting energy for transmission calculation to %.3f keV" % E)
     return E
예제 #7
0
 def dial_delay_new(self,value=None):
   '''Seems to do exactly the same as dial_delay. Not sure what the difference is and cant be bothered now'''
   if (value is None):
     return Pv.get(self.__pv_angleshift_rbv)*1e-15
   else:
     m = laserDict[self.bll]["m"]
     M = laserDict[self.bll]["M"]
     if ( (value<m) or (value>M) ):
       logprint("Phase shifter has a range (%.2e,%.2e), asked for %.3e, aborting" % (m,M,value),print_screen=True)
       return
     self.__desired_value = value
     if abs(Pv.get(self.__pv_angleshift_rbv)*1e-15-value)>laserDict[self.bll]["eps1"]:
       self.lowgain()
       Pv.put(self.__pv_angleshift,int(value*1e15))
       self.wait()
       self.higain()
     else:
       Pv.put(self.__pv_angleshift,int(value*1e15))
     return
예제 #8
0
 def dial_delay(self,value=None):
   '''Reads or writes directly to the angle shift pv. This does not use the offset.
      usage: dial_delay(): read pack the angle shift pv
             dial_delay(value): writes to the angle shift variable, and toggles gain to get new value fast.
   '''
   if (value is None):
     return Pv.get(self.__pv_angleshift_rbv)*1e-15
   else:
     m = laserDict[self.bll]["m"]
     M = laserDict[self.bll]["M"]
     if ( (value<m) or (value>M) ):
       logprint("Phase shifter has a range (%.2e,%.2e), asked for %.3e, aborting" % (m,M,value),print_screen=True)
       return
     self.__desired_value = value
     if abs(Pv.get(self.__pv_angleshift_rbv)*1e-15-value)>laserDict[self.bll]["eps1"]:
       self.lowgain()
       Pv.put(self.__pv_angleshift,int(value*1e15))
       self.wait()
       self.higain()
     else:
       Pv.put(self.__pv_angleshift,int(value*1e15))
     return
예제 #9
0
 def __E_callback(self, err):
     """ callback sets the energy in keV from monitor IOC Pv"""
     if err is None:
         self.__E = self.__E_pv.value / 1e3
     else:
         logprint("error getting fee attenuator ioc energy: %s" % err)