Skip to main content

Python APIs for interacting with RFmx NR Product

Project description

Info Contains Python APIs for interacting with RFmx NR 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 Q2
Supported Python Versions Python 3.9+ (64-bit)
Documentation RFmx Instr Docs

RFmx NR Python API Status

Item Details
Driver Version Tested 2026 Q2
Supported Python Versions Python 3.9+ (64-bit)
Documentation RFmx NR 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 nirfmxnr and install it.

$ python -m pip install nirfmxnr

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.

RFmxNR Example

import nirfmxinstr
import nirfmxnr
import numpy

instr_session = None
nr = None

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

    # Get NR signal
    nr = instr_session.get_nr_signal_configuration()

    # Configure measurement
    instr_session.configure_frequency_reference(selector_string="",
        frequency_reference_source="OnboardClock", frequency_reference_frequency=10.0e6)
    nr.set_selected_ports(selector_string="", value="")
    nr.configure_rf(selector_string="", center_frequency=3.5e9, reference_level=0.0,
        external_attenuation=0.0)
    nr.configure_iq_power_edge_trigger(
        selector_string="",
        iq_power_edge_trigger_source="0",
        iq_power_edge_trigger_slope=nirfmxnr.IQPowerEdgeTriggerSlope.RISING_SLOPE,
        iq_power_edge_trigger_level=-20.0,
        trigger_delay=0.0,
        trigger_minimum_quiet_time_mode=nirfmxnr.TriggerMinimumQuietTimeMode.AUTO,
        trigger_minimum_quiet_time_duration=8.0e-6,
        iq_power_edge_trigger_level_type=nirfmxnr.IQPowerEdgeTriggerLevelType.RELATIVE,
        enable_trigger=False,
    )
    nr.set_link_direction(selector_string="", value=nirfmxnr.LinkDirection.UPLINK)
    nr.set_frequency_range(selector_string="", value=nirfmxnr.FrequencyRange.RANGE1)
    nr.component_carrier.set_bandwidth(selector_string="", value=100e6)
    nr.component_carrier.set_bandwidth_part_subcarrier_spacing(selector_string="",
        value=30e3)
    nr.select_measurements(selector_string="", measurements=nirfmxnr.MeasurementTypes.CHP,
        enable_all_traces=True)
    nr.chp.configuration.configure_sweep_time(selector_string="",
        sweep_time_auto=nirfmxnr.ChpSweepTimeAuto.TRUE, sweep_time_interval=1.0e-3)
    nr.chp.configuration.configure_averaging(selector_string="",
        averaging_enabled=nirfmxnr.ChpAveragingEnabled.FALSE, averaging_count=10,
        averaging_type=nirfmxnr.ChpAveragingType.RMS)
    nr.initiate(selector_string="", result_name="")

    # Retrieve results
    absolute_power, relative_power, error_code = (
        nr.chp.results.component_carrier.fetch_measurement(
            selector_string="", 
            timeout=10.0
        )
    )
    spectrum = numpy.empty(0, dtype=numpy.float32)
    nr.chp.results.fetch_spectrum(selector_string="", timeout=10.0, spectrum=spectrum)

    # Print results
    print(f"Absolute Power (dBm)     : {absolute_power}")
    print(f"Relative Power (dB)      : {relative_power}\n")

except Exception as e:
    print("ERROR: " + str(e))

finally:
    # Close Session
    if nr is not None:
        nr.dispose()
        nr = 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.

nirfmxnr-26.3.0-py3-none-any.whl (332.3 kB view details)

Uploaded Python 3

File details

Details for the file nirfmxnr-26.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for nirfmxnr-26.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7e5d45d1d15c5d416184c51543972c2f30b9544960bf0ae991026e821604cb6
MD5 4a96ae09b7a44d8d5aab493d84047045
BLAKE2b-256 b832a55798d357d07d74f05a95cd7f332312f489f332c0de9ef6622e9ac7e9f1

See more details on using hashes here.

Provenance

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

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