def __init__(self, ip="10.25.124.252", gpib_address=10, loglevel=20): """ Connect to the power supply via Prologix GPIB connector This class is based on information provided by the AFG3021B Programmer Manual. For more information, please see AFG3000 Series Arbitrary/Function Generators Programmer Manual offered by Tecktronix. Keyword Args: ip (str): IP adress of the Prologix GPIB connector gpib_address (int): The GPIB address of the power supply connected to the Prologix connector """ try: gpib = PrologixGPIBEthernet(ip, timeout=15) gpib.connect() except OSError: raise ValueError( 'Connection to plx_gpib_ethernet failed, check connection!') try: gpib.select(gpib_address) except OSError: raise ValueError( 'Connection to plx_gpib_ethernet failed, check IP address!') self.logger = loggers.get_logger(loglevel) self.instrument = gpib
def __init__(self, prologix=False, gpib_addr=GPIB_ADDR_2520A): if not prologix: self.gpib = PrologixGPIBEthernet('192.168.1.128') self.gpib.connect() else: self.gpib = prologix self.gpib_addr = gpib_addr self.gpib.select(self.gpib_addr) self.gpib.write('*RST') assert '2520A' in self.gpib.query('*IDN?')
def __init__(self, prologix=False, gpib_addr=GPIB_ADDR_FSP30): if not prologix: self.gpib = PrologixGPIBEthernet('192.168.1.128') self.gpib.connect() else: self.gpib = prologix self.gpib_addr = gpib_addr self.gpib.select(self.gpib_addr) self.preset() pdb.set_trace() assert 'FSP-30' in self.gpib.query('*IDN?')
def __init__(self, ip="10.25.123.111", gpib_address=15, loglevel=20): """ Connect to the power supply via Prologix GPIB connector Keyword Args: ip (str): IP adress of the Prologix GPIB connector gpib_address (int): The GPIB address of the power supply connected to the Prologix connector """ gpib = PrologixGPIBEthernet(ip) gpib.connect() gpib.select(gpib_address) self.logger = loggers.get_logger(loglevel) self.instrument = gpib
def prologix_gpib_ethernet_provider(ip, gpib_addres): """ Provide a vxi11 compatible instrument which is accesible transparently through its ip. Args: ip (str): ip address of the controller gpib_address (str): gpib adress of the instrument Returns: vxi11.instrument """ instrument = PrologixGPIBEthernet(ip) gpib.connect() gpib.select(gpib_address) return gpib
def plx_with_mock_socket(): plx = PrologixGPIBEthernet('example.com') plx.socket = MockSocket('example.com', 1234) return plx, plx.socket
def test_it_uses_custom_timeout(): plx = PrologixGPIBEthernet('example.com', timeout=0.5) assert plx.timeout == 0.5
def test_it_has_default_timeout_of_1s(): plx = PrologixGPIBEthernet('example.com') assert plx.timeout == 1
def test_it_sets_host(): plx = PrologixGPIBEthernet('example.com') assert plx.host == 'example.com'
def test_it_uses_correct_port(): plx = PrologixGPIBEthernet('example.com') assert plx.PORT == 1234
from equipment.agilent_e4418b import AgilentE4418B if __name__ == '__main__': parser = argparse.ArgumentParser(description='scalar network analyzer') parser.add_argument('--cal', default=False, help='specify name of calibration file') parser.add_argument('--ddir', default='./data/', help='specify name of calibration file') parser.add_argument('filename', help='specify name of output file') args = parser.parse_args() prologix = PrologixGPIBEthernet('192.168.1.128', timeout=10) prologix.connect() meter = AgilentE4418B(prologix=prologix) synth = Gigatronics2520A(prologix=prologix) freqs = np.arange(1e9, 20.1e9, .25e9) synth.set_cw_power(0) synth.output_on() meas = np.empty_like(freqs) for (i, f) in enumerate(freqs): synth.set_cw_frequency(f) meas[i] = meter.read_power(f) print('f: {}, p: {}'.format(f / 1e9, meas[i]))
def test_it_raises_value_error_for_invalid_timeout(): for invalid_timeout in (1e-3 - 1e-12, 3 + 1e-12): with pytest.raises(ValueError): PrologixGPIBEthernet('example.com', timeout=invalid_timeout)