# Sensapex SDK
This python library wraps the C SDK provided by Sensapex's umsdk. It provides general access to the
functions present therein, as well as a device-based abstraction.
### Installation
`pip install sensapex`
This library comes packaged
with [the latest umsdk library](http://dist.sensapex.com/misc/um-sdk/latest/) for windows. All other
versions can be downloaded and/or compiled separately and configured with `UMP.set_library_path`.
### Usage
```python
from sensapex import UMP
ump = UMP.get_ump()
dev_ids = ump.list_devices()
stage = ump.get_device(20)
stage.calibrate_zero_position()
manipulator = ump.get_device(4)
manipulator.goto_pos((2500.0412, 6810.0003, 15830.1419), speed=200)
pressure = ump.get_device(30)
pressure.set_pressure(1, 2.3e-4)
```
Also included are some simple test scripts. The following will report on all devices present:
```bash
python -m sensapex.test
```
Or for a more involved test of your hardware as it moves around randomly,
install [pyqtgraph](https://pyqtgraph.org) in your environment and use e.g.:
```bash
python -m sensapex.accuracy_test <device_id>
```
Where `<device_id>` should be replaced with the numerical ID of your device, as shown by `python -m sensapex.test`.
#### ACQ4 Integration
Sensapex stages (uMs), manipulators (uMp) and pressure controllers (uMc) are all well integrated into the [ACQ4](http://acq4.org) neurophysiology platform. To access these devices from ACQ4, simply install `sensapex` into your ACQ4 environment and add appropriate configuration. In `default.cfg` add:
```yaml
drivers:
sensapex:
group: 0 # [default] of Group 'A' or whatever numeric index corresponds to your hardware
debug: False # [default] or True to get debug logging as described below
address: "169.254.255.255" # [default] or whatever your hardware's broadcast address is
driverPath: None # [default] to using standard OS library searches or set to a custom location
```
And in `devices.cfg`, add any number of the following device configuration sections (named distinctly):
```yaml
Stage:
driver: "Sensapex"
nAxes: 3
deviceId: 20
# ...
ObjectiveChanger:
driver: 'SensapexObjectiveChanger'
deviceId: 20
# ...
Manipulator1:
driver: "Sensapex"
isManipulator: True
deviceId: 1
# ...
Pressure1:
Driver: "SensapexPressureControl"
deviceId: 30
pressureChannel: 1
```
#### Debug
You can turn on debugging to produce detailed logs and network packet captures. First,
install [Wireshark](https://www.wireshark.org/download.html) (or for linux, use your package manager
to get the `pcaputils` package). Make sure the user account you use has permission to run
the `dumpcap` program. Next, install the psutil python package:
```bash
pip install psutil
```
Once those are installed, you can turn on the debug logging for your SDK wrapper:
```python
from sensapex import UMP
UMP.set_debug_mode(True)
ump = UMP.get_ump()
```
This will create a directory, `sensapex-debug/` in the current working directory, populated with a
log file and a pcap file. Repeated initializations of the debug mode will create addition pcap files
and append to the log file. These can be sent to
[Sensapex](mailto:support@sensapex.com) along with any relevant details, such as:
* A description of errant behavior
* The color of each of the relevant device lights
* A picture of the touchscreen state
* Steps to reproduce and how consistently it occurs
### Authorship
Copyright (c) 2016-2021 Sensapex Oy
Thanks to the following for contributions:
* Luke Campagnola
* Ari Salmi
* Martin Chase
* Thomas Braun
### Changelog
#### 1.400.3
* Bump up minimum SDK version
#### 1.400.2
* Bugfix for non-simultaneous moves on stages
* SensapexDevice.is_stage is now available (and can be overridden with an init arg)
#### 1.400.1
* Handle new python behavior https://github.com/python/cpython/issues/78997 (thanks @jhuhtamaki!)
#### 1.400.0
* Update to latest driver
* Accuracy test for 4-axis devices (ignoring the 4th axis)
#### 1.022.8
* Include ACQ4 integration instructions in README
#### 1.022.7
* Packaging fix to include driver binary.
* find_library to find libum in default locations.
#### 1.022.6
* More accuracy_test improvements.
* Handle floating point movements.
#### 1.022.5
* The accuracy_test script now takes `--linear` to test linear movements.
#### 1.022.4
* Binary installer works in develop mode
* Errors no longer prevent other devices from moving
* Allow init args for UMP.get_device (to avoid n_axes race)
#### 1.022.3
* Bad MoveRequests should blow up on init, rather than during movement.
#### 1.022.2
* A bunch of fixes from Luke.
#### 1.022.1
* Debug mode: logs, hardware details and PCAP
* Bugfix in default library path for test scripts
#### 1.022.0
* Setup bdist_wheel that pre-downloads the SDK
* Bump SDK version to the latest
#### 1.021.2
* SDK version bump
#### 1.021.1
* Move-finish error capture
* Use new windows library name
#### 1.021.0
* Update to new version
#### 0.920.4
* Pressure devices don't need positioning callbacks
#### 0.920.3
* Expose more pressure functions.
#### 0.920.2
* Workaround for sdk bug in motion planning
Raw data
{
"_id": null,
"home_page": "https://github.com/sensapex/sensapex-py",
"name": "sensapex",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Luke Campagnola",
"author_email": "luke.campagnola@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/19/25/828491c7dbb2354c2af4ab0af1053f6c89cdbdee2488aec1f75151166863/sensapex-1.400.3.tar.gz",
"platform": null,
"description": "# Sensapex SDK\n\nThis python library wraps the C SDK provided by Sensapex's umsdk. It provides general access to the\nfunctions present therein, as well as a device-based abstraction.\n\n### Installation\n\n`pip install sensapex`\n\nThis library comes packaged\nwith [the latest umsdk library](http://dist.sensapex.com/misc/um-sdk/latest/) for windows. All other\nversions can be downloaded and/or compiled separately and configured with `UMP.set_library_path`.\n\n### Usage\n\n```python\nfrom sensapex import UMP\n\nump = UMP.get_ump()\ndev_ids = ump.list_devices()\n\nstage = ump.get_device(20)\nstage.calibrate_zero_position()\n\nmanipulator = ump.get_device(4)\nmanipulator.goto_pos((2500.0412, 6810.0003, 15830.1419), speed=200)\n\npressure = ump.get_device(30)\npressure.set_pressure(1, 2.3e-4)\n```\n\nAlso included are some simple test scripts. The following will report on all devices present:\n\n```bash\npython -m sensapex.test\n```\n\nOr for a more involved test of your hardware as it moves around randomly,\ninstall [pyqtgraph](https://pyqtgraph.org) in your environment and use e.g.:\n\n```bash\npython -m sensapex.accuracy_test <device_id>\n```\n\nWhere `<device_id>` should be replaced with the numerical ID of your device, as shown by `python -m sensapex.test`.\n\n#### ACQ4 Integration\n\nSensapex stages (uMs), manipulators (uMp) and pressure controllers (uMc) are all well integrated into the [ACQ4](http://acq4.org) neurophysiology platform. To access these devices from ACQ4, simply install `sensapex` into your ACQ4 environment and add appropriate configuration. In `default.cfg` add:\n```yaml\ndrivers:\n sensapex:\n group: 0 # [default] of Group 'A' or whatever numeric index corresponds to your hardware\n debug: False # [default] or True to get debug logging as described below\n address: \"169.254.255.255\" # [default] or whatever your hardware's broadcast address is\n driverPath: None # [default] to using standard OS library searches or set to a custom location\n```\n\nAnd in `devices.cfg`, add any number of the following device configuration sections (named distinctly):\n```yaml\nStage:\n driver: \"Sensapex\"\n nAxes: 3\n deviceId: 20\n # ...\n\nObjectiveChanger:\n driver: 'SensapexObjectiveChanger'\n deviceId: 20\n # ...\n\nManipulator1:\n driver: \"Sensapex\"\n isManipulator: True\n deviceId: 1\n # ...\n\nPressure1:\n Driver: \"SensapexPressureControl\"\n deviceId: 30\n pressureChannel: 1\n```\n\n#### Debug\n\nYou can turn on debugging to produce detailed logs and network packet captures. First,\ninstall [Wireshark](https://www.wireshark.org/download.html) (or for linux, use your package manager\nto get the `pcaputils` package). Make sure the user account you use has permission to run\nthe `dumpcap` program. Next, install the psutil python package:\n\n```bash\npip install psutil\n```\n\nOnce those are installed, you can turn on the debug logging for your SDK wrapper:\n\n```python\nfrom sensapex import UMP\n\nUMP.set_debug_mode(True)\nump = UMP.get_ump()\n```\n\nThis will create a directory, `sensapex-debug/` in the current working directory, populated with a\nlog file and a pcap file. Repeated initializations of the debug mode will create addition pcap files\nand append to the log file. These can be sent to\n[Sensapex](mailto:support@sensapex.com) along with any relevant details, such as:\n\n* A description of errant behavior\n* The color of each of the relevant device lights\n* A picture of the touchscreen state\n* Steps to reproduce and how consistently it occurs\n\n### Authorship\n\nCopyright (c) 2016-2021 Sensapex Oy\n\nThanks to the following for contributions:\n\n* Luke Campagnola\n* Ari Salmi\n* Martin Chase\n* Thomas Braun\n\n### Changelog\n\n#### 1.400.3\n* Bump up minimum SDK version\n\n#### 1.400.2\n* Bugfix for non-simultaneous moves on stages\n* SensapexDevice.is_stage is now available (and can be overridden with an init arg)\n\n#### 1.400.1\n* Handle new python behavior https://github.com/python/cpython/issues/78997 (thanks @jhuhtamaki!)\n\n#### 1.400.0\n* Update to latest driver\n* Accuracy test for 4-axis devices (ignoring the 4th axis)\n\n#### 1.022.8\n* Include ACQ4 integration instructions in README\n\n#### 1.022.7\n* Packaging fix to include driver binary.\n* find_library to find libum in default locations.\n\n#### 1.022.6\n* More accuracy_test improvements.\n* Handle floating point movements.\n\n#### 1.022.5\n* The accuracy_test script now takes `--linear` to test linear movements.\n\n#### 1.022.4\n* Binary installer works in develop mode\n* Errors no longer prevent other devices from moving\n* Allow init args for UMP.get_device (to avoid n_axes race)\n\n#### 1.022.3\n* Bad MoveRequests should blow up on init, rather than during movement.\n\n#### 1.022.2\n* A bunch of fixes from Luke.\n\n#### 1.022.1\n\n* Debug mode: logs, hardware details and PCAP\n* Bugfix in default library path for test scripts\n\n#### 1.022.0\n\n* Setup bdist_wheel that pre-downloads the SDK\n* Bump SDK version to the latest\n\n#### 1.021.2\n\n* SDK version bump\n\n#### 1.021.1\n\n* Move-finish error capture\n* Use new windows library name\n\n#### 1.021.0\n\n* Update to new version\n\n#### 0.920.4\n\n* Pressure devices don't need positioning callbacks\n\n#### 0.920.3\n\n* Expose more pressure functions.\n\n#### 0.920.2\n\n* Workaround for sdk bug in motion planning\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python wrapper for the Sensapex SDK",
"version": "1.400.3",
"project_urls": {
"Homepage": "https://github.com/sensapex/sensapex-py"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1925828491c7dbb2354c2af4ab0af1053f6c89cdbdee2488aec1f75151166863",
"md5": "04277f9f896b92abb9f641577c9d7aec",
"sha256": "12d4543570daa5aaddaa224451e9eb6092bdf336c9aaf43716f3fcbb97045d78"
},
"downloads": -1,
"filename": "sensapex-1.400.3.tar.gz",
"has_sig": false,
"md5_digest": "04277f9f896b92abb9f641577c9d7aec",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 26367,
"upload_time": "2024-11-15T18:37:29",
"upload_time_iso_8601": "2024-11-15T18:37:29.900391Z",
"url": "https://files.pythonhosted.org/packages/19/25/828491c7dbb2354c2af4ab0af1053f6c89cdbdee2488aec1f75151166863/sensapex-1.400.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-15 18:37:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sensapex",
"github_project": "sensapex-py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "sensapex"
}