Coder Social home page Coder Social logo

picotech / picosdk-python-examples Goto Github PK

View Code? Open in Web Editor NEW
22.0 7.0 11.0 205 KB

DEPRECATED - An example Python application and examples for PicoScope® oscilloscope products.

License: ISC License

Python 100.00%
python python-2 python2-7 picoscope picoscope-oscilloscope windows linux macos deprecated archived

picosdk-python-examples's Introduction

DEPRECATED

This repository is no longer supported, please consider using picosdk-python-wrappers instead.

This repository contains an example Python module for PicoScope oscilloscopes.

Getting started

Prerequisites

  • A PicoScope oscilloscope using one of the following PicoScope drivers:
    • ps2000
    • ps2000a
    • ps3000
    • ps3000a
    • ps4000
    • ps4000a
    • ps5000a
    • ps6000
  • Python 2.7

Microsoft Windows

  • For best experience on Microsoft Windows Python(x,y) suite is recommended. Note that this will require the 32-bit PicoSDK to be installed (see Installing drivers)

Linux and Mac OS X

  • For Streaming mode data collection, the pytables module is required.
  • The block_capture and streaming_capture examples require matplotlib and signal.
  • PicoPyScope example has been written for use with PyQtGraph.

Notes: The code is not much different from Python3 and can be easily converted with the 2to3 utility. The module has been tested and proved working on Linux (including ARM derivatives), Microsoft Windows and Mac OS X.

Installing drivers

Drivers are available for the following platforms. Refer to the subsections below for further information.

Microsoft Windows

  • Download the PicoSDK (32-bit or 64-bit) driver package installer from our Downloads page.

Linux

Mac OS X

  • Visit our Downloads page and download the PicoScope Beta for Mac OS X application.

Installing the python driver bindings

A distutils installer is provided. After you have installed the PicoSDK driver package (see above), the Python installer can be used as follows:

python setup.py install

On macOS and Linux you will either need to use sudo with this command, to install into the system folders, or to install for the current user only you can use:

python setup.py install --user

Within python, the library for import is called picosdk.

Scripts

python-picoscope

  • block_capture.py - comprehensive suite for testing block collection (-h to see all options)
  • stream_capture.py - streaming testing utility, including some performance tests (-h to see all options)
  • picopyscope.py - simple PC oscilloscope UI

Note: A basic script requires just a few lines as below. Most functions have been decorated with docstrings.

from picosdk import ps2000

if __name__ == "__main__":
    ps = ps2000.Device()
    status = ps.open_unit()
    if status == ps.m.pico_num("PICO_OK"):
        s, state = ps.get_channel_state(channel=ps.m.Channels.A)
        state.enabled = True
        state.range = ps.m.Ranges.r5v
        status = ps.set_channel(channel=ps.m.Channels.A, state=state)
        if status == ps.m.pico_num("PICO_OK"):
            s, index = ps.locate_buffer(channel=ps.m.Channels.A,
                                        samples=1000,
                                        segment=0,
                                        mode=ps.m.RatioModes.raw,
                                        downsample=0)
            status = ps.collect_segment(segment=0, interval=1000)
            if status == ps.m.pico_num("PICO_OK"):
                status, data = ps.get_buffer_volts(index=index)
                print data
                exit(0)
    print ps.m.pico_tag(status)

Programmer's Guides

You can download Programmer's Guides providing a description of the API functions for the relevant PicoScope or PicoLog driver from our Documentation page.

Obtaining support

Please visit our Support page to contact us directly or visit our Test and Measurement Forum to post questions.

Contributing

Contributions are welcome. Please refer to our guidelines for contributing for further information.

Applications written by our customers

The following are Python examples written by our customers:

The following is a fork of this repository:

Copyright and licensing

See LICENSE.md for license terms.

PicoScope and PicoLog are registered trademarks of Pico Technology Ltd.

Windows is a registered trademark of Microsoft Corporation.

Mac and OS X are registered trademarks of Apple, Inc.

Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.

Copyright © 2014-2018 Pico Technology Ltd. All rights reserved.

picosdk-python-examples's People

Contributors

hsmistry avatar neil-hamilton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

picosdk-python-examples's Issues

Issues under Mac OS due to System Integrity Protection

Setup

  • Example filename: Any
  • Version of Python: 2.7
  • Pico Technology device model: 2206B
  • Driver name and version number: Current
  • Operating system: Mac OS X 10.12 and 10.13
  • USB port type (e.g. 2.0): 3.0

Description

The scripts don't work under newer Mac OS versions, the problem is that the PicoScope libraries cannot be loaded. This is due to System Integrity Protection since El Capitan. Full documentation (with workaround) is here.

basic script not work for 2208B, pico-not-found

Setup

  • Example filename: basic script
  • Version of Python: python3.6.0
  • Pico Technology device model: 2208B
  • Driver name and version number:picosdk_64_10.6.12.41
  • Operating system:win7, 64bit
  • USB port type (e.g. 2.0):2.0

Description

run basic script, got results as "PICO-NOT-FOUND", but pico can be found by the PicoScope6 software

Rapid Block Mode

Setup

  • Example filename: Any
  • Version of Python: 2.7
  • Pico Technology device model: 6404D
  • Driver name and version number: PS6000 Linux Driver, 1.7.0.10
  • Operating system: Ubuntu 16.04
  • USB port type (e.g. 2.0): 3.0

Description

Hi,
How can I use this library for the rapid block mode? I read the section 2.5.2 from Picoscope 6000 Series Programmers Guide, but in this library some methods are not implemented. I already tried the Pico-Python Library [1], but I have some problems with the rapid block mode (I get some random data, not waveforms). The problems persists on Windows, Linux and MacOs, and I have no idea what to do.

