-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
261 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
API | ||
--- | ||
|
||
The api is located in `stg.api` and should be imported from there. It contains the following classes and methods: | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
stg | ||
pf | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
Signal Generation | ||
----------------- | ||
PulseFiles | ||
---------- | ||
|
||
|
||
|
||
.. automodule:: stg.pulsefile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
STG | ||
--- | ||
|
||
Properties of the STG | ||
********************* | ||
STG4000 | ||
******* | ||
|
||
.. automodule:: stg._wrapper.dll | ||
:members: STGX | ||
|
||
|
||
Download | ||
******** | ||
++++++++ | ||
|
||
.. automodule:: stg._wrapper.downloadnet | ||
:members: STG4000 | ||
|
||
|
||
Stream | ||
****** | ||
++++++ | ||
|
||
.. automodule:: stg._wrapper.streamingnet | ||
:members: STG4000Streamer | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,35 @@ | ||
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://en.wikipedia.org/wiki/MIT_License) [![pytest-status](https://github.com/pyreiz/ctrl-stg4000/workflows/pytest/badge.svg)](https://github.com/pyreiz/ctrl-stg4000/actions) [![Coverage Status](https://coveralls.io/repos/github/pyreiz/ctrl-stg4000/badge.svg?branch=develop)](https://coveralls.io/github/pyreiz/ctrl-stg4000?branch=develop) [![Documentation Status](https://readthedocs.org/projects/ctrl-stg4000/badge/?version=latest)](https://ctrl-stg4000.readthedocs.io/en/latest/?badge=latest) | ||
|
||
### STG4000 | ||
Welcome to STG4000's documentation! | ||
=================================== | ||
|
||
This package wraps the C# dll ```McsUsbNet.dll``` for remote control of the multichannelsystem STG4002/4/8 in Python 3. The dll can be acquired from multichannelsystems directly at https://www.multichannelsystems.com/software/mcsusbnetdll or installed by script, i.e. by running ```python post_setup.py```. | ||
This documentation explains the python package wrapping the [C# .dll](https://www.multichannelsystems.com/software/mcsusbnetdll) offered by | ||
multichannelsystems to control their STG4000 range of electrical stimulators. | ||
|
||
The dll allows to set stimulation settings in stream or download mode. Currently, this package only supports download mode. | ||
Installation | ||
------------ | ||
|
||
#### Installation | ||
``` bash | ||
|
||
```bash | ||
git clone https://github.com/pyreiz/app-stg4000 | ||
cd app-stg4000 | ||
pip install -e . | ||
python -m stg.install | ||
git clone https://github.com/pyreiz/app-stg4000 | ||
cd app-stg4000 | ||
pip install -r requirements.txt | ||
pip install -e . | ||
#download and install the dll from mulitchannelsystems | ||
python -m stg.install | ||
``` | ||
The last command downloads and unzips the most recent 64-bit dll from multichannelsystems into ```./bin``` | ||
Because of this, the pacakage only works on Windows. If the package is run on Linux, skip the installation of the requirements. 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. | ||
|
||
#### Downloading a stimulation setting | ||
Testing | ||
------- | ||
|
||
```python | ||
from stg.api import STG4000 | ||
stim = STG4000() | ||
# download a biphasic single pulse with an amplitude of +- 1mA, a pulsewidth of 1ms and a | ||
# interstimulusinterval of 48ms to the first channel. Channel indexing starts at 0. | ||
Connect your oscilloscope and start the following example: | ||
|
||
stim.download(channel_index=0, | ||
amplitude=[1, -1, 0], | ||
duration=[1, 1, 48000]) | ||
``` python | ||
|
||
# start the stimulation | ||
stim.start_stimulation([0]) #trigger the first channel | ||
# abort an ongoing stimulation | ||
stim.start_stimulation() | ||
from stg.api import PulseFile, STG4000 | ||
stg = STG4000() | ||
stg.download(0, *PulseFile().compile()) | ||
stg.start_stimulation([0]) | ||
``` | ||
#### Creating and downloading repetitive pulses | ||
```python | ||
# for convenience, there is also a PulseFile class implemented | ||
from stg.api import PulseFile | ||
p = PulseFile(intensity_in_mA=1000, #in microamps, i.e. 1000 -> 1 mA | ||
mode='biphasic', # can alternatively be monophasic | ||
pulsewidth_in_ms=1, #in milliseconds, i.e. 1 -> 1ms | ||
burstcount=3, # number of repetitions | ||
isi_in_ms=48, #in milliseconds, i.e. 48 -> 48ms | ||
) | ||
amplitude, duration = p.compile() | ||
stim.download(1, amplitude, duration) | ||
stim.start_stimulation([1]) | ||
``` | ||
#### Triggering multiple channels | ||
|
||
By default, the stg4002/4/8 uses a map to define which channels are to be triggered by which triggerinput. In that regard, ```stim.start_stimulation``` does actually not trigger a channel directly, but a trigger input, which is mapped to the respective channels. The triggermap is initialized during class instantiation to the identity diagonal, i.e. trigin 0 triggers channel 0, trigin 1 triggers channel 1. If you want to trigger multiple channels with a single trigin, you can use ```stim.start_stimulation([0,1])```. | ||
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"`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.