Ejemplo n.º 1
0
    def query_output(self):
        """        
        DESCRIPTION
        ================
        This function queries the RF output status.
        
        ARGUMENTS
        ================
        Nothing.

        RETURNS
        ================
        1. onoff: RF output ON/OFF
            Type: int (1: ON, 0: OFF)
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('OUTP?')
        ret = self.com.readline()
        self.com.close()
        ret = int(ret)
        return ret
  
#written by K.Urushihara
# 2017/08/29 T.Inaba: delete sys.path for pymeasure
 def __init__(self, IP='', GPIB=1, connection='GPIB'):
     self.IP = IP
     self.GPIB = GPIB
     if connection == 'GPIB':
         self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
     elif connection == 'LAN':
         self.com = pymeasure.ethernet(self.IP, self.GPIB)
Ejemplo n.º 3
0
    def query_average_onoff(self):
        """
        DESCRIPTION
        ================
        This function queries the averaging mode.

        ARGUMENTS
        ================
        Nothing.

        RETURNS
        ================
        1. onoff: averaging mode
            Number: 0 or 1
            Type: int
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('STATUS')
        ret = self.com.readline()
        if ret[17] == '0':
            ret = 0
        else:
            ret = 1
        self.com.close()
        return ret
Ejemplo n.º 4
0
    def set_average_onoff(self, onoff, sensor='A'):
        """
        DESCRIPTION
        ================
        This function switches the averaging mode.

        ARGUMENTS
        ================
        1. onoff: averaging mode
            Number: 0 or 1
            Type: int
            Default: Nothing.

        2. sensor: averaging sensor.
            Number: 'A' or 'B'
            Type: string
            Default: 'A'

        RETURNS
        ================
        Nothing.
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        if onoff == 1:
            self.com.send('AVG %s, RPT, 60' %(sensor))
        else:
            self.com.send('AVG %s, OFF, 60' %(sensor))
        self.com.close()
        return
Ejemplo n.º 5
0
    def measure(self, ch=1, resolution=3):
        """
        DESCRIPTION
        ================
        This function queries the input power level.

        ARGUMENTS
        ================
        1. ch: the sensor channel number.
            Number: 1-2
            Type: int
            Default: 1
        2. resolution: the sensor order of the resolution.
            Number: 1-3
            Type: int
            Default: 3

        RETURNS
        ================
        1. power: the power value [dBm]
            Type: float
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('CHUNIT %d, DBM' %(ch))
        self.com.send('CHRES %d, %d' %(ch, resolution))
        self.com.send('o %d' %(ch))
        time.sleep(0.1)
        ret = self.com.readline()
        self.com.close()
        power = float(ret)
        return power
Ejemplo n.º 6
0
 def __init__(self):
     com1 = pymeasure.ethernet('192.168.40.31', 1234)
     com2 = pymeasure.ethernet('192.168.40.32', 1234)
     
     elva100 = pymeasure.ELVA1.GPDVC15_100
     elva200 = pymeasure.ELVA1.GPDVC15_200
     
     att = [(elva100, com1, 4),
            (elva100, com1, 5),
            (elva200, com1, 6),
            (elva200, com1, 7),
            (elva100, com1, 8),
            (elva100, com1, 9),
            (elva100, com1, 10),
            (elva100, com1, 11),]
     
     self.att = []
     for _att, _host, _gpib in att:
         gpib = pymeasure.gpib_prologix(_host, _gpib)
         self.att.append(_att(gpib))
         continue
         
     self.bias_set(0)
     self.bias_get()
     pass
