RFmx CDMA2k Python API Documentation
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.
Operating System Support
nirfmxcdma2k 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 nirfmxcdma2k and install it.
$ python -m pip install nirfmxcdma2k
To also install gRPC support for remote NI gRPC Device Server communication:
$ python -m pip install "nirfmxcdma2k[grpc]"
Upgrade
You can use pip to upgrade nirfmxcdma2k package using following command:
$ python -m pip install nirfmxcdma2k --upgrade
Support and Feedback
For support with Python API, hardware, the driver runtime or any other questions, please visit NI Community Forums.
Documentation:
- Acp
- AcpConfiguration
- AcpResults
- Attributes
- Cda
- CdaConfiguration
- CdaResults
- CDMA2k
- Chp
- ChpConfiguration
- ChpResults
- Enums
- Errors
- gRPC Support
- ModAcc
- ModAccConfiguration
- ModAccResults
- Obw
- ObwConfiguration
- ObwResults
- Qevm
- QevmConfiguration
- QevmResults
- Sem
- SemConfiguration
- SemResults
- SlotPhase
- SlotPhaseConfiguration
- SlotPhaseResults
- SlotPower
- SlotPowerConfiguration
- SlotPowerResults
Example:
import nirfmxinstr
import nirfmxcdma2k
import numpy
instr_session = None
cdma2k = None
try:
# Create a new RFmx Session
instr_session = nirfmxinstr.Session(resource_name="RFSA", option_string="")
# Get CDMA2k signal
cdma2k = instr_session.get_cdma2k_signal_configuration()
# Configure RFmx Session
instr_session.configure_frequency_reference(selector_string="",
frequency_reference_source="OnboardClock", frequency_reference_frequency=10.0e6)
# Configure CDMA2k signal
cdma2k.configure_rf(selector_string="", center_frequency=833.49e6, reference_level=0.0,
external_attenuation=0.0)
cdma2k.configure_digital_edge_trigger(
selector_string="",
digital_edge_source="PFI0",
digital_edge=nirfmxcdma2k.DigitalEdgeTriggerEdge.RISING_EDGE,
trigger_delay=0.0,
enable_trigger=False,
)
# Select CHP Measurement
cdma2k.select_measurements(selector_string="",
measurements=nirfmxcdma2k.MeasurementTypes.CHP, enable_all_traces=True)
# Configure CHP Measurement
cdma2k.chp.configuration.configure_sweep_time(selector_string="",
sweep_time_auto=nirfmxcdma2k.ChpSweepTimeAuto.TRUE, sweep_time_interval=1.67e-3)
cdma2k.chp.configuration.configure_averaging(
selector_string="",
averaging_enabled=nirfmxcdma2k.ChpAveragingEnabled.FALSE,
averaging_count=10,
averaging_type=nirfmxcdma2k.ChpAveragingType.RMS,
)
cdma2k.initiate(selector_string="", result_name="")
# Retrieve Results
carrier_absolute_power, error_code = cdma2k.chp.results.fetch_carrier_absolute_power(
selector_string="", timeout=10.0
)
# 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.
spectrum = numpy.empty(0, dtype=numpy.float32)
x0, dx, error_code = cdma2k.chp.results.fetch_spectrum(selector_string="", timeout=10.0,
spectrum=spectrum)
# Print Results
print(f"Carrier Absolute Power (dBm) : {carrier_absolute_power}")
except Exception as e:
print("ERROR: " + str(e))
finally:
# Close Session
if cdma2k is not None:
cdma2k.dispose()
cdma2k = 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.
Additional Documentation
Refer to the NI-RFmx User Manual for an overview of NI-RFmx, system requirements, troubleshooting, key concepts, etc.
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