RFmx TDSCDMA 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 ======================== **nirfmxtdscdma** 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 `nirfmxtdscdma `_ and install it. .. code-block:: shell $ python -m pip install nirfmxtdscdma To also install gRPC support for remote NI gRPC Device Server communication: .. code-block:: shell $ python -m pip install "nirfmxtdscdma[grpc]" Upgrade ======= You can use `pip `_ to upgrade `nirfmxtdscdma `_ package using following command: .. code-block:: shell $ python -m pip install nirfmxtdscdma --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 acp acp_configuration acp_results attributes cda cda_configuration cda_results chp chp_configuration chp_results enums errors grpc_session_options modacc modacc_configuration modacc_results obw obw_configuration obw_results pvt pvt_configuration pvt_results sem sem_configuration sem_results slotpower slotpower_configuration slotpower_results tdscdma Example: ======== .. code-block:: python import nirfmxinstr import nirfmxtdscdma import numpy instr_session = None tdscdma = None try: # Open a RFmx Session instr_session = nirfmxinstr.Session(resource_name="RFSA", option_string="") # Configure RFmx Session instr_session.configure_frequency_reference(selector_string="", frequency_reference_source="OnboardClock", frequency_reference_frequency=10.0e+6) # Create TDSCDMA Signal tdscdma = instr_session.get_tdscdma_signal_configuration() # Configure TDSCDMA Signal tdscdma.configure_external_attenuation(selector_string="", external_attenuation=0.0) tdscdma.configure_frequency(selector_string="", center_frequency=1.91e+9) tdscdma.configure_reference_level(selector_string="", reference_level=0.0) tdscdma.configure_iq_power_edge_trigger(selector_string="", iq_power_edge_trigger_source="0", iq_power_edge_slope=nirfmxtdscdma.IQPowerEdgeTriggerSlope.RISING_SLOPE, iq_power_edge_trigger_level=-20.0, trigger_delay=0.0, minimum_quiet_time_mode=nirfmxtdscdma.TriggerMinimumQuietTimeMode.AUTO, minimum_quiet_time_duration=16.0e-6, iq_power_edge_trigger_level_type=nirfmxtdscdma.IQPowerEdgeTriggerLevelType.RELATIVE, enable_trigger=True) # Select ACP Measurement tdscdma.select_measurements(selector_string="", measurements=nirfmxtdscdma.MeasurementTypes.ACP, enable_all_traces=True) # Configure ACP Measurement tdscdma.acp.configuration.configure_averaging(selector_string="", averaging_enabled=nirfmxtdscdma.AcpAveragingEnabled.FALSE, averaging_count=10, averaging_type=nirfmxtdscdma.AcpAveragingType.RMS) tdscdma.acp.configuration.configure_sweep_time(selector_string="", sweep_time_auto=nirfmxtdscdma.AcpSweepTimeAuto.TRUE, sweep_time_interval=660e-6) tdscdma.acp.configuration.configure_noise_compensation_enabled(selector_string="", noise_compensation_enabled=nirfmxtdscdma.AcpNoiseCompensationEnabled.FALSE) tdscdma.acp.configuration.configure_number_of_offsets(selector_string="", number_of_offsets=2) tdscdma.initiate(selector_string="", result_name="") # Retrieve Results # 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. lower_relative_power, upper_relative_power, lower_absolute_power, upper_absolute_power, error_code = ( tdscdma.acp.results.fetch_offset_measurement_array(selector_string="", timeout=10.0)) carrier_absolute_power, error_code = ( tdscdma.acp.results.fetch_carrier_absolute_power(selector_string="", timeout=10.0)) spectrum = numpy.empty(0, dtype=numpy.float32) x0, dx, _ = tdscdma.acp.results.fetch_spectrum(selector_string="", timeout=10.0, spectrum=spectrum) # Print Results print(f"Carrier Absolute Power (dBm) {carrier_absolute_power}") for index in range(2): print(f"----Offset {index}") print(f"Lower Relative Power (dB) {lower_relative_power[index]}") print(f"Upper Relative Power (dB) {upper_relative_power[index]}") print(f"Lower Absolute Power (dBm) {lower_absolute_power[index]}") print(f"Upper Absolute Power (dBm) {upper_absolute_power[index]}") except nirfmxinstr.RFmxError as e: print("ERROR: " + str(e.description)) finally: # Dispose Signal & Session if tdscdma is not None: tdscdma.dispose() tdscdma = 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`