Drivers

From SweepMe! Wiki
(Redirected from Devices)
Jump to navigation Jump to search

Several Modules can load instrument drivers (formerly "Device classes"). Drivers are small Python code snippets that allow you to include and use any equipment with SweepMe!. A driver is basically a Python file called main.py. The Python version depends on your SweepMe! version:

SweepMe! version Python version
1.6.1 Python 3.14 (64 bit)
1.5.7 and 1.5.8 Python 3.9 (64 bit)
1.5.6 Python 3.9 (32 bit or 64 bit)
1.5.5 Python 3.6 (32 bit)

A list of all publicly available drivers can be found here: https://sweep-me.net/devices

Download

Version manager

You can download or update Drivers via the Version manager (menu "Tools" -> "Version Manager"), which is part of the SweepMe! main installation.

Direct download

Drivers can be directly downloaded via the website (https://sweep-me.net/devices) after registering an account (https://sweep-me.net/register).

Contribution and upload

To make SweepMe! a powerful tool, we are relying on you! Help us to build up a large library of Drivers. Implement your own instruments and contribute them. Here is a guideline:

  • The open-source drivers are maintained in our Instrument Drivers repository on GitHub. If you are familiar with Git, you can contribute your driver via a pull request. Before we can accept pull requests, we need your contribution agreement. Templates of the agreement are available in the repository.
  • Alternatively, you can send us your driver by email (contact@sweep-me.net) and we will add it to the repository and release a new version on our server. This is often the easier solution if you are not familiar with Git.
  • Contact us if you have developed a new driver. We will register the driver name on the server and make an initial check of the code.

Please note that we try to publish all drivers whenever possible under MIT license to have a rather uniform landscape of licenses and to make it easy to use our drivers for different purposes. See the License Guide for Drivers. To contribute a driver, it is also important to have all rights. For example, other authors might have contributed or your employer (university or company) has the rights to the drivers. Furthermore, the licenses of used third-party libraries must be considered. Please contact us if you have any question.

For companies, we have a standard agreement for contributing drivers. Let us know if you like to contribute your drivers.

Places and folders

SweepMe! can load Drivers from different places. The Version manager shows the place of each version as its origin:

pre-installed: These Drivers come with your installation of SweepMe!. You can find them in the folder "Devices" of your SweepMe! installation, e.g. "C:\SweepMe!\SweepMe!_x.x.x\Devices" if you use the suggested installation path. Use the menu "File" -> "Open Folder" -> "Devices" -> "Pre-installed" to open it.

installed: These Drivers are downloaded with the Version manager. Every downloaded Driver is versioned and copied to "C:\ProgramData\SweepMe!\Devices". Do not modify these folders and do not add your own Drivers there. SweepMe! checks the files of each installed version and does not load a version that has been modified. Delete versions with the Version manager. If you like to test modifications, create a custom version as described below.

custom: These Drivers are placed in the public SweepMe! folder "CustomDevices". You can open this folder via the menu "File" -> "Open Folder" -> "Devices" -> "Custom". We recommend to use this folder for your own Drivers, as it is not changed when you install a newer version of SweepMe!, so that you can still access your Drivers with any further SweepMe! version.

repo: Driver developers can set the environment variable SWEEPME_DRIVERS_REPO to the folder src of a local copy of the instrument-drivers repository (SweepMe! 1.5.6.12 or later). After a restart of SweepMe!, these Drivers are listed with the origin "repo".

With SweepMe! Pro (SweepMe! 1.5.8.3 or later), you can add further folders as user-defined source paths: menu "File" -> "Options…", tab "Paths (Pro)", button "Configure source paths…". The Drivers in these folders are listed with the key that you have entered for the folder.

For each Driver, only one version is active at a time. You can switch between the versions in the Version manager.

Only Drivers that are compatible with the Python version of your SweepMe! installation are listed. A Driver can restrict the Python versions it supports with the architecture entry of its config.ini file, see Driver Structure.

Drivers that have been released on our server come with an info.ini file. SweepMe! does not load such a Driver if its Python files have been modified, whatever folder it is in. If you copy a released Driver manually to modify it, delete the file info.ini from the copy. The Version manager does this automatically when it creates a custom version or a new Driver.

Structure

SweepMe! searches for Drivers in the folders described above. Each Driver has to have a name of the following structure:

<Type of the Module>-<Name of the manufacturer>_<Name of the instrument model>

Examples:

  • SMU-Keithley_2400
  • LCRmeter-HP_4284A
  • Logger-PC_Mouse

The Driver itself is a file which always has the name "main.py" and which can load further Python modules, dll files, or simple text files as needed to get your Driver working.

The Sequencer procedure provides various semantic standard functions which are called at certain points during the run of the measurement sequence.

Documentation

Each driver that has been released on our server automatically gets a webpage at https://sweep-me.net/devices. There, you can find further details about the instrument, the handling of the driver, and links to the manufacturer or the manual. Feel free to contact us if further information is needed.

Creating new Drivers

You can implement Drivers on your own. How to program a Driver is described here: Driver Programming

Create a copy of an existing one

  • Open SweepMe!'s Version manager using the menu "Tools" -> "Version Manager".
  • Navigate to the Driver you like to copy and choose a version.
  • Right-click the version and choose "Create custom version". The custom version is created in the folder "CustomDevices" and activated automatically.
  • Right-click the new version and select "Open version folder" or "Open version in editor" to find or modify it.

Create a new one using the version manager

  • Open SweepMe!'s Version manager using the menu "Tools" -> "Version Manager".
  • Either use the menu "File" -> "New Driver" of the Version manager to start from a Logger template, or right-click a version of an existing Driver and choose "Create new driver" to start from this Driver.
  • Enter module, manufacturer, and model.
  • The new Driver is created in the folder "CustomDevices" and activated. A restart of SweepMe! is not needed.

Manually create one

  • Open the public folder "CustomDevices" (menu "File" -> "Open Folder" -> "Devices" -> "Custom").
  • Create a folder with module name, manufacturer, and model as defined above.
  • Add a main.py, e.g. based on the minimal driver template.
  • Click "Refresh versions" in the Version manager (SweepMe! 1.5.8.3 or later) or restart SweepMe! so that the new Driver is found.

Open/Modify

You can open any Driver in SweepMe! with the included Programmer's Notepad editor via the button "Open driver" of the module or via the right-click menu of a version in the Version manager. Any change to a custom Driver takes effect after saving the file and starting a new run. Versions with the origin "installed" cannot be modified, as they are versioned. See Driver Programming to find all possibilities.

pysweepme

SweepMe!'s instrument drivers have a double use. They can be used with SweepMe!, but they can also be loaded in individual Python projects using the open-source library pysweepme.