/ctrl-stg4000

Control multichannelsystems STG 4002/4/8 with Python3

Primary LanguagePythonMIT LicenseMIT

MIT license pytest-status Coverage Status Documentation Status

ctrl-stg4000

This documentation explains the python package ctrl-stg4000 wrapping the C# .dll offered by multichannelsystems to control their STG4000 range of electrical stimulators. See also their gthub repo.

At the time of development of this toolbox (and still), the company website offers the dll in version 3.2.45. In the meantime, the github repo was published and apparently already offers version 5.0.12. Please note that this toolbox is tested against version 3.2.45.

Installation

Windows

ctrl-stg4000 wraps the C# .dll 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

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 :code: make test from the root of the package. By default, downloading the dll is not tested, but can be turned on with :code:pytest -m "install".