Skip to main content
Info Contains Python APIs for interacting with RFmx VNA Product.
Author National Instruments

Table of Contents

About

The nirfmx-python repository generates Python bindings (Application Programming Interface) for interacting with the RFmx Products.

nirfmx-python follows Python Software Foundation support policy for different versions.

RFmx Instr Python API Status

Item Details
Driver Version Tested 2026 Q3
Supported Python Versions Python 3.9+ (64-bit)
Documentation RFmx Instr Docs

RFmx VNA Python API Status

Item Details
Driver Version Tested 2026 Q3
Supported Python Versions Python 3.9+ (64-bit)
Documentation RFmx VNA Docs

Documentation

You can find the latest API documentation for the nirfmx-python package on Read the Docs

Refer to the RFmx User Manual for an overview of RFmx, system requirements, troubleshooting, key concepts, etc.

Operating System Support

nirfmx-python supports Windows systems where the supported drivers are installed. Refer to NI Hardware and Operating System Compatibility for which versions of the driver support your hardware on a given operating system.

Installation

You can use pip to download nirfmxvna and install it.

$ python -m pip install nirfmxvna

To also install gRPC support for remote NI gRPC Device Server communication:

$ python -m pip install "nirfmxvna[grpc]"

Upgrade

You can use pip to upgrade nirfmxvna package using following command:

$ python -m pip install nirfmxvna --upgrade

License

This project is licensed under the MIT License. While the source code is not publicly released, the license permits binary distribution with attribution.

Note: This Python driver depends on several third-party components that are subject to separate commercial licenses. Users are responsible for ensuring they have the appropriate rights and licenses to use those dependencies in their environments.

gRPC Features

For driver APIs that support it, passing a GrpcSessionOptions instance as a parameter to nirfmxinstr.Session.init() is subject to the NI General Purpose EULA.

SSL/TLS Support

The server supports both server-side TLS and mutual TLS. Security configuration is accomplished by setting the server_cert, server_key and root_cert values in the server's configuration file. The server expects the certificate files specified in the configuration file to exist in a certs folder that is located in the same directory as the configuration file being used by the server. For more detailed information on SSL/TLS support refer to the Server Security Support wiki page.

Support and Feedback

For support with Python API, hardware, the driver runtime or any other questions, please visit NI Community Forums.

RFmxVNA Example

import nirfmxinstr
import nirfmxvna
import numpy

instr_session = None
vna_signal = None

try:
  # Create a new RFmx Session
  instr_session = nirfmxinstr.Session(resource_name, option_string)

  # Get VNA signal configuration
  vna_signal = instr_session.get_vna_signal_configuration()

  instr_session.configure_frequency_reference(
    "", frequency_reference_source, frequency_reference_frequency
  )

  vna_signal.set_sweep_type("", sweep_type)
  vna_signal.set_start_frequency("", start_frequency)
  vna_signal.set_stop_frequency("", stop_frequency)
  vna_signal.set_number_of_points("", frequency_points)
  vna_signal.set_if_bandwidth("", if_bandwidth)

  port_selector_string = nirfmxvna.Vna.build_port_string("", "port1")
  vna_signal.set_power_level(port_selector_string, port1_power_level)
  vna_signal.set_test_receiver_attenuation(
    port_selector_string, port1_test_receiver_attenuation
  )

  port_selector_string = nirfmxvna.Vna.build_port_string("", "port2")
  vna_signal.set_power_level(port_selector_string, port2_power_level)
  vna_signal.set_test_receiver_attenuation(
    port_selector_string, port2_test_receiver_attenuation
  )

  vna_signal.set_averaging_enabled("", averaging_enabled)
  vna_signal.set_averaging_count("", averaging_count)

  vna_signal.select_measurements("", measurement, enable_all_traces)

  vna_signal.waves.configuration.set_number_of_waves("", number_of_waves)

  for i in range(number_of_waves):
    wave_selector_string = nirfmxvna.Vna.build_wave_string("", i)
    vna_signal.waves.configuration.configure_wave(wave_selector_string, waves[i])
    vna_signal.waves.configuration.set_format(wave_selector_string, waves_formats[i])

  vna_signal.waves.configuration.set_magnitude_units("", magnitude_units)
  vna_signal.waves.configuration.set_phase_trace_type("", phase_trace_type)

  vna_signal.initiate("", "")

  # Retrieve results
  number_of_waves_result, _ = vna_signal.waves.configuration.get_number_of_waves("")

  waves_x_data_result, _ = vna_signal.waves.results.fetch_x_data("", timeout)

  waves_y1_data_result = []
  waves_y2_data_result = []

  for i in range(number_of_waves_result):
    wave_selector_string = nirfmxvna.Vna.build_wave_string("", i)

    y1_data, y2_data, error_code = vna_signal.waves.results.fetch_y_data(
      wave_selector_string, timeout
    )

    waves_y1_data_result.append(y1_data)
    waves_y2_data_result.append(y2_data)

except Exception as e:
  print(f"Error occurred: {e}")
  sys.exit(1)

finally:
  if vna_signal is not None:
    vna_signal.dispose()
    vna_signal = None
  if instr_session is not None:
    instr_session.close()
    instr_session = None

Numpy array size handling in RFmx APIs

The numpy arrays are passed in pre-allocated. If the pre allocated array size does not match the actual array size returned by the measurement, the array is automatically resized to fit the data, which may invalidate the previously created view. Passing an empty array (size 0) is fine; it will be resized as needed.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nirfmxvna-26.5.0-py3-none-any.whl (282.9 kB view details)

Uploaded Python 3

File details

Details for the file nirfmxvna-26.5.0-py3-none-any.whl.

File metadata

  • Download URL: nirfmxvna-26.5.0-py3-none-any.whl
  • Upload date:
  • Size: 282.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nirfmxvna-26.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06f89c79acc1077b67a57be98b84eefae9614f2ce53148b901e23b5d85e38443
MD5 3893943b7ef39ecabb1b0798e39f46dd
BLAKE2b-256 33311552f37280f2d48ccc3696c1a768f415f903b3dbb7840f02fc74eea002f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirfmxvna-26.5.0-py3-none-any.whl:

Publisher: Publish-Package.yml on ni/nirfmx-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

26.5.0 This release

1 file

26.3.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page