Troubleshooting Python scripts

Instrument
DCA-X
N109x
UXR Scope
Flex Apps:
FlexDCA
FlexRT
Python

You can add print statements to your Python scripts as a troubleshooting aid. The ouput of the print statement is written to the User Opterator Output dialog as shown in the following picture. Each time that the script is executed, which is once per waveform acquisition, the print statements are executed. It is often helpful to set FlexDCA's data acquisition to Single mode and then click the Single button to control the output. Example of printing all input variables.

The following script was used to print the values of two local variables within the script. The above picture represent the output of one waveform acquisition.

OperatorTest.py
def algorithm(variables):
    …
    …
    …
    N = variables['FilterOrder']   # filter order
    Fc = variables['FilterCutoff']   # filter cutoff frequency
    FType = variables['FilterType']   # filter type
    FilterDelay = N * 0.112 / Fc
    FilterWidth = N / Fc
    # Write variables to Show Output
    print 'FilterDelay: ', FilterDelay
    print 'FilterWidth: ', FilterWidth
    …
    …

To view the output

  1. Add print statements to your script and create your user operator.
  2. On FlexDCA's menu, click Measure > Waveform Signal Processing (Math) to open the Waveform Signal Processing dialog if you have closed it.
  3. Click on your operator to open the User Operator Setup dialog, and click the Show Output button. This button only appears on the dialog after the operator has been started.
  4. Click the Show Output button as seen in the following picture.
  5. The output of the print statements are shown the dialog.