Ejemplo n.º 7
0
    def set_average_count(self, count, sensor='A'):
        """
        DESCRIPTION
        ================
        This function sets the averaging counts.

        ARGUMENTS
        ================
        1. count: averaging counts
            Type: int
            Default: Nothing.

        2. sensor: averaging sensor.
            Number: 'A' or 'B'
            Type: string
            Default: 'A'

        RETURNS
        ================
        Nothing.
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('AVG %s, RPT, %d' %(sensor, count))
        self.com.close()
        return
Ejemplo n.º 8
0
    def set_output(self, onoff=0):
        """        
        DESCRIPTION
        ================
        This function switches the RF output.
        
        ARGUMENTS
        ================
        1. onoff: RF output ON/OFF
            Number: 1 or 0
            Type: int (1: ON, 0: OFF)
            Default: 0

        RETURNS
        ================
        Nothing.
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        if onoff==1:
            self.com.send('OUTP ON')
        else:
            self.com.send('OUTP OFF')
        self.com.close()
        return
Ejemplo n.º 9
0
    def __init__(self):
        com1 = pymeasure.ethernet('192.168.40.31', 1234)
        com2 = pymeasure.ethernet('192.168.40.32', 1234)

        elva100 = pymeasure.ELVA1.GPDVC15_100
        elva200 = pymeasure.ELVA1.GPDVC15_200

        att = [
            (elva100, com1, 4),
            (elva100, com1, 5),
            (elva200, com1, 6),
            (elva200, com1, 7),
            (elva100, com1, 8),
            (elva100, com1, 9),
            (elva100, com1, 10),
            (elva100, com1, 11),
        ]

        self.att = []
        for _att, _host, _gpib in att:
            gpib = pymeasure.gpib_prologix(_host, _gpib)
            self.att.append(_att(gpib))
            continue

        self.bias_set(0)
        self.bias_get()
        pass
Ejemplo n.º 10
0
def GPIB_search(IP, sport=0, eport=30):
    '''
    DESCRIPTION
    ================
    This function searches the GPIB port responding to '*IDN?'

    ARGUMENTS
    ================
    1. IP: IP adress
        Type: string
    2. sport: searching start port
        Number: 0 -- 30
        Type: int
    3. eport: searching stop port
        Number: 0 -- 30
        Type: int

    RETURNS
    ================
    Nothing.
    '''
    for i in range(sport, eport + 1, 1):
        com = pymeasure.gpib_prologix(IP, i)
        try:
            com.open()
            com.send('*IDN?')
            ret = com.readline()
            com.close()
        except Exception:
            sys.stdout.write('\rtest port: %d' % i)
            sys.stdout.flush()
        else:
            print('  (o _ o)!!! ')
            print('port = ' + str(i))
            print(ret)
Ejemplo n.º 11
0
 def __init__(self, ch=1, resolution=3):
     self.IP = IP
     self.GPIB = GPIB
     self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
     self.com.open()
     self.com.send('CHUNIT %d, DBM' % (ch))
     self.com.send('CHRES %d, %d' % (ch, resolution))
Ejemplo n.º 12
0
    def set_freq(self, freq, unit='GHz'):
        """        
        DESCRIPTION
        ================
        This function sets the CW frequency.
        
        ARGUMENTS
        ================
        1. freq: CW frequency
            Number: 0.00025-20.0 [GHz]
            Type: float
            Default: nothing
        2. unit: unit of the CW frequency 
            Number: 'GHz', 'MHZ', 'KHZ', 'HZ'
            Type: string
            Default: 'GHz'

        RETURNS
        ================
        Nothing.
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('FREQ:CW %.10f %s'%(freq, unit))
        self.com.close()
        return
Ejemplo n.º 13
0
    def set_power(self, power=-20.0):
        """        
        DESCRIPTION
        ================
        This function sets the CW power level.
        
        ARGUMENTS
        ================
        1. power: CW power level
            Number: -20.0-30.0 [dBm]
            Type: float
            Default: -20.0 [dBm]

        RETURNS
        ================
        Nothing.
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        if -20.0<=power<=30.0:
            self.com.open()
            self.com.send('POW %f dBm'%(power))
            self.com.close()
        else:
            print('!!!!ERROR!!!!')
            print('You set invalid power level.')
            print('-20.0 <= power <= +30.0.')
        return
Ejemplo n.º 14
0
 def __init__(self, initialize=False):
     com = pymeasure.gpib_prologix('192.168.40.33', 30)
     self.tm = pymeasure.Lakeshore.model218(com)
     
     if initialize:
         self.set_diode_type()
         self.set_temp_curves()
         pass
     
     self.init_curve_fit_params()
     pass
