CONNECTION_33510B
Python Code
from flojoy import VisaDevice, flojoy, DataContainer
from flojoy.connection_manager import DeviceConnectionManager
from typing import Optional
from qcodes.instrument_drivers.Keysight import Keysight33512B
from usb.core import USBError
@flojoy()
def CONNECTION_33510B(
device: VisaDevice,
default: Optional[DataContainer] = None,
) -> Optional[DataContainer]:
"""Connect Flojoy to a 33510B function generator.
The connection is made with the VISA address in the Flojoy UI.
This node should also work with compatible Keysight 33XXX wavefunction
generators (although they are untested).
Parameters
----------
device: VisaDevice
The VISA address to connect to.
Returns
-------
DataContainer
Optional: None
"""
try:
ks = Keysight33512B(
"ks",
device.get_id(),
visalib="@py",
device_clear=False,
)
except USBError as err:
raise Exception(
"USB port error. Trying unplugging+replugging the port."
) from err
DeviceConnectionManager.register_connection(device, ks)
return None
Example App
In this example, we turn the wavefunction generation of a Keysight 33510B on.
We must first add the CONNECTION_33510B
node. This will create the connection to the instrument at the beginning of the app. To allow this we must set the VISA address
for this (and all subsequent 33510B
nodes). If the address does not appear in the parameters you may have to press REFRESH
in the HARDWARE MANAGER
tab.
We add two ON_OFF_33510B
nodes as well as the TEXT_VIEW
node to view the summary of the changes for each one. For the two ON_OFF_33510B
we change the channel parameter (to ch1
and ch2
) to as well as changing on_off
. The node simply turns the wavefunction generation on or off for the chosen channel. In this example we turn Channel 1 (ch1
) off and Channel 2 (ch2
) on.