Publishing All Measurements to N8844A

The Python example script in this topic demonstrates publishing scalar measurement data to Keysight's N8844A Data Analytics Web Service Software. The measurements performed and published to the N8844A server are Jitter Mode's Output Jitter (IEEE) measurements. After running this script, open the N8844A web application on your web browser and view the measurements.

The script is run in Flex Offline configuration with a simulated module configured with a PAM4 signal. You can easily modify the script to run on a DCA-X oscilloscope with a live signal.

Before running the script:

  • Display a PAM4 signal on FlexDCA. It should be the only channel that is on.
  • Connection to server must have been established at least once via FlexDCA's Repository Server dialog. This is the only method of entering the service account's password, which is remembered. Disconnect from the server before starting the program.
  • In the script, edit the N8844A_URL, USER_NAME, and DATA_SET constants for values that match your N8844A server and account. The DATA_SET constant names a targed folder on the server.

Example Script

If you plan to connect to an DCA-X instead of running FlexDCA offline, change the LAN address in line 59.

Copy

N8844A-publish-all.py

""" Example of publishing all Jitter Mode's Output Jitter (IEEE)
measurements to an N8844A data analytics repository.
Before running this script, a PAM-4 signal must be displayed on FlexDCA.
Simulated modules offer PAM-4 signals. """

import pyvisa as visa # import VISA library
import time


def display_output_jitter_measurements(flexdca):
    """ Turn on all Output Jitter measurements to ensure location index is
    available. If a measurement is not displayed in a table, it has no
    location index."""
    flexdca.query(':ACQuire:RUN;*OPC?')
    flexdca.query(':SYSTem:MODE JITTer;*OPC?')
    flexdca.write(':MEASure:JITTer:IEEE:STATe ON')
    flexdca.write(':MEASure:JITTer:IEEE:J4U:DISPlay ON')
    flexdca.write(':MEASure:JITTer:IEEE:JRMS:DISPlay ON')
    flexdca.write(':MEASure:JITTer:IEEE:EOJ:DISPlay ON')
    flexdca.query(':SYSTem:AUToscale;*OPC?')
    flexdca.write(':DISPlay:TSMode FSIZe')

def acq_limit_test(flexdca):
    """ Runs an acquisition limit test to ensure that the waveform 
    has enough data to make measurements on. """
    timeout = flexdca.timeout
    flexdca.timeout = 60000 # 60s
    flexdca.write(':ACQuire:STOP')
    flexdca.write(':ACQuire:CDISplay')
    flexdca.write(':LTESt:ACQuire:SIMage:STATe OFF')  # do not save image
    flexdca.write(':LTESt:ACQuire:SWAVeform:RESet')  # do not save waveforms
    flexdca.write(':LTESt:ACQuire:CTYPe:PATTerns 30')
    flexdca.write(':LTESt:ACQuire:STATe ON')
    flexdca.query(':ACQuire:RUN;*OPC?')
    flexdca.write(':LTESt:ACQuire:STATe OFF')
    flexdca.timeout = timeout

def connect_to_repository(flexdca):
    flexdca.write(':REPository:SERVer:NAME "http://156.140.160.82:5000"')
    flexdca.write(':REPository:USER "admin@localhost"')
    flexdca.write(':REPository:MEASure:PMODe SELected')
    flexdca.write(':REPository:MEASure:PUBLish1:NAME "KBTest"')
    flexdca.query(':REPository:CONNect;*OPC?')
    if flexdca.query(':REPository:CONNect:STATe?') == 'NCON':
        print('Cannot connect to repository.')
        return False
    return True
        
def publish_to_repository(flexdca):
    flexdca.write(':REPository:MEASure:PAM:IEEE:SELection:ALL')
    flexdca.write(':REPository:MEASure:PUBLish1:STATe ON')
    flexdca.query(':REPository:PUBLish;*OPC?')
    flexdca.query(':REPository:DISConnect;*OPC?')
    
rm = visa.ResourceManager() # Create an instance of PyVISA's ResourceManager
FlexDCA = rm.open_resource('TCPIP0::localhost::hislip0,4880::INSTR')
FlexDCA.timeout = 10000 # Set connection timeout to 10s
FlexDCA.read_termination = '\n'
display_output_jitter_measurements(FlexDCA)
acq_limit_test(FlexDCA)
if connect_to_repository(FlexDCA):
    publish_to_repository(FlexDCA)
FlexDCA.write(':SYSTem:GTLocal')
time.sleep(0.5)
FlexDCA.close()
print('Connection closed.')