Ejemplo n.º 15
0
    def __init__(self):
        host = rospy.get_param("~host")
        gpibport = rospy.get_param("~gpibport")
        com = pymeasure.gpib_prologix(host, gpibport)

        self.pm = pymeasure.Anritsu.ml2437a(com)

        #ave_onoff = rospy.get_param("~ave_onoff")
        #ave_num = rospy.get_param("~ave_num")
        #self.pm.set_average_onoff(ave_onoff)
        #self.pm.set_average_count(ave_num)
        com.send("AVG A, OFF,")
Ejemplo n.º 16
0
 def __init__(self, IP='192.168.100.1', port=5025, connection='GPIB'):
     self.IP = IP
     self.port = port
     if connection == 'GPIB':
         self.com = pymeasure.gpib_prologix(self.IP, self.port)
     elif connection == 'LAN':
         self.com = pymeasure.ethernet(self.IP, self.port)
     else:
         print('!!!!ERROR!!!!\n'
               'INVALID CONNECTION: {}\n'
               'AVAILABLE: "GPIB" or "LAN"\n'.format(connection))
     return
    def measure(self, ch=1, resolution=3):
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('CHUNIT %d, DBM' % (ch))
        self.com.send('CHRES %d, %d' % (ch, resolution))
        self.com.send('o %d' % (ch))
        time.sleep(0.1)
        ret = self.com.readline()
        self.com.close()
        power = float(ret)

        return power
Ejemplo n.º 18
0
    def __init__(self, IP='192.168.100.1', port=5025, connection='GPIB'):
        self.IP = IP
        self.port = port

        if connection == 'GPIB':
            self.com = pymeasure.gpib_prologix(self.IP, self.port)
            self.com.open()
            # time.sleep(0.5)

        elif connection == 'LAN':
            self.com = pymeasure.ethernet(self.IP, self.port)
            self.com.open()
            # time.sleep(0.5)
        return
Ejemplo n.º 19
0
    def query_output(self):
        """        
        DESCRIPTION
        ================
        This function queries the RF output status.
        
        ARGUMENTS
        ================
        Nothing.

        RETURNS
        ================
        1. onoff: RF output ON/OFF
            Type: int (1: ON, 0: OFF)
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('OUTP?')
        ret = self.com.readline()
        self.com.close()
        ret = int(ret)
        return ret
Ejemplo n.º 20
0
 def gpib_address_search(self):
     print('GPIB Address Searching...')
     for i in range(31):
         sys.stdout.write('\r try address %d ...   '%(i))
         sys.stdout.flush()
         com = pymeasure.gpib_prologix(self.com.com.host, i)
         try:
             com.com.timeout = 1.2
             com.open()
             com.send('*IDN?')
             com.readline()
         except socket.timeout:
             com.close()
             sys.stdout.write('\x08\x08NG')
             sys.stdout.flush()
             time.sleep(0.1)
             continue
         sys.stdout.write('\x08\x08OK\n')
         sys.stdout.flush()
         com.close()
         return i
     return
Ejemplo n.º 21
0
    def query_freq(self):
        """        
        DESCRIPTION
        ================
        This function queries the CW frequency.
        
        ARGUMENTS
        ================
        Nothing.

        RETURNS
        ================
        1. freq: current CW frequency
            Type: float [GHz]
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('FREQ:CW?')
        ret = self.com.readline()
        self.com.close()
        freq = float(ret)/1e+9
        return freq
