![background image](http://html1.mh-extra.com/html/rands/nrpm/nrpm_user-manual_3219371171.webp)
Programming examples
R&S
®
NRPM
171
User Manual 1425.8663.02 ─ 07
Example: Python (VISA) source code
This sequence shows the Python source code, based on the
pseudo code
exam-
ple above.
###################################################################
## Name: contAv-M3.py
## Purpose: Measuring RF power with the R&S NRPM3 OTA sensor module
## Description: This example demonstrates the use of an R&S NRPM3
## sensor module measuring continuously average power
## on up to 3 channels
## Author: Juergen D. Geltinger
## Created: 2016-01-14
## Modified by: Juergen D. Geltinger
## Modified: 2016-07-21
## Copyright: (c) Rohde & Schwarz, Munich
###################################################################
# This is a Visa sample, so import that module
import visa
from time import sleep
from math import fabs, log10
###################################################################
# Find a R&S NRPM3 power sensor modules. That sensor module is
# characterized by a Product ID of 0x0195
###################################################################
def OpenFirstNRPM3():
rm = visa.ResourceManager()
resources=list(rm.list_resources())
for s in resources:
# NRPM3 RF sensor module has a USB Product ID of '0x0195'
if -1 != s.find("0195::"):
print
print "Opening NRPM3 sensor '" + s + "'..."
sensor = rm.open_resource( s )
if sensor != None:
sensor.timeout = 20000
# Setting Aperture Time
sensor.write( "sens:pow:avg:aper 10e-6" )
# Setting Average Filter Length
sensor.write( "sens:aver:count 16" )
print "Querying *IDN?..."
print sensor.ask( "*idn?" )
# Enable the available/connected antenna modules
result = ""
for antenna in range(3):
Performing measurements in continuous average mode