Controlling APx500 with IronPython

Created on 2011-09-15 23:11:00

Pure Python cannot interface with .NET Assemblies. IronPython, however, can and was developed just for that reason. As an added bonus, scripts written in earlier versions of Python will seamlessly work in IronPython. Both Python and IronPython can simultaneously be installed on the same computer.

We have written sample code in IronPython, which loads the APx500 measurement software, makes the APx500 application visible, loads a sample project, runs the sequence to make a measurement, and produces a report.

The associated download, APx Python Sample Code, includes two files: and SampleProject.approjx. Unzip the download and place the two files into a convenient folder.

Before running, you will need to create a file association to the IronPython interpreter, and make sure that the references in the code are correct. To make the file association, right-click on the file, select Open With… and click Browse. Then locate C:Program FilesIronPython x.xipy.exe (where x.x is your version of IronPython) and click Open. Check Always use… and then click OK. The exact steps may vary depending on your version of Windows.

The explicit paths to the Python libraries and the APx API are in lines 2 and 3 of Change these as needed to point to the correct locations and versions.

APx IronPython example UI.

Now double click on The UI will open, as shown above. Click the first button to load APx500. Then, click the second to load the example project. Click the third button to run the Frequency Response measurement and produce a report. The example project file is configured for analog unbalanced loopback on the APx515 and 525 family analyzers, or Analog Unbalanced Output and Analog Unbalanced Input on the APx585 family (connect external loopback cables).




APx Python Sample Code (40.18 KB)

IronPython is a version of Python that can interface with .NET Assemblies. This download includes an APx Project and a Python code sample that controls APx500 via the APx API.