Ejemplo n.º 22
0
    def query_average_count(self):
        """
        DESCRIPTION
        ================
        This function queries the averaging counts.

        ARGUMENTS
        ================
        Nothing.

        RETURNS
        ================
        1. count: averaging counts
            Type: int
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('STATUS')
        ret = self.com.readline()
        count = int(ret[19:23])
        self.com.close()
        return count
Ejemplo n.º 23
0
    def query_power(self):
        """        
        DESCRIPTION
        ================
        This function queries the CW power level.
        
        ARGUMENTS
        ================
        Nothing.

        RETURNS
        ================
        1. power: current CW power level
            Type: float [dBm]
        """
        self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
        self.com.open()
        self.com.send('POW?')
        ret = self.com.readline()
        self.com.close()
        power = float(ret)
        return power
Ejemplo n.º 24
0
 def gpib_address_search(self):
     print('GPIB Address Searching...')
     for i in range(31):
         sys.stdout.write('\r try address %d ...   '%(i))
         sys.stdout.flush()
         com = pymeasure.gpib_prologix(self.com.com.host, i)
         try:
             com.com.timeout = 1.2
             com.open()
             com.send('*IDN?')
             com.readline()
         except socket.timeout:
             com.close()
             sys.stdout.write('\x08\x08NG')
             sys.stdout.flush()
             time.sleep(0.1)
             continue
         sys.stdout.write('\x08\x08OK\n')
         sys.stdout.flush()
         com.close()
         return i
     return
Ejemplo n.º 25
0
class a11713a:
    com = pymeasure.gpib_prologix("172.20.0.16", 8)

    def attenuator(self, IF1=11, IF2=11):
        """
        This command sets the attenuation.
        
        Args
        ====
        < IF1, IF2 : int : 0-11 >
            Attenuation value
            default = 11
        
        Returnes
        ========
        Nothing.
        
        Examples
        ========
        >>> at.attenuator(5, 5)
        >>> at.attenuator()
        """
        table1 = [
            'B1234', 'A1B234', 'A2B134', 'A12B34', 'A3B124', 'A13B24',
            'A23B14', 'A123B4', 'A34B12', 'A134B2', 'A234B1', 'A1234'
        ]
        table2 = [
            'B5678', 'A5B678', 'A6B578', 'A56B78', 'A7B568', 'A57B68',
            'A67B58', 'A567B8', 'A78B56', 'A578B6', 'A678B5', 'A5678'
        ]
        self.com.open()
        self.com.send(table1[IF1] + table2[IF2])
        f = open('/home/amigos/NECRX_system/device_cntrl/latest.txt', 'w')
        f.write(str(IF1) + ',' + str(IF2))
        f.close()
        return
Ejemplo n.º 26
0
 def __init__(self, IP='192.168.100.1', GPIB=1):
     self.IP = IP
     self.GPIB = GPIB
     self.com = pymeasure.gpib_prologix(self.IP, self.GPIB)
Ejemplo n.º 27
0
import pymeasure

com = pymeasure.gpib_prologix('192.168.40.33', 30)
m = pymeasure.Lakeshore.model218(com)

all_ch = range(1, 9)

# alarm_query
# -----------
for i in all_ch:
    m.alarm_query(i)
    continue

m.alarm_query_all()

# alarm_set
# ---------
a = m.alarm_query(8)
m.alarm_set(8, 1, 1, 300, 100, 1, 0)
m.alarm_query(8)
m.alarm_set(8, *a)
m.alarm_query(8)

# alarm_status_query
# ------------------
for i in all_ch:
    m.alarm_status_query(1)
    continue

m.alarm_status_query_all()
Ejemplo n.º 28
0
import pymeasure

com = pymeasure.gpib_prologix('192.168.40.33', 30)
m = pymeasure.Lakeshore.model218(com)

all_ch = range(1, 9)


# alarm_query
# -----------
for i in all_ch:
    m.alarm_query(i)
    continue

m.alarm_query_all()

# alarm_set
# ---------
a = m.alarm_query(8)
m.alarm_set(8, 1, 1, 300, 100, 1, 0)
m.alarm_query(8)
m.alarm_set(8, *a)
m.alarm_query(8)

# alarm_status_query
# ------------------
for i in all_ch:
    m.alarm_status_query(1)
    continue
Ejemplo n.º 29
0
 def __init__(self):
     host = rospy.get_param("~host")
     gpibport = rospy.get_param("~gpibport")
     self.com = pymeasure.gpib_prologix(host, gpibport)
     self.com.open()