Ejemplo n.º 1
0
def RunCommand(sock, resultq):
    #print('RunCommand: start')
    ss = MySocket(sock)
    try:
        word = ss.myreceive()
        word = word.decode('utf_8')
    except AttributeError as err:
        print(err)
        word = None
    except RuntimeError as err:
        print(err)
        return None
    #print('RunCommand:', word)
    if word:
        if '?' in word:
            commandq.put((resultq, Lakeshore_370.query, (word, )))
        else:
            commandq.put((resultq, Lakeshore_370.write, (word, )))
    else:
        return None
    xx = resultq.get()
    if xx == None:
        xx = ''
    resultq.task_done()
    ss.mysend(xx.encode('utf_8'))
    ss.sock.close()
    return word
Ejemplo n.º 2
0
    def query(self,mystr):
        """Query function

        Sends a VISA string (intended for the lakeshore) to the temperature to the server and retrieves a response.

        Parameters
        ----------
        mystr : str
            VISA string to send

        Returns
        -------
        word : str
            Response from server (Lakeshore)

        """
        # s = MySocket(verb=self.verb)
        s = MySocket()
        s.sock.connect((self.addr, self.port))
        if self.verb:
            print(mystr)
        s.mysend(mystr.encode('utf_8'))
        word = s.myreceive()
        word = word.decode('utf_8')
        if self.verb:
            print(word)
        s.sock.close()
        return word
Ejemplo n.º 3
0
def RunCommand(sock,resultq):
    #print('RunCommand: start')
    ss = MySocket(sock)
    try:
        word = ss.myreceive()
        word = word.decode('utf_8')
    except AttributeError as err:
        print(err)
        word = None
    except RuntimeError as err:
        print(err)
        return None
    #print('RunCommand:', word)
    if word:
        if '?' in word:
            commandq.put( (resultq, Lakeshore_370.query, (word,)) )
        else:
            commandq.put( (resultq, Lakeshore_370.write, (word,)) )
    else:
        return None
    xx = resultq.get()
    if xx == None:
        xx = ''
    resultq.task_done()
    ss.mysend(xx.encode('utf_8'))
    ss.sock.close()
    return word
Ejemplo n.º 4
0
def RunCommand(sock,resultq):
    ss = MySocket(sock)
    word = ss.myreceive()
    word = word.decode('utf_8')
    commandq.put( (resultq, Triton.query, (word,)) )
    xx = resultq.get()
    resultq.task_done()
    ss.mysend(xx.encode('utf_8'))
    ss.sock.close()
    return word
Ejemplo n.º 5
0
 def RunCommand(sock, resultq):
     ss = MySocket(sock)
     word = ss.myreceive()
     word = word.decode('utf_8')
     commandq.put((resultq, Triton.query, (word, )))
     xx = resultq.get()
     resultq.task_done()
     ss.mysend(xx.encode('utf_8'))
     ss.sock.close()
     return word
Ejemplo n.º 6
0
 def query(self,mystr):
     s = MySocket()
     s.sock.connect((self.addr, self.port))
     if self.verb:
         print(mystr)
     s.mysend(mystr.encode('utf_8'))
     word = s.myreceive()
     word = word.decode('utf_8')
     if self.verb:
         print(word)
     s.sock.close()
     return word
Ejemplo n.º 7
0
def GetTemperature(sock,mylogfolder):
    now = datetime.datetime.now()
    foldername = GetCurrentLogFolder(mylogfolder)
    foldername = mylogfolder + '/' + foldername
    foldername = os.path.normpath(foldername)
    path = foldername + '\\*3He Head.log'
    path = os.path.normpath(path)
    path = glob.glob(path)
    filename = path[0]   
    myfile = open(filename,'rb')
    ss = MySocket(sock)
    word = tail(myfile,2)
    word = word.split('\t')[1]
    ss.mysend(word.encode('utf_8'))
    now = datetime.datetime.today()
    try:
        T = float(word)
    except ValueError as err:
        print(err)
        T = -1.
    print("Temperature sent at %s, T = %f K" % (now.strftime('%y-%m-%d %H:%M:%S'),T))
    ss.sock.close()
Ejemplo n.º 8
0
def GetTemperature(sock, mylogfolder):
    now = datetime.datetime.now()
    foldername = GetCurrentLogFolder(mylogfolder)
    foldername = mylogfolder + '/' + foldername
    foldername = os.path.normpath(foldername)
    path = foldername + '\\*3He Head.log'
    path = os.path.normpath(path)
    path = glob.glob(path)
    filename = path[0]
    myfile = open(filename, 'rb')
    ss = MySocket(sock)
    word = tail(myfile, 2)
    word = word.split('\t')[1]
    ss.mysend(word.encode('utf_8'))
    now = datetime.datetime.today()
    try:
        T = float(word)
    except ValueError as err:
        print(err)
        T = -1.
    print("Temperature sent at %s, T = %f K" %
          (now.strftime('%y-%m-%d %H:%M:%S'), T))
    ss.sock.close()