nirfmxwlan 26.0.0
Python APIs for interacting with NI RFmx WLAN Product
License: MIT
Requires Python: <4.0,>=3.9
Keywords: rfmx, nirfmx, nirfmxwlan

| **Info**      | Contains Python APIs for interacting with NI RFmx WLAN Product. |
| :------------ | :-------------------------------------------------------------- |
| **Author**    | National Instruments                                            |

# Table of Contents

- [Table of Contents](#table-of-contents)
- [About](#about)
  - [Documentation](#documentation)
  - [Operating System Support](#operating-system-support)
- [Installation](#installation)
- [License](#license)
- [Support and Feedback](#support-and-feedback)
- [Example](#example)


# About

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

**nirfmx-python** follows [Python Software Foundation](https://devguide.python.org/#status-of-python-branches)
support policy for different versions.


## RFmx Instr Python API Status

| Item                         | Details                      |
|------------------------------|-------------------------------|
| **Driver Version Tested**    | [2026 Q1](http://www.ni.com/downloads/)                      |
| **PyPI Package Version**     | v19.1                        |
| **Supported Python Versions**| Python 3.9+ (64-bit)    |
| **Documentation**            | [RFmx Instr Docs](https://nirfmx-python-nirfmxinstr.readthedocs-hosted.com/en/latest/) |


## RFmx WLAN Python API Status

| Item                         | Details                      |
|------------------------------|-------------------------------|
| **Driver Version Tested**    | [2026 Q1](http://www.ni.com/downloads/)                      |
| **PyPI Package Version**     | v19.1                        |
| **Supported Python Versions**| Python 3.9+ (64-bit)    |
| **Documentation**            | [RFmx WLAN Docs](https://nirfmx-python-nirfmxwlan.readthedocs-hosted.com/en/latest/) |


## Documentation

You can find the latest API documentation for the **nirfmx-python** package
on [Read the Docs](https://nirfmx-python-nirfmxinstr.readthedocs-hosted.com/en/latest/)

Refer to the [NI RFmx User Manual](https://www.ni.com/docs/en-US/bundle/rfmx/page/user-manual-welcome.html)
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](https://www.ni.com/r/hw-support) for 
which versions of the driver support your hardware on a given operating system.


## Installation

You can use [pip](http://pypi.python.org/pypi/pip) to download [nirfmxwlan](https://pypi.org/project/nirfmxwlan/) package and install it.

    $ python -m pip install nirfmxwlan

## Upgrade

You can use [pip](http://pypi.python.org/pypi/pip) to upgrade [nirfmxwlan](https://pypi.org/project/nirfmxwlan/) package using following command:

    $ python -m pip install nirfmxwlan --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](https://github.com/ni/grpc-device/wiki/Server-Security-Support).


## Support and Feedback

For support with Python API, hardware, the driver runtime or any other questions,
please visit [NI Community Forums](https://forums.ni.com/).


## RFmxWLAN Example

```python
import nirfmxinstr
import nirfmxwlan
import numpy

instr_session = None
wlan_signal = None

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

    # Get WLAN Signal
    wlan_signal = instr_session.get_wlan_signal_configuration()
    
    # Configure measurement
    instr_session.configure_frequency_reference(
        selector_string="", frequency_reference_source="PXI_CLK",
        frequency_reference_frequency=10e6
    )
    wlan_signal.configure_frequency(selector_string="", center_frequency=2.412e9)
    wlan_signal.configure_reference_level(selector_string="", reference_level=0.0)
    wlan_signal.configure_external_attenuation(selector_string="", external_attenuation=0.0)
    wlan_signal.configure_iq_power_edge_trigger(
        selector_string="",
        iq_power_edge_source="0",
        iq_power_edge_slope=nirfmxwlan.IQPowerEdgeTriggerSlope.RISING_SLOPE,
        iq_power_edge_level=-20.0,
        trigger_delay=0.0,
        trigger_min_quiet_time_mode=nirfmxwlan.TriggerMinimumQuietTimeMode.AUTO,
        trigger_min_quiet_time_duration=5.0e-6,
        iq_power_edge_level_type=nirfmxwlan.IQPowerEdgeTriggerLevelType.RELATIVE,
        enable_trigger=True,
    )
    wlan_signal.configure_standard(selector_string="",
      standard=nirfmxwlan.Standard.STANDARD_802_11_AG)
    wlan_signal.configure_channel_bandwidth(selector_string="", channel_bandwidth=20e6)
    wlan_signal.select_measurements(selector_string="",
      measurements=nirfmxwlan.MeasurementTypes.SEM, enable_all_traces=True)
    wlan_signal.sem.configuration.configure_mask_type(selector_string="",
      mask_type=nirfmxwlan.SemMaskType.STANDARD)
    wlan_signal.sem.configuration.configure_averaging(
        selector_string="", 
        averaging_enabled=nirfmxwlan.SemAveragingEnabled.FALSE, 
        averaging_count=10, 
        averaging_type=nirfmxwlan.SemAveragingType.RMS
    )
    wlan_signal.sem.configuration.configure_sweep_time(selector_string="",
      sweep_time_auto=nirfmxwlan.SemSweepTimeAuto.TRUE, sweep_time_interval=1.0e-3)
    wlan_signal.sem.configuration.configure_span(selector_string="",
      span_auto=nirfmxwlan.SemSpanAuto.TRUE, span=66.0e6)

    error_code = wlan_signal.initiate(selector_string="", result_name="")

    # Retrieve results
    measurement_status, error_code = wlan_signal.sem.results.fetch_measurement_status(
      selector_string="", timeout=10.0)

    absolute_power, relative_power, error_code = (
        wlan_signal.sem.results.fetch_carrier_measurement(selector_string="", timeout=10.0)
    )

    (
        lower_offset_measurement_status,
        lower_offset_margin,
        lower_offset_margin_frequency,
        lower_offset_margin_absolute_power,
        lower_offset_margin_relative_power,
        error_code,
    ) = wlan_signal.sem.results.fetch_lower_offset_margin_array
          (selector_string="", timeout=10.0)

    (
        upper_offset_measurement_status,
        upper_offset_margin,
        upper_offset_margin_frequency,
        upper_offset_margin_absolute_power,
        upper_offset_margin_relative_power,
        error_code,
    ) = wlan_signal.sem.results.fetch_upper_offset_margin_array
          (selector_string="", timeout=10.0)

    spectrum = numpy.empty(0, dtype=numpy.float32)
    composite_mask = numpy.empty(0, dtype=numpy.float32)
    
    (
        x0, 
        dx,
        error_code 
    ) = wlan_signal.sem.results.fetch_spectrum
          (selector_string="", timeout=10.0, spectrum=spectrum, composite_mask=composite_mask)

    # Print Results
    print(f"Measurement Status                          : {measurement_status}")
    print(f"Carrier Absolute Power (dBm)                : {absolute_power}\n")

    print("----------Lower Offset Measurements----------\n")
    for i in range(len(lower_offset_margin)):
        print(f"Offset {i}")
        print(f"Measurement Status              : {lower_offset_measurement_status[i]}")
        print(f"Margin (dB)                     : {lower_offset_margin[i]}")
        print(f"Margin Frequency (Hz)           : {lower_offset_margin_frequency[i]}")
        print(f"Margin Absolute Power (dBm)     : {lower_offset_margin_absolute_power[i]}\n")

    print("\n----------Upper Offset Measurements----------\n")
    for i in range(len(upper_offset_margin)):
        print(f"Offset {i}")
        print(f"Measurement Status              : {upper_offset_measurement_status[i]}")
        print(f"Margin (dB)                     : {upper_offset_margin[i]}")
        print(f"Margin Frequency (Hz)           : {upper_offset_margin_frequency[i]}")
        print(f"Margin Absolute Power (dBm)     : {upper_offset_margin_absolute_power[i]}\n")

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

finally:
    # Close session
    if wlan_signal is not None:
        wlan_signal.dispose()
        wlan_signal = None
    if instr_session is not None:
        instr_session.close()
        instr_session = None
```