Environment for Python Scripts (Operators)

Instrument:
N1000A
N109x
UXR Scope
Flex Apps:
FlexDCA
FlexRT
Meas. mode:
Scope
Eye
Jitter
TDR
Package License:
L-RND

Install Python on the N1000A or PC where FlexDCA is running. As shown in the following figure, all Python scripts must begin with the algorithm function which is described in the lessons. A simple XML configuration file identifies your operator script. In addition to calling the script, the XML file populates the User Operator Setup dialog.

Install Python. Before running your script, you must install Python on either an N1000A or the PC where N1010A FlexDCA is running. Python is not provided by Keysight.

Python 3 (latest version) is recommended. FlexDCA revision A.07.90 is the last FlexDCA version that will support Python 2 user operator or user measurement scripts. If you want to run Python 2 scripts in FlexDCA revisions greater than A.07.90, update the scripts to Python 3.

Update PC's PATH variable. Modify the PC's Path environment variable to include the path to the Python executable. You can select the option in the Python installer to update the path variable as part of the installation.

NumPy is required. NumPy is a Python package for creating multidimensional arrays. NumPy must always be installed with Python. Install NumPy using Python's package manager, pip, from the command prompt: pip install numpy

Always import NumPy. Because the source waveform input variable is a NumPy array, you must always import NumPy into your user operator script. For example, add this statement: import numpy as np.

When a user function is run, the following events occur for each data acquisition:

  1. FlexDCA passes the source waveform, standard variables, and your custom variables available to your Python script as a dictionary. In Oscilloscope and TDR modes, the source waveform is a one-dimensional numpy array. In Eye mode, the source database is a two-dimensional numpy array.
  2. FlexDCA executes this script.
  3. The script returns to FlexDCA a number of standard output variables from the Python script, including the output waveform.