Skip to main content

Python APIs for interacting with RFmx Pulse Product

Project description

Info Contains Python APIs for interacting with NI RFmx Pulse Product.
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.

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 Pulse Python API Status

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

$ python -m pip install nirfmxpulse

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

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

Upgrade

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

$ python -m pip install nirfmxpulse --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.

RFmxPulse Example

import nirfmxinstr
import nirfmxpulse
import numpy

instr_session = None
pulse = None

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

    # Get Pulse signal configuration
    pulse = instr_session.get_pulse_signal_configuration()

    # Configure measurement
    instr_session.configure_frequency_reference(
        selector_string="",
        frequency_reference_source="OnboardClock", 
        frequency_reference_frequency=10.0e6
    )
    pulse.configure_rf(
        selector_string="", 
        center_frequency=1.0e9, 
        reference_level=-10.0,
        external_attenuation=0.0
    )
    pulse.configure_iq_power_edge_trigger(
        selector_string="",
        iq_power_edge_source="0",
        iq_power_edge_slope=nirfmxpulse.IQPowerEdgeTriggerSlope.RISING,
        iq_power_edge_level=-20.0,
        trigger_delay=0.0,
        trigger_min_quiet_time_mode=nirfmxpulse.TriggerMinimumQuietTimeMode.AUTO,
        trigger_min_quiet_time_duration=5.0e-6,
        iq_power_edge_level_type=nirfmxpulse.IQPowerEdgeTriggerLevelType.RELATIVE,
        enable_trigger=True,
    )
    pulse.set_measurement_bandwidth(selector_string="", value=80.0e6)
    pulse.set_measurement_filter_type(
        selector_string="",
        value=nirfmxpulse.MeasurementFilterType.GAUSSIAN
    )
    pulse.set_acquisition_length(selector_string="", value=1.0e-3)
    pulse.select_measurements(
        selector_string="",
        measurements=nirfmxpulse.MeasurementTypes.PULSE, 
        enable_all_traces=True
    )

    # Configure Pulse Detection Settings
    pulse.pulse_measurement.configuration.set_detection_reference(
        selector_string="", value=nirfmxpulse.PulseDetectionReference.REFERENCE_LEVEL
    )
    pulse.pulse_measurement.configuration.set_detection_threshold(
        selector_string="", value=-20.0
    )
    pulse.pulse_measurement.configuration.set_detection_hysteresis(
        selector_string="", value=1.0
    )
    pulse.pulse_measurement.configuration.set_detection_minimum_off_duration(
        selector_string="", value=50.0e-9
    )
    pulse.pulse_measurement.configuration.set_level_computation_method(
        selector_string="", value=nirfmxpulse.PulseLevelComputationMethod.MEDIAN
    )
    pulse.pulse_measurement.configuration.set_metrics_enabled(
        selector_string="", value=nirfmxpulse.PulseMetricsEnabled.TRUE
    )
    pulse.initiate(selector_string="", result_name="")
    pulse.wait_for_measurement_complete(selector_string="", timeout=10.0)

    # Retrieve results
    pulse_count, _ = pulse.pulse_measurement.results.get_pulse_count(selector_string="")
    rise_time, _ = pulse.pulse_measurement.results.get_rise_time(selector_string="")
    fall_time, _ = pulse.pulse_measurement.results.get_fall_time(selector_string="")
    pulse_width, _ = pulse.pulse_measurement.results.get_pulse_width(selector_string="")
    top_level, _ = pulse.pulse_measurement.results.get_top_level(selector_string="")
    base_level, _ = pulse.pulse_measurement.results.get_base_level(selector_string="")
    average_on_level, _ = pulse.pulse_measurement.results.get_average_on_level(
        selector_string=""
    )
    # 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.
    amplitude = numpy.empty(0, dtype=numpy.float32)
    pulse.pulse_measurement.results.fetch_amplitude_trace(
        selector_string="", timeout=10.0, amplitude=amplitude
    )

    # Print results
    print(f"Pulse Count                            : {pulse_count}")
    for i in range(len(rise_time)):
        print(f"Rise Time (s)                          : {rise_time[i]:.11f}")
        print(f"Fall Time (s)                          : {fall_time[i]:.11f}")
        print(f"Pulse Width (s)                        : {pulse_width[i]:.9f}")
        print(f"Top Level (dBm)                        : {top_level[i]}")
        print(f"Base Level (dBm)                       : {base_level[i]}")
        print(f"Average On Level (dBm)                 : {average_on_level[i]}")

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

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

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.

nirfmxpulse-26.5.0-py3-none-any.whl (124.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nirfmxpulse-26.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 116cd3752637ebc7d087e725381f11e8e17fc8ee0cd572d0a9a3defaaf5dd136
MD5 1b8f160dc5343613aa0fac25ee5df5f6
BLAKE2b-256 09bfd4524b9096fe17a311a5bde8e6ad06b64f0e67274ee0779e67a215b7dab6

See more details on using hashes here.

Provenance

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

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