The VSA 89600 software comes with Python examples which demonstrate using pythonnet to interoperate between Python and VSA's .NET Nuget Packages for .NET clients. This client interface is capable of connections to remote VSA instances. To use this feature, open Utilities > Startup Preferences and enable .NET Client Access Server Startup. The .NET client interface and Python examples are cross platform. The remoting and cross platform features enables scenarios such as running these Python examples on Linux, with a connection to a remote Windows host's VSA instance.
Running Python Examples
Python examples require:
The project folders and files are located in the following directory:
%PROGRAMFILES%\Keysight\89600 Software 20xx\89600 VSA Software\Examples\DotNET\Python
where 20xx is the version number of the 89600 VSA.
The following Python examples are available:
- 5GNRUplinkReceiver
- DigitalDemod
- DirectDataConnectivity
- MeasDemo
- PowerSpectrum
Each Python example folder includes:
- <example>.py — the example script itself
- nuget.config — configures Nuget to pull packages from installed location
- packages.csproj — C# project file used only to restore Nuget packages
- requirements.txt — Pip package dependencies
- nt.runtimeconfig.json — .NET runtime configuration for Windows
- posix.runtimeconfig.json — .NET runtime configuration for Linux
The simplest usage (on Windows only) is to simply run the example without arguments; for example:
$ python DigitalDemod.py
Running an example with the --help or -h flag will print a usage text similar to the following:
$ python DigitalDemod.py -h
usage: DigitalDemod.py [-h] [--server SERVER] [--port PORT]
options:
-h, --help show this help message and exit
--server SERVER, -s SERVER
specify 'localhost' or remote hostname/address where an existing VSA instance is running, else a new ephemeral VSA instancce will be created locally
--port PORT, -p PORT specify local or remote server port number, else 59189 or the next available or open port is used by default
To connect to a remote VSA instance, first get your server IP and port number. If you do not know the host's IP, see Microsoft's support topic Find your IP address in Windows or the ipconfig command reference. If you do not know the server port number, you may find it under Help > About... > Boot Log; the log will contain an entry like ".NET 6.0+ server port is 59189". Use these arguments to run the script, for example:
$ python -s 10.0.0.42 -p 59189
Explanation of .NET Assembly Loading
In these examples, the clr module used by pythonnet may load assemblies from one of two locations: framework assemblies included with the .NET runtime and the Nuget package cache restored from the example's packages.csproj. The former happens by default, but to achieve assembly loading from the package cache, clr requires a list of search locations. Python's sys.path is used for this purpose. Because Nuget packages may include multiple runtimmes, we need to disambiguate the correct set of folders to append to sys.path. This problem is already solved by the Nuget restore, which produces a full set of runtime binary paths, among other information, in obj/project.assets.json. After the example consumes this information to set up sys.path, _pythonnet/_clr will load runtime assemblies automatically and as-needed.
![]() |
You will need to copy the contents of the Examples directory to your Documents directory or some other location that is writable before compiling and running the example programs since the contents of the VSA installation directory are read-only. The examples depend on API interfaces under the Interfaces directory of your VSA software installation, so you may also need to repair references to these interfaces before the example will run. |