Skip to content

Connecting to NI PXIe-2597 by National Instruments in Python

Instrument Card

26.5 GHz, 50 Ω, 6x1 (SP6T) Terminated PXI RF Multiplexer Switch Module—The PXI‑2597 is ideal for passing high-order harmonics from PXI RF Signal Upconverter modules or routing multiple sources to PXI RF Signal Downconverter modules. The internal termination of the PXI‑2597 helps prevent high-power reflections that arise from open channels on the module. You can use the PXI‑2597 onboard relay count tracking feature to predict relay lifetime and reduce unexpected system downtime.

NI PXIe-2597

Device Specification: here

Manufacturer card: NATIONAL INSTRUMENTS

NATIONAL INSTRUMENTS

A producer of automated test equipment and virtual instrumentation software. Common applications include data acquisition, instrument control and machine vision.

  • Headquarters: Austin, Texas, USA
  • Yearly Revenue (millions, USD): 1657
  • Vendor Website: here

Connect to the NI PXIe-2597 in Python

PROTOCOLS > SCPI

To connect to a NI PXIe-2597 Multiplexer Switch Module using Qcodes Community, you can use the following Python script:

from qcodes.instrument.base import Instrument
from qcodes.utils.validators import Enum
class NI_PXIe_2597(Instrument):
def __init__(self, name, resource, **kwargs):
super().__init__(name, **kwargs)
self.add_parameter(name="channel",
get_cmd=self._get_channel,
set_cmd=self._set_channel,
vals=Enum(*tuple(["ch1", "ch2", "ch3", "ch4", "ch5", "ch6", None])),
post_delay=1,
docstring='Name of the channel where the common "com" port is connected to',
label=f"{self.short_name} active channel")
def _set_channel(self, name_to_connect):
if name_to_connect is None:
print("Disconnecting from all channels")
else:
print(f"Connecting to channel {name_to_connect}")
def _get_channel(self):
return "ch1"
# Connect to the NI PXIe-2597 Multiplexer Switch Module
switch = NI_PXIe_2597(name="switch", resource="PXI0::0::INSTR")
# Set the active channel
switch.channel("ch2")
# Get the active channel
active_channel = switch.channel()
print(f"Active channel: {active_channel}")

This script defines a custom instrument class NI_PXIe_2597 that inherits from qcodes.instrument.base.Instrument. It adds a parameter channel to the instrument, which represents the active channel of the switch. The set_cmd method _set_channel is responsible for connecting/disconnecting the switch to/from the specified channel, and the get_cmd method _get_channel returns the active channel.

To use the script, you need to provide the appropriate name and resource parameters when creating an instance of the NI_PXIe_2597 class. In the example above, the instrument is named “switch” and the resource address is “PXI0::0::INSTR”. You can modify these values according to your setup.

After connecting to the instrument, you can set the active channel by calling switch.channel("ch2"), where “ch2” is the desired channel. To retrieve the active channel, you can call switch.channel(), which returns the current active channel.

Note: The script provided only demonstrates the basic usage of the instrument class and does not include the full functionality of the NI PXIe-2597 Multiplexer Switch Module.