I want to try this library to see if the problem persists, but I don't know how to use rapid block mode.
Thanks

[1] - https://github.com/colinoflynn/pico-python/

"stream_capture.py" example not working on windows machine with tape_file specified

Setup

  • Example filename: stream_capture.py
  • Version of Python: 2.7
  • Pico Technology device model: 3205DMSO
  • Driver name and version number: Driver: 1.6.0.17 fw: 1.4.0.0/1.0.66.0
  • Operating system: Windows 10 64 bit
  • USB port type (e.g. 2.0): 2.0

Description

Get the error:
ERRO: Streaming has not started within reasonable timescale

Steps to reproduce the issue

Run the example stream_capture.py on a Windows machine with the following command:
>>python.exe stream_capture.py --output="./" --tape-filename="C:/test.txt"

The program produces the error stated above.

pico_test.py ImportError: DLL load failed: The specified module could not be found.

Setup

  • Example filename: pico_test.py
  • Version of Python: Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
  • Pico Technology device model: PicoScope 2204A
  • Driver name and version number: 2.3.0.6
  • Operating system: Microsoft Windows [Version 10.0.15063]
  • USB port type (e.g. 2.0): 2.0

Description

Running pico_test.py I get the following result:

Traceback (most recent call last):
  File "C:\Python27\lib\unittest\case.py", line 329, in run
    testMethod()
  File "C:\Python27\lib\site-packages\nose\loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "C:\Python27\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "C:\Python27\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "C:\Users\wittrup\Documents\GitHub\picosdk-python-examples\python-picoscope\pico_test.py", line 14, in <module>
    import numpy as np
  File "C:\Python27\lib\site-packages\numpy\__init__.py", line 170, in <module>
    from . import add_newdocs
  File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 18, in <module>
    from .polynomial import *
  File "C:\Python27\lib\site-packages\numpy\lib\polynomial.py", line 19, in <module>
    from numpy.linalg import eigvals, lstsq, inv
  File "C:\Python27\lib\site-packages\numpy\linalg\__init__.py", line 51, in <module>
    from .linalg import *
  File "C:\Python27\lib\site-packages\numpy\linalg\linalg.py", line 29, in <module>
    from numpy.linalg import lapack_lite, _umath_linalg
ImportError: DLL load failed: The specified module could not be found.

Notes

From command line I may run:

c:\Python27\Scripts>python
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy.linalg import lapack_lite, _umath_linalg
>>>

So, how may I fix this error?
How may it be that pico_test.py fails to import stuff the console is able to import?

Can't extract data from a 5204

Setup

  • Example filename: Any
  • Version of Python: 3.5 (I used 2to3 to do the conversion)
  • Pico Technology device model: 5204
  • Driver name and version number: Current
  • Operating system: Linux Debian 9.4
  • USB port type (e.g. 2.0): 2.0 and 3.0

Description

Using the python example provided in the README.md and the pull request #9, I can't extract any data. I always get the PICO_SEGMENT_OUT_OF_RANGE error.

Steps to reproduce the issue

Use my #9 with a 5204 and execute the snippet.

Actual Result

PICO_SEGMENT_OUT_OF_RANGE error.

Expected Result

Some data

TypeError: p_test() missing 1 required positional argument: 'title'

Hi

When running pico_test.py I get the following errors/output:

C:\Users\wittrup\AppData\Local\Continuum\Anaconda3\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.3\helpers\pycharm\_jb_nosetest_runner.py" --path C:/Users/wittrup/Documents/GitHub/picosdk-python-examples/python-picoscope/pico_test.py
Testing started at 08.37 ...
Launching Nosetest with arguments C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.3\helpers\pycharm\_jb_nosetest_runner.py C:/Users/wittrup/Documents/GitHub/picosdk-python-examples/python-picoscope/pico_test.py in C:\Users\wittrup\Documents\GitHub\picosdk-python-examples\python-picoscopeE
======================================================================
ERROR: pico_test.p_test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\wittrup\AppData\Local\Continuum\Anaconda3\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
TypeError: p_test() missing 1 required positional argument: 'title'
-------------------- >> begin captured stdout << ---------------------



--------------------- >> end captured stdout << ----------------------

----------------------------------------------------------------------
Ran 1 test in 0.004s

FAILED (errors=1)

Error
Traceback (most recent call last):
  File "C:\Users\wittrup\AppData\Local\Continuum\Anaconda3\lib\unittest\case.py", line 59, in testPartExecutor
    yield
  File "C:\Users\wittrup\AppData\Local\Continuum\Anaconda3\lib\unittest\case.py", line 601, in run
    testMethod()
  File "C:\Users\wittrup\AppData\Local\Continuum\Anaconda3\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
Exception: p_test() missing 1 required positional argument: 'title'





Process finished with exit code 1

How may I overcome this issue?

AttributeError: module 'PyQt5.QtCore' has no attribute 'SIGNAL'

Hi

After installing PyQt5 and pyqtgraph, I ran into this error when running picopyscope.py:

Traceback (most recent call last):
  File "C:/Users/wittrup/Documents/GitHub/picosdk-python-examples/python-picoscope/picopyscope.py", line 155, in <module>
    class PicoPyDeviceWorker(QtCore.QObject):
  File "C:/Users/wittrup/Documents/GitHub/picosdk-python-examples/python-picoscope/picopyscope.py", line 156, in PicoPyDeviceWorker
    finished = QtCore.SIGNAL("finished")
AttributeError: module 'PyQt5.QtCore' has no attribute 'SIGNAL'

How to remedy this error?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.