Last active
January 27, 2021 06:08
-
-
Save SamWolski/179dc233c18e8a2a5b1e1528e4f713ea to your computer and use it in GitHub Desktop.
Instrument interaction via pyVISA and/or Labber API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyvisa | |
visa_rm = pyvisa.ResourceManager() | |
## Access at the address may require enabling/configuring the interface on the instrument (S)FP | |
pxi_vna_addr = 'TCPIP0::<HOSTNAME>::hislip_PXI0_CHASSIS1_SLOT10_INDEX0::INSTR' | |
inst_vna = visa_rm.open_resource(pxi_vna_addr) | |
inst_vna.write('SYST:PRES') | |
inst_vna.close() | |
## No need to close the RM as it is not connected to anything unless told to | |
import Labber | |
serverClient = Labber.connectToServer('localhost') | |
instClient = serverClient.connectToInstrument('Agilent Network Analyzer CW', {'name': 'PXI_VNA'}) | |
instClient.setValue('Output enabled', 0) | |
# instClient.stopInstrument() # Turns off the driver in the Labber InstrumentServer | |
instClient.disconnectFromInstr() | |
serverClient.close() | |
## In this case we should close the open channels for safety | |
## Although you can probably get away with leaving the serverClient connection open |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment