def test_use_separate_VISAAdapter(): """As a user, I want to be able to supply my own VISAAdpter with my settings """ # User can use their own VISAAdapter ser = VISAAdapter('ASRL1::INSTR', baud_rate=1200, visa_library='@sim') instr = MultiprotocolInstrument(ser) # don't need visa_library here as this does not go to pyvisa, kwargs are ignored if provided assert instr.adapter.connection.baud_rate == 1200
def __init__(self, resourceName, **kwargs): adapter = VISAAdapter(resourceName, read_termination='\n') super(ami430, self).__init__(adapter, "AMI superconducting magnet power supply.", includeSCPI=True, **kwargs) # Read twice in order to remove welcome/connect message self.read() self.read()
def startup(self): """ Connect to source and configure voltage sweep :return: """ log.info("Connecting and configuring the picoammeter ...") adapter = VISAAdapter("GPIB0::22::INSTR", visa_library='@py', query_delay=0.1) self.picoammeter = Keithley6487(adapter) self.picoammeter.reset() self.picoammeter.configure_sweep(self.start, self.stop, self.step, self.delay, self.nplc, self.polarity) log.info("Picoammeter configuration complete.") log.info("Connecting to power supply and configuring") adapter = VISAAdapter("GPIB0::6::INSTR", visa_library='@py') self.power_supply = E364A(adapter) self.power_supply.reset() self.power_supply.apply(5, self.source_current / 1e3) self.power_supply.enabled = "OFF"
def startup(self): """ Connect to source and configure voltage sweep :return: """ log.info("Connecting and configuring the instrument ...") adapter = VISAAdapter("GPIB0::22::INSTR", query_delay=0.1) self.picoammeter = Keithley6487(adapter) self.picoammeter.reset() self.picoammeter.configure_sweep(self.start, self.stop, self.step, self.delay, 1, self.polarity) log.info("Configuration complete.")
'POLL_FREQ': POLL_FREQ, 'LCR_USB_ADDRESS': LCR_USB_ADDRESS, 'ARDUINO_PORT': ARDUINO_PORT, 'MUX_SELECT_PINS': MUX_SELECT_PINS, 'MUX_SIG_PIN': MUX_SIG_PIN} # TODO: change way we handle the input channels muxInputChannels = [0, 1, 2] # ----------------------------------------------# # initialize the multiplexer board through pyFirmata mux = Mux(config) # pin2 = mux.board.get_pin('d:2:o') # setup the LCR adapter = VISAAdapter("USB0::0x0957::0x0909::MY54202935::INSTR") lcr = AgilentE4980(adapter) print("LCR connected.") # TODO: make new LCR class to make this process cleaner lcr.reset() lcr.aperture(LCR_MEAS_TIME) # set measurement time lcr.frequency = LCR_AC_FREQUENCY # set AC signal frequency lcr.ac_voltage = LCR_AC_VOLTAGE # set AC signal voltage # initialize lists to store data timeOut = [] ROut = [] LOut = [] COut = []
def test_visa_version(): assert VISAAdapter.has_supported_version()
def make_visa_adapter(**kwargs): return VISAAdapter(SIM_RESOURCE, visa_library='@sim', **kwargs)
if polarity == 'Cathode': self.write('SOUR:VOLT:SWE:STOP {:0.1f}'.format(stop)) self.write('SOUR:VOLT:SWE:STEP {:0.2f}'.format(step)) self.write('SOUR:VOLT:SWE:DEL {:0.3f}'.format(delay / 1e3)) self.write('FORM:ELEM ALL') # Include all elements in the trace data self.write('FORM:SREG ASC' ) # Set output format of status register to ascii (decimal) self.write('ARM:COUN {:d}'.format(int(abs((stop - start) / step) + 1))) def start_sweep(self): self.write("SOUR:VOLT:SWE:INIT") self.write("INIT") def sweep_state(self): self.write("*CLS") try: resp = int(self.ask("*STB?")) resp = resp & 0x80 except: resp = 1 return resp if __name__ == "__main__": from pymeasure.adapters import VISAAdapter adapter = VISAAdapter("GPIB0::22::INSTR", '@py') ammeter = Keithley6487(adapter) ammeter.reset()