# pico-python
[![Build Status](https://travis-ci.org/colinoflynn/pico-python.svg?branch=master)](https://travis-ci.org/colinoflynn/pico-python)
This is a Python 2.7+ library for the Pico Scope. It uses the provided DLL
for actual communications with the instrument. There have been a few examples
around, but this one tries to improve on them via:
* Subclass instrument-specific stuff, so can support more families
* Use exceptions to raise errors, and gives you nice English error messages (copied from PS Manual)
* Provide higher-level functions (e.g. just setup timebase, function deals with instrument-specific limitations)
* Supports both Windows and Linux and Mac
System has support for:
* PS6000A Class (Picoscope 6xxxE)
* PS6000
* PS5000A Class (PicoScope 5242A/5243A/5244A/5442A/5443A/5444A/5242B/5244B/5442B/5443B/5444B)
* PS4000A Class (PicoScope 4444/4824)
* PS3000 Class (PicoScope 3204/3205/3206/3224/3424/3425)
* PS3000A Class (PicoScope 3204A/3204B/3205A/3205B/3206A/3206B/3207A/3207B/3204/3205/3206/3404A/3404B/3405A/3405A/3406A/3406B)
* PS2000 Class (PicoScope 2104/2105/2202/2203/2204/2205/2204A/2205A)
* PS2000A Class (PicoScope 2206/2206A/2206B/2207/2207A/2207B/2208/2208A/2208B/2205A MSO/2206B MSO/2207B MSO/2208B MSO/2405A/2406B/2407B/2408B)
Note the 'A' series covers a different ground than the non-A series! Check the programming manuals posted at http://www.picotech.com/document/ for details.
## Installation
You need to install the Python module as well as the Picoscope libraries for your Operating system.
### Module installation
#### PyPi
```
pip install picoscope
```
#### Git
If you are developping the library, or need some feature that we haven't pushed to PyPi yet, use
git clone to put the directory somewhere.
Then use the setup.py script to install the library in development mode:
```bash
git clone git@github.com:colinoflynn/pico-python.git
cd pico-python
python setup.py develop
```
### OS specific
#### Windows
You will require the PicoScope DLLs for this package to work. The easiest method is to install the latest PicoScope software
or SDK from https://www.picotech.com/downloads .
You may need to add the PicoScope install directory to the path, especially if changing between versions. Be sure you have installed a matching 32-bit or 64-bit version for your Python install.
```
import os
picoinstallpath = os.path.normpath(r"C:\Program Files\Pico Technology\PicoScope 7 T&M Early Access")
if picoinstallpath not in os.environ['PATH']:
print("Adding Pico Install to Path")
os.environ['PATH'] = picoinstallpath + os.pathsep + os.environ['PATH']
else:
print("Pico Install Already on Path")
```
#### Linux
Install the PicoScope Beta for Linux version of PicoScope as describe under Getting DLL's (above). Currently this is the only way to install the shared libraries (SDK)
Once you have PicoScope running you need to add your login account to the pico group in order to access the USB. The examples will crash if you don't have permission to use the USB. This is true for use of the shared libraries in general, even if you're not using pico-python.
```
useradd -G pico $USER
```
#### Mac OSX
You either want to add this every time before you start python or IPython, but I think it is best to add this line to
`.bash_profile` (or the Mac Equivalent ????).
```bash
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Applications/PicoScope6.app/Contents/Resources/lib
```
Recently, this directory has moved to a new location See [Issue #143](https://github.com/colinoflynn/pico-python/issues/143)
```
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/Applications/PicoScope 6.app/Contents/Resources/lib"
```
See [Issue 80](https://github.com/colinoflynn/pico-python/issues/80#issuecomment-314149552) for more information on how this was found.
You should also add yourself to the pico group so that your user has access to the picoscope as a USB device
```bash
# Create the new pico group :
sudo dseditgroup -o create pico
# Add the current user to the pico group :
sudo dseditgroup -o edit -a $USER -t user pico
```
### Using Anaconda/Conda
Seems like Anaconda has an issue with ctypes. See the comment [here](https://github.com/pymedusa/Medusa/issues/1843#issuecomment-310126049) imdatacenters says to:
> If you are using a special version of Python [like Anaconda] and you can't fix it.
> Navigate to line 362 of lib/ctypes/init.py and change it to:
> `self._handle = _dlopen(str(self._name), mode)`
# Similar Projects
PicoPy uses Cython to interface with a PicoScope 3000A
https://github.com/hgomersall/PicoPy
Picoscope offers their official wrappers,
https://github.com/picotech/picosdk-python-wrappers
# Authors, Copyright, and Thanks
pico-python is Copyright (C) 2013 By:
* Colin O'Flynn <coflynn@newae.com>
* Mark Harfouche <mark.harfouche@gmail.com>
All rights reserved.
See LICENSE.md for license terms.
Inspired by Patrick Carle's code at http://www.picotech.com/support/topic11239.html
which was adapted from http://www.picotech.com/support/topic4926.html
# Contributing
1. Fork.
2. Make a new branch.
3. Commit to your new branch.
4. Add yourself to the authors/acknowledgments (whichever you find appropriate).
5. Submit a pull request.
Alternatively, you can follow more thorough instructions
[here](http://scikit-image.org/docs/dev/contribute.html).
# Developer notes
Commit and create a new tag with git
```
git commit
git tag -a X.Y.Z -m "Short descriptive message"
```
Push the tags to the repo
```
git push origin X.Y.Z
```
or to push all tags
```
git push --tags
```
[versioneer](https://github.com/warner/python-versioneer) takes care of updating the version.
New tags will be pushed to PyPi automatically by Travis.
Raw data
{
"_id": null,
"home_page": "https://github.com/colinoflynn/pico-python/",
"name": "picoscope",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "picoscope peripherals hardware oscilloscope ATE",
"author": "Colin O'Flynn, Mark Harfouche",
"author_email": "coflynn@newae.com, mark.harfouche@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/26/3e/bf99bccd47b45420f1e1dee08d14f2c8481e17dd49e7a2c1af2c2cb44bcf/picoscope-0.7.31.tar.gz",
"platform": null,
"description": "# pico-python\n[![Build Status](https://travis-ci.org/colinoflynn/pico-python.svg?branch=master)](https://travis-ci.org/colinoflynn/pico-python)\n\nThis is a Python 2.7+ library for the Pico Scope. It uses the provided DLL\nfor actual communications with the instrument. There have been a few examples\naround, but this one tries to improve on them via:\n * Subclass instrument-specific stuff, so can support more families\n * Use exceptions to raise errors, and gives you nice English error messages (copied from PS Manual)\n * Provide higher-level functions (e.g. just setup timebase, function deals with instrument-specific limitations)\n * Supports both Windows and Linux and Mac\n\nSystem has support for:\n * PS6000A Class (Picoscope 6xxxE)\n * PS6000\n * PS5000A Class (PicoScope 5242A/5243A/5244A/5442A/5443A/5444A/5242B/5244B/5442B/5443B/5444B)\n * PS4000A Class (PicoScope 4444/4824)\n * PS3000 Class (PicoScope 3204/3205/3206/3224/3424/3425)\n * PS3000A Class (PicoScope 3204A/3204B/3205A/3205B/3206A/3206B/3207A/3207B/3204/3205/3206/3404A/3404B/3405A/3405A/3406A/3406B)\n * PS2000 Class (PicoScope 2104/2105/2202/2203/2204/2205/2204A/2205A)\n * PS2000A Class (PicoScope 2206/2206A/2206B/2207/2207A/2207B/2208/2208A/2208B/2205A MSO/2206B MSO/2207B MSO/2208B MSO/2405A/2406B/2407B/2408B)\n\nNote the 'A' series covers a different ground than the non-A series! Check the programming manuals posted at http://www.picotech.com/document/ for details.\n\n\n## Installation\nYou need to install the Python module as well as the Picoscope libraries for your Operating system.\n\n### Module installation\n#### PyPi\n```\npip install picoscope\n```\n\n#### Git\nIf you are developping the library, or need some feature that we haven't pushed to PyPi yet, use\ngit clone to put the directory somewhere.\nThen use the setup.py script to install the library in development mode:\n```bash\ngit clone git@github.com:colinoflynn/pico-python.git\ncd pico-python\npython setup.py develop\n```\n\n### OS specific\n#### Windows\nYou will require the PicoScope DLLs for this package to work. The easiest method is to install the latest PicoScope software\nor SDK from https://www.picotech.com/downloads .\n\nYou may need to add the PicoScope install directory to the path, especially if changing between versions. Be sure you have installed a matching 32-bit or 64-bit version for your Python install.\n\n```\nimport os\npicoinstallpath = os.path.normpath(r\"C:\\Program Files\\Pico Technology\\PicoScope 7 T&M Early Access\")\nif picoinstallpath not in os.environ['PATH']:\n print(\"Adding Pico Install to Path\")\n os.environ['PATH'] = picoinstallpath + os.pathsep + os.environ['PATH']\nelse:\n print(\"Pico Install Already on Path\")\n```\n\n\n#### Linux\nInstall the PicoScope Beta for Linux version of PicoScope as describe under Getting DLL's (above). Currently this is the only way to install the shared libraries (SDK)\n\nOnce you have PicoScope running you need to add your login account to the pico group in order to access the USB. The examples will crash if you don't have permission to use the USB. This is true for use of the shared libraries in general, even if you're not using pico-python.\n\n```\nuseradd -G pico $USER\n```\n\n#### Mac OSX\nYou either want to add this every time before you start python or IPython, but I think it is best to add this line to\n`.bash_profile` (or the Mac Equivalent ????).\n```bash\nexport DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Applications/PicoScope6.app/Contents/Resources/lib\n```\n\nRecently, this directory has moved to a new location See [Issue #143](https://github.com/colinoflynn/pico-python/issues/143)\n```\nexport DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH:/Applications/PicoScope 6.app/Contents/Resources/lib\"\n```\n\nSee [Issue 80](https://github.com/colinoflynn/pico-python/issues/80#issuecomment-314149552) for more information on how this was found.\n\nYou should also add yourself to the pico group so that your user has access to the picoscope as a USB device\n```bash\n# Create the new pico group :\nsudo dseditgroup -o create pico\n# Add the current user to the pico group :\nsudo dseditgroup -o edit -a $USER -t user pico\n```\n\n### Using Anaconda/Conda\nSeems like Anaconda has an issue with ctypes. See the comment [here](https://github.com/pymedusa/Medusa/issues/1843#issuecomment-310126049) imdatacenters says to:\n> If you are using a special version of Python [like Anaconda] and you can't fix it.\n> Navigate to line 362 of lib/ctypes/init.py and change it to:\n> `self._handle = _dlopen(str(self._name), mode)`\n\n# Similar Projects\nPicoPy uses Cython to interface with a PicoScope 3000A\nhttps://github.com/hgomersall/PicoPy\n\nPicoscope offers their official wrappers,\nhttps://github.com/picotech/picosdk-python-wrappers\n\n# Authors, Copyright, and Thanks\npico-python is Copyright (C) 2013 By:\n * Colin O'Flynn <coflynn@newae.com>\n * Mark Harfouche <mark.harfouche@gmail.com>\n\nAll rights reserved.\nSee LICENSE.md for license terms.\n\nInspired by Patrick Carle's code at http://www.picotech.com/support/topic11239.html\nwhich was adapted from http://www.picotech.com/support/topic4926.html\n\n# Contributing\n1. Fork.\n2. Make a new branch.\n3. Commit to your new branch.\n4. Add yourself to the authors/acknowledgments (whichever you find appropriate).\n5. Submit a pull request.\n\nAlternatively, you can follow more thorough instructions\n[here](http://scikit-image.org/docs/dev/contribute.html).\n\n# Developer notes\nCommit and create a new tag with git\n```\ngit commit\ngit tag -a X.Y.Z -m \"Short descriptive message\"\n```\n\nPush the tags to the repo\n```\ngit push origin X.Y.Z\n```\n\nor to push all tags\n```\ngit push --tags\n```\n\n[versioneer](https://github.com/warner/python-versioneer) takes care of updating the version.\nNew tags will be pushed to PyPi automatically by Travis.\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Unofficial python wrapper for the PicoScope devices.",
"version": "0.7.31",
"project_urls": {
"Homepage": "https://github.com/colinoflynn/pico-python/"
},
"split_keywords": [
"picoscope",
"peripherals",
"hardware",
"oscilloscope",
"ate"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b305e7c1c2027a8f4dd0ce1c0633fb8424c3058bb756f698435a521b645cab79",
"md5": "8d868fbeb97e13b78d8f598633d80dd4",
"sha256": "e29551aaf3ff65032f5707c23d8733446ad21f4cf23db6aaea06155282f1a1f3"
},
"downloads": -1,
"filename": "picoscope-0.7.31-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8d868fbeb97e13b78d8f598633d80dd4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 87560,
"upload_time": "2024-05-31T01:37:11",
"upload_time_iso_8601": "2024-05-31T01:37:11.931786Z",
"url": "https://files.pythonhosted.org/packages/b3/05/e7c1c2027a8f4dd0ce1c0633fb8424c3058bb756f698435a521b645cab79/picoscope-0.7.31-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "263ebf99bccd47b45420f1e1dee08d14f2c8481e17dd49e7a2c1af2c2cb44bcf",
"md5": "fda7b1057201a26a9f0352e178fda5bf",
"sha256": "443b03310830b137148ce0d9de59313fa0ab9bcc4ffef0d4c9093970fcefee90"
},
"downloads": -1,
"filename": "picoscope-0.7.31.tar.gz",
"has_sig": false,
"md5_digest": "fda7b1057201a26a9f0352e178fda5bf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 85755,
"upload_time": "2024-05-31T01:37:14",
"upload_time_iso_8601": "2024-05-31T01:37:14.043902Z",
"url": "https://files.pythonhosted.org/packages/26/3e/bf99bccd47b45420f1e1dee08d14f2c8481e17dd49e7a2c1af2c2cb44bcf/picoscope-0.7.31.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-31 01:37:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "colinoflynn",
"github_project": "pico-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "picoscope"
}