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)
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
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
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
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
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
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
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
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)
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))
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
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
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
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,")
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
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
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
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
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
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
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
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
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)
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()
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
def __init__(self): host = rospy.get_param("~host") gpibport = rospy.get_param("~gpibport") self.com = pymeasure.gpib_prologix(host, gpibport) self.com.open()