Folder system
SweepMe! creates several folders on its first start. The FolderManager resolves the path of each of these folders from a short key string. It is part of the open-source pysweepme package, so the same folders can be queried both inside SweepMe! and from your own Python scripts.
Base folders
On Windows, SweepMe! uses the following base folders by default:
| Key | Default path | Content |
|---|---|---|
MAIN |
Installation folder of SweepMe!.exe |
Program files, pre-installed drivers, modules, widgets, and examples |
PUBLIC |
%PUBLIC%\Documents\SweepMe!, usually C:\Users\Public\Documents\SweepMe! | Files that all users of the computer can access, e.g. measurement data, sequences, custom drivers, and the file debug.log |
ROAMING |
%APPDATA%\SweepMe! | Settings of the current Windows user, e.g. user profiles and the last run and last session sequences |
LOCAL |
%LOCALAPPDATA%\SweepMe! | Local files of the current Windows user, e.g. the temporary folder |
PROGRAMDATA |
%PROGRAMDATA%\SweepMe! | Shared files that are not easily visible, e.g. the configuration file and the drivers and modules installed via the Version Manager |
You can open the public folder via File → Open Folder → Public and the installation folder via File → Open Folder → Main.
Portable mode
If SweepMe! runs in portable mode (File → Options… → General → Portable:), the folders PUBLIC, ROAMING, LOCAL, and the shared folders in ProgramData are replaced by the subfolders public, roaming, local, and programdata of the folder SweepMe! user data. This folder is located next to the SweepMe! installation folder. The temporary folder stays in %LOCALAPPDATA%\SweepMe!.
Folder key strings
| Key | Folder | Content |
|---|---|---|
TEMP |
temp in LOCAL | Temporary measurement data of the current run (File → Open Folder → Temp), see Saving data |
DATA |
Measurement in PUBLIC | Measurement data, with one subfolder per user profile, see Saving data |
SEQUENCES |
Sequences in PUBLIC | Sequences (File → Open Folder → Sequences), from version 1.6.1.6. In version 1.5, the key is SETTINGS and the folder is called Settings.
|
ROAMINGSEQUENCES |
Sequences in ROAMING | Default sequence and the last run and last session sequences, from version 1.6.1.6. In version 1.5, the key is ROAMINGSETTINGS and the folder is called Settings.
|
EXAMPLES |
examples in MAIN | Example sequences |
DEVICES |
Devices in MAIN | Drivers that are shipped with SweepMe! (File → Open Folder → Devices → Pre-installed) |
SHAREDDEVICES |
Devices in PROGRAMDATA | Drivers that were downloaded and installed via the Version Manager (File → Open Folder → Devices → Installed) |
CUSTOMDEVICES |
CustomDevices in PUBLIC | Your own drivers (File → Open Folder → Devices → Custom) |
MODULES |
Modules in MAIN | Modules that are shipped with SweepMe! |
SHAREDMODULES |
Modules in PROGRAMDATA | Modules that were downloaded and installed via the Version Manager |
CUSTOMMODULES |
CustomModules in PUBLIC | Your own modules |
VERSIONS |
Versions in PROGRAMDATA | Files in which the Version Manager stores the selected driver and module versions |
CALIBRATIONS |
CalibrationFiles in PUBLIC | Calibration files |
CUSTOM / CUSTOMFILES |
CustomFiles in PUBLIC | Custom files, e.g. data that your drivers or scripts need |
EXTLIBS |
ExternalLibraries in PUBLIC | External libraries such as DLLs. This folder and all its subfolders are added to the Python path and to the environment variable PATH. |
SCREENSHOTS |
Screenshots in PUBLIC | Screenshots |
PROFILES |
profiles in ROAMING | User profiles |
CONFIG |
configuration in PROGRAMDATA | Configuration file config.ini |
Further keys exist (e.g. RESOURCES, SERVER, INTERFACES, WIDGETS, DATADEVICES, DATAMODULES, CUSTOMRESOURCES, CUSTOMICONS, CUSTOMSTYLES, CUSTOMCOLORMAPS, PYTHONSCRIPTS). The authoritative list is the folders dictionary in FolderManager.py of the pysweepme source.
If your scripts must work with SweepMe! 1.5 and 1.6, try SEQUENCES first and fall back to SETTINGS, because get_path returns False for unknown keys.
Debug log
SweepMe! writes all debug messages to the file debug.log in the public folder (PUBLIC). The file is overwritten at each start of SweepMe!. If you report a problem, please send the debug.log right after the problem has occurred and before you restart SweepMe!. The messages are also shown in the Debug widget, see also Debugging.
Multiple instances
If you start SweepMe! while another instance is already running, the additional instance uses its own files and folders to avoid conflicts:
- the temporary folder temp_instance<process ID> instead of temp,
- the debug file debug_instance<process ID>.log instead of debug.log.
<process ID> is the Windows process ID of the additional instance. These files and folders are deleted when SweepMe! is started again while no other instance is running.
Retrieving a folder path
The most convenient way is the top-level get_path function of pysweepme:
import pysweepme
print(pysweepme.get_path("TEMP")) # path to the temp folder
The same function is available through the FolderManager submodule together with the FolderManager instance that SweepMe! uses internally:
from pysweepme import FolderManager
FoMa = FolderManager.FolderManager() # singleton instance
print(FoMa.get_path("TEMP"))
Each folder is related to a certain key string (see above). get_path returns False and logs a debug message if the key is unknown. If the folder does not exist yet, get_path creates it.
Setting a folder path
A folder can be redirected with set_path, e.g. to load drivers from a custom location:
import pysweepme
pysweepme.set_path("CUSTOMDEVICES", r"C:\MyDrivers")
set_path returns True on success and False if the key is unknown.
Note: The keys above work properly inside SweepMe!. When used with pysweepme standalone, some keys do not point to a meaningful location, because MAIN is the folder of the running Python script/interpreter rather than a SweepMe! installation. Folders derived from MAIN (e.g. DEVICES, MODULES, EXAMPLES) are therefore only reliable inside SweepMe!.
Adding a driver library folder to the path
Drivers can ship additional libraries (DLLs, wheels, ...) in a libraries or libs subfolder. addFolderToPATH adds these to sys.path and, where DLL files are found, to the environment PATH. When loading a driver with get_driver this is done automatically, but you can call it manually for your own imports:
import pysweepme
# empty argument -> the folder of the calling script is used
pysweepme.addFolderToPATH(r"C:\MyDrivers\SMU-Keithley_2400")
See also
- Pysweepme: using SweepMe! drivers and submodules from your own Python scripts
- Saving data
- Configuration File
- External libraries and dependencies