|
1 | | -# PicoScope 6000 Series (A API) - MATLAB Generic Instrument Driver |
| 1 | +# picosdk-python-wrappers |
2 | 2 |
|
3 | | -This MATLAB<sup>®</sup> Generic Instrument Driver allows you to acquire data from the PicoScope<sup>®</sup> 6000 Series oscilloscopes and control built-in signal generator functionality. The data could be processed in MATLAB using functions from Toolboxes such as [Signal Processing Toolbox](https://www.mathworks.com/products/signal.html). |
| 3 | +Welcome to the PicoSDK for Python. It allows you to control PicoScope devices in your own Python programs. |
4 | 4 |
|
5 | | -The driver has been created using Instrument Control Toolbox (TBC). |
| 5 | +## Getting started |
6 | 6 |
|
7 | | -This Instrument Driver package includes the following: |
| 7 | +To use this code you will need to install the PicoSDK C libraries. |
8 | 8 |
|
9 | | -* The MATLAB Generic Instrument Driver |
10 | | -* Example scripts that demonstrate how to call functions in order to capture data in various collection modes, as well as using the signal generator. |
| 9 | +### Microsoft Windows |
11 | 10 |
|
12 | | -The driver can be used with the Test and Measurement Tool to carry out the following: |
| 11 | +Please visit [our Downloads page](https://www.picotech.com/downloads) to download the 32-bit or 64-bit PicoSDK C Libraries for Windows. |
| 12 | +Please take care to match the "bitness" of your python to the PicoSDK. |
13 | 13 |
|
14 | | - * Acquire data in Block mode |
15 | | - * Acquire data in Rapid Block mode |
16 | | - * Use the Built-in Function/Arbitrary Waveform Generator (model-dependent) |
| 14 | +### Linux |
17 | 15 |
|
18 | | -## Supported Models |
| 16 | +Follow the instructions from our [Linux Software & Drivers for Oscilloscopes and Data Loggers page](https://www.picotech.com/downloads/linux) |
| 17 | +to install the required driver packages for your product. |
19 | 18 |
|
20 | | -The driver will work with the following PicoScope models: |
21 | | - |
22 | | - * 6000E Scopes |
| 19 | +### macOS |
23 | 20 |
|
24 | | -**Note:** The driver will not work with the [PicoScope 6000A/B/C/D models](https://uk.mathworks.com/matlabcentral/fileexchange/48311-picoscope-6000-series-matlab-generic-instrument-driver) devices. |
| 21 | +Please visit [our Downloads page](https://www.picotech.com/downloads) to download the PicoSDK C Libraries for MacOS. |
25 | 22 |
|
26 | | -## Getting started |
| 23 | +## Installing the python driver bindings |
27 | 24 |
|
28 | | -### Prerequisites |
| 25 | +A `distutils` installer is provided. After you have installed the PicoSDK |
| 26 | +driver package (see above), the Python package can be installed using the |
| 27 | +following command in the top-level directory: |
29 | 28 |
|
30 | | -* [MATLAB](https://uk.mathworks.com/products/matlab.html) for Microsoft Windows or Linux operating systems. |
31 | | -* [Instrument Control Toolbox](http://www.mathworks.co.uk/products/instrument/) |
32 | | -* The [PicoScope Support Toolbox](http://uk.mathworks.com/matlabcentral/fileexchange/53681-picoscope-support-toolbox) |
| 29 | + pip install . |
33 | 30 |
|
34 | | -**Currently with this beta release only 64-bit MATLAB on Windows is supported. Support for other operation systems will come in further updates.** |
| 31 | +If you are not using a virtualenv or are not elevated, use: |
35 | 32 |
|
36 | | -**Note:** MATLAB 2015b is recommended for 32-bit versions of MATLAB on Microsoft Windows operating systems. |
| 33 | + python setup.py install |
| 34 | + |
| 35 | +======= |
| 36 | +For using the AS108 you will need to use the following as well: |
37 | 37 |
|
38 | | -### Installing the Instrument Driver files |
| 38 | + python setupPicosynth.py install |
| 39 | + |
39 | 40 |
|
40 | | -We recommend using the [Add-Ons Explorer](https://uk.mathworks.com/help/matlab/matlab_env/get-add-ons.html) in MATLAB in order to install these files and obtain updates. |
| 41 | +On macOS and Linux you will either need to use `sudo` with this command, to |
| 42 | +install into the system folders, or to install for the current user only you |
| 43 | +can use: |
41 | 44 |
|
42 | | -If your version of MATLAB does not have the Add-Ons Explorer, download the zip file from the [MATLAB Central File Exchange page]() |
43 | | - and add the root and subfolders to the MATLAB path. |
| 45 | + pip install . --user |
44 | 46 |
|
45 | | -### Installing drivers |
| 47 | +Within python, the library for `import` is called `picosdk`. |
46 | 48 |
|
47 | | -Drivers are available for the following platforms. Refer to the subsections below for further information. |
| 49 | +## Compatibility |
48 | 50 |
|
49 | | -#### Windows |
| 51 | +This code is written to be compatible with both Python 2.7 and Python 3 (any version). |
50 | 52 |
|
51 | | -* Download the PicoSDK (32-bit or 64-bit) driver package installer from our [Downloads page](https://www.picotech.com/downloads). |
| 53 | +If you find a compatibility problem please raise an [Issue](https://www.picotech.com/tech-support), listing all the versions you can find (python, numpy, |
| 54 | +picosdk commit hash, etc.) and your error message(s). |
52 | 55 |
|
53 | | -#### Linux |
| 56 | +## C interface |
54 | 57 |
|
55 | | -* Follow the instructions on our [Linux Software & Drivers for Oscilloscopes and Data Loggers page](https://www.picotech.com/downloads/linux) to install the required `libps6000a` and `libpswrappers` driver packages. |
| 58 | +You can access C driver functions directly (ctypes calls) by their original C name, following the [Programmer's |
| 59 | +Guides](https://github.com/picotech/picosdk-python-wrappers#programmers-guides) exactly. Examples are provided in the folders like `psX000[a]Examples/`. |
56 | 60 |
|
57 | | -## Obtaining support |
| 61 | +### Programmer's Guides |
| 62 | + |
| 63 | +You can download Programmer's Guides providing a description of the API functions for the relevant PicoScope or |
| 64 | +PicoLog driver from our [Documentation page](https://www.picotech.com/library/documentation). |
| 65 | + |
| 66 | +## Python interface |
| 67 | + |
| 68 | +We are in the process of adding Pythonic wrappers around the C functions. If we haven't got to your feature yet or your device is listed as one of the [unsupported models](https://github.com/picotech/picosdk-python-wrappers#unsupported-models), |
| 69 | +let us know that you're waiting in an [Issue](https://www.picotech.com/tech-support) |
| 70 | + |
| 71 | +### Unsupported models |
| 72 | + |
| 73 | +The following drivers and devices are not yet supported: |
| 74 | + |
| 75 | +* `plcm3` - PicoLog CM3 Current Data Logger |
| 76 | +* `ps3000` - PicoScope 3204, 3205, 3206, 3223, 3224, 3423 & 3423 |
| 77 | + |
| 78 | +### Dependencies |
| 79 | + |
| 80 | +As well as depending on the C libraries, the Python wrappers use some Python libraries like `numpy`. Many of the |
| 81 | +examples scripts also use the `matplotlib` plotting library. You can install these dependencies with pip as follows: |
| 82 | + |
| 83 | + pip install -r requirements.txt |
| 84 | + pip install -r requirements-for-examples.txt |
| 85 | + |
| 86 | +### Driver-agnostic examples |
| 87 | + |
| 88 | +The `anyScopeExamples` folder contains examples in pure python which do the same thing as the C-style examples, but |
| 89 | +in a driver-generic way. These examples are currently not being developed further but are still avaliable to use |
| 90 | +and develop futher yourself. |
| 91 | + |
| 92 | +### Python Classes |
58 | 93 |
|
59 | | -Please visit our [Support page](https://www.picotech.com/tech-support) to contact us directly or visit our [Test and Measurement Forum](https://www.picotech.com/support/forum71.html) to post questions. |
| 94 | +#### Library |
60 | 95 |
|
61 | | -Please leave a comment and rating for this submission on our [MATLAB Central File Exchange page](). |
| 96 | +`picosdk.library.Library` contains a base class for each of the driver classes. It does the job of translating python |
| 97 | +types into C ones, and back again, and some unit conversions to get rid of nano, micro and milli-style prefixes. It also |
| 98 | +handles any differences in programming API between PicoScope driver versions. |
62 | 99 |
|
63 | | -## Versioning |
| 100 | +#### Device |
64 | 101 |
|
65 | | -For the versions available, and release notes, refer to the [Releases](https://github.com/picotech/picosdk-ps6000a-matlab-instrument-driver/releases) page. |
| 102 | +`picosdk.device.Device` contains the concrete class which represents a PicoScope with a valid handle. It caches some |
| 103 | +information about the device state, like the currently selected voltage ranges of the channels. |
| 104 | + |
| 105 | +It is implemented in terms of the Library class' public interface, and deals almost entirely with python types. The |
| 106 | +main exception is its handling of numpy arrays - it (knowing the voltage ranges) is responsible for converting the raw |
| 107 | +ADC counts that the driver uses for amplitude into physical units. |
| 108 | + |
| 109 | +## Testing this code |
| 110 | + |
| 111 | +Check which device driver your device uses, and check the constants at the top of test/test_helpers.py to enable the |
| 112 | +relevant drivers for connected-device tests. (most tests use this). |
| 113 | + |
| 114 | +To check which driver your device uses, you can use `picosdk.discover`: |
| 115 | + |
| 116 | + from picosdk.discover import find_all_units |
| 117 | + |
| 118 | + scopes = find_all_units() |
| 119 | + |
| 120 | + for scope in scopes: |
| 121 | + print(scope.info) |
| 122 | + scope.close() |
| 123 | + |
| 124 | +You should then configure test/test_helpers.py's list of connected devices, so it can run all the tests we have |
| 125 | +on your device. |
| 126 | + |
| 127 | +To run the unit tests, you will need to install nose (e.g. `pip install nose`.) Then, run `nosetests` in the root of |
| 128 | +the repo. |
| 129 | + |
| 130 | +## Obtaining support |
| 131 | + |
| 132 | +Please visit our [Support page](https://www.picotech.com/tech-support) to contact us directly or visit our [Test and Measurement Forum](https://www.picotech.com/support/forum17.html) to post questions. |
66 | 133 |
|
67 | 134 | ## Copyright and licensing |
68 | 135 |
|
69 | 136 | See [LICENSE.md](LICENSE.md) for license terms. |
70 | 137 |
|
71 | | -*PicoScope* is a registered trademark of Pico Technology Ltd. |
72 | | - |
73 | | -*MATLAB* is a registered trademark of The Mathworks, Inc. *Instrument Control Toolbox* and *Signal Processing Toolbox* |
74 | | -are trademarks of The Mathworks, Inc. |
| 138 | +*PicoScope*, *PicoLog* and *PicoSDK* are registered trademarks of Pico Technology Ltd. |
75 | 139 |
|
76 | 140 | *Windows* is a registered trademark of Microsoft Corporation. |
77 | 141 |
|
78 | | -*Linux* is the registered trademark of Linus Torvalds in the U.S. and other countries. |
| 142 | +*macOS* is a registered trademark of Apple Inc. |
79 | 143 |
|
80 | | -Copyright © 2020-2021 Pico Technology Ltd. All rights reserved. |
| 144 | +*Linux* is the registered trademark of Linus Torvalds in the U.S. and other countries. |
81 | 145 |
|
| 146 | +Copyright © 2018-2019 Pico Technology Ltd. All rights reserved. |
0 commit comments