Troubleshooting Python scripts
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.
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
- Add print statements to your script and create your user operator.
- On FlexDCA's menu, click Measure > Waveform Signal Processing (Math) to open the Waveform Signal Processing dialog if you have closed it.
- 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.
- Click the Show Output button as seen in the following picture.
- The output of the print statements are shown the dialog.