RFmx GSM 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 ======================== **nirfmxgsm** 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 `nirfmxgsm `_ and install it. .. code-block:: shell $ python -m pip install nirfmxgsm To also install gRPC support for remote NI gRPC Device Server communication: .. code-block:: shell $ python -m pip install "nirfmxgsm[grpc]" Upgrade ======= You can use `pip `_ to upgrade `nirfmxgsm `_ package using following command: .. code-block:: shell $ python -m pip install nirfmxgsm --upgrade Support and Feedback ==================== For support with Python API, hardware, the driver runtime or any other questions, please visit `NI Community Forums `_. Documentation: ============== .. toctree:: :maxdepth: 1 attributes enums errors grpc_session_options gsm modacc modacc_configuration modacc_results orfs orfs_configuration orfs_results pvt pvt_configuration pvt_results Example: ======== .. code-block:: python import nirfmxinstr import nirfmxgsm import numpy instr_session = None gsm = None try: # Create a new RFmx Session instr_session = nirfmxinstr.Session(resource_name="RFSA", option_string="") # Configure frequency reference instr_session.configure_frequency_reference(selector_string="", frequency_reference_source="OnboardClock", frequency_reference_frequency=10e6) # Get GSM signal configuration gsm = instr_session.get_gsm_signal_configuration() # Configure RF settings gsm.configure_rf(selector_string="", center_frequency=890.2e6, reference_level=0.0, external_attenuation=0.0) gsm.configure_band(selector_string="", band=nirfmxgsm.Band.PGSM) gsm.configure_link_direction(selector_string="", link_direction=nirfmxgsm.LinkDirection.UPLINK) # Configure trigger gsm.configure_iq_power_edge_trigger( selector_string="", iq_power_edge_source="0", iq_power_edge_slope=nirfmxgsm.IQPowerEdgeTriggerSlope.RISING_SLOPE, iq_power_edge_level=-20.0, trigger_delay=0.0, minimum_quiet_time_mode=nirfmxgsm.TriggerMinimumQuietTimeMode.AUTO, minimum_quiet_time=582e-6, iq_power_edge_level_type=nirfmxgsm.IQPowerEdgeTriggerLevelType.RELATIVE, enable_trigger=True, ) # Configure burst settings gsm.configure_number_of_timeslots(selector_string="", number_of_timeslots=1) gsm.configure_auto_tsc_detection_enabled(selector_string="", auto_tsc_detection_enabled=nirfmxgsm.AutoTscDetectionEnabled.TRUE) gsm.configure_signal_type(selector_string="slot::all", modulation_type=nirfmxgsm.ModulationType.MODULATION_TYPE_8PSK, burst_type=nirfmxgsm.BurstType.NB, hb_filter_width=nirfmxgsm.HBFilterWidth.NARROW) gsm.configure_tsc(selector_string="slot::all", tsc=nirfmxgsm.Tsc.TSC0) gsm.configure_power_control_level(selector_string="slot::all", power_control_level=0) # Select PVT measurement gsm.select_measurements(selector_string="", measurements=nirfmxgsm.MeasurementTypes.PVT, enable_all_traces=True) # Configure PVT measurement gsm.pvt.configuration.set_rbw_filter_bandwidth(selector_string="", value=500000.0) gsm.pvt.configuration.configure_averaging( selector_string="", averaging_enabled=nirfmxgsm.PvtAveragingEnabled.FALSE, averaging_count=10, averaging_type=nirfmxgsm.PvtAveragingType.RMS, ) gsm.initiate(selector_string="", result_name="") # Retrieve results measurement_status, error_code = gsm.pvt.results.fetch_measurement_status( selector_string="", timeout=10.0 ) ( slot_average_power, slot_burst_width, slot_measurement_status, slot_maximum_power, slot_minimum_power, slot_burst_threshold, error_code, ) = gsm.pvt.results.fetch_slot_measurement_array(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. upper_mask = numpy.empty(0, dtype=numpy.float32) signal_power = numpy.empty(0, dtype=numpy.float32) lower_mask = numpy.empty(0, dtype=numpy.float32) x0, dx, error_code = gsm.pvt.results.fetch_power_trace( selector_string="", timeout=10.0, upper_mask=upper_mask, signal_power=signal_power, lower_mask=lower_mask ) # Print Results print(f"Measurement Status : {measurement_status}\n") for i in range(len(slot_average_power)): print(f"\nSlot Measurement : {i}") print(f"Average Power (dBm) : {slot_average_power[i]}") print(f"Burst Width (s) : {slot_burst_width[i]}") print(f"Maximum Power (dBm) : {slot_maximum_power[i]}") print(f"Minimum Power (dBm) : {slot_minimum_power[i]}") print(f"Burst Threshold (dBm) : {slot_burst_threshold[i]}") print(f"Measurement Status : {slot_measurement_status[i]}") except Exception as e: print("ERROR: " + str(e)) finally: # Close Session if gsm is not None: gsm.dispose() gsm = 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 :py:meth:`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 `_ Indices and Tables ================== * :ref:`genindex` * :ref:`modindex`