Skip to main content

Python APIs for interacting with NI RFmx Instr Product

Project description

Info Contains Python APIs for interacting with NI RFmx Products.
Author National Instruments

Table of Contents

About

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

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

The following products are supported:

  • RFmx Instr (Python module: nirfmxinstr)
  • RFmx SpecAn (Python module: nirfmxspecan)

RFmx Instr Python API Status

Item Details
Driver Version Tested 2025 Q3
PyPI Package Version v19.1
Supported Python Versions Python 3.9+ (64-bit)
Documentation RFmx Instr Docs

RFmx SpecAn Python API Status

Item Details
Driver Version Tested 2025 Q3
PyPI Package Version v19.1
Supported Python Versions Python 3.9+ (64-bit)
Documentation RFmx SpecAn Docs

Documentation

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

Refer to the NI RFmx User Manual for an overview of NI 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 nirfmxinstr, nirfmxspecan and install it.

$ python -m pip install nirfmxspecan

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.

Support and Feedback

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

Example

import nirfmxinstr
import nirfmxspecan
import numpy

instr_session = None
specan = None

try:
  # Open a RFmx Session
  instr_session = nirfmxinstr.Session(resource_name="RFSA", option_string="")

  # Configure RFmx Session
  instr_session.configure_frequency_reference(selector_string="",
    frequency_reference_source="OnboardClock", frequency_reference_frequency=10.0e+6)

  # Create SpecAn Signal
  specan = instr_session.get_specan_signal_configuration()

  # Configure SpecAn Signal
  specan.set_selected_ports(selector_string="", value="")
  specan.configure_frequency(selector_string="", center_frequency=1e+9)
  specan.configure_reference_level(selector_string="", reference_level=0.0)
  specan.configure_external_attenuation(selector_string="", external_attenuation=0.0)

  # Select Spectrum Measurement
  specan.select_measurements(selector_string="",
    measurements=nirfmxspecan.MeasurementTypes.SPECTRUM, enable_all_traces=True)

  # Configure Spectrum Measurement
  specan.spectrum.configuration.configure_span(selector_string="", span=1.0e+6)
  specan.spectrum.configuration.configure_measurement_method(selector_string="",
    measurement_method=nirfmxspecan.SpectrumMeasurementMethod.NORMAL)

  specan.initiate(selector_string="", result_name="")

  # Retrieve Results
  spectrum = numpy.empty(0, dtype=numpy.float32)
  x0, dx, _ = specan.spectrum.results.fetch_spectrum(selector_string="", timeout=10.0, spectrum=spectrum)
  peak_amplitude, peak_frequency, frequency_resolution, error_code = (
    specan.spectrum.results.fetch_measurement(selector_string="", timeout=10.0))

  # Print Results
  print(f"Peak Amplitude (dBm)             {peak_amplitude}")
  print(f"Peak Frequency (Hz)              {peak_frequency}")

except nirfmxinstr.RFmxError as e:
  print("ERROR: " + str(e.description))

finally:
  # Dispose Signal & Session
  if specan is not None:
      specan.dispose()
      specan = None
  if instr_session is not None:
      instr_session.close()
      instr_session = None

Project details


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.

nirfmxinstr-25.5.1-py3-none-any.whl (101.5 kB view details)

Uploaded Python 3

File details

Details for the file nirfmxinstr-25.5.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for nirfmxinstr-25.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d077718753e87d46e8f159c047073e8bf7a7e2ba911545f6023c6fb8a5998c7
MD5 658224984ea064364a2a5192cf41e751
BLAKE2b-256 9d46336183d12e3adb898c1bfe145ab75c8ed3240c138032d064a10841179074

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirfmxinstr-25.5.1-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.

Supported by

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