Welcome to STG4000’s documentation!¶
Installation¶
Windows¶
ctrl-stg4000 wraps the [C# .dll](https://www.multichannelsystems.com/software/mcsusbnetdll) offered by multichannelsystems to control their STG4000 range of electrical stimulators. Therefore, the python package only works on Windows, because the STG and the dll are only supported for Windows by multichannelsystems.
git clone https://github.com/pyreiz/ctrl-stg4000
cd ctrl-stg4000
pip install -r requirements.txt
pip install -e .
# download and install the dll from mulitchannelsystems
python -m stg.install
As you installed everything fresh, please note that pythonnet / Windows will very likely complain when asked to execute a dll
-file downloaded from the internet. Go to stg/bin
, right-click on the McsUsbNet.dll
and unblock the dll.
Linux¶
The package can be installed on Linux though, just skip the installation of pythonnet and downloading the dll.
git clone https://github.com/pyreiz/ctrl-stg4000
cd ctrl-stg4000
pip install -e .
On linux, the package automatically mocks the interface to the STG4000. This allows to run tests and build documentation, and can help when you write scripts for your experiments.
Testing¶
Connect your oscilloscope and start the following example:
from stg.api import PulseFile, STG4000
stg = STG4000()
stg.download(0, *PulseFile().compile())
stg.start_stimulation([0])
You can run full tests using pytest, mypy or everything with make test
from the root of the package. By default, downloading the dll is not tested, but
can be tested selectively with pytest -m "install"
.