Skip to content

Commit c7863d1

Browse files
author
neil.hamilton
committed
Merge branch 'master'
# Conflicts: # .gitignore # LICENSE.md # README.md
2 parents ede366c + 9fbe508 commit c7863d1

File tree

110 files changed

+23129
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+23129
-0
lines changed

.github/CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Contributing
2+
3+
We welcome contributions to the picosdk-python-examples repository. By contributing to this repository, you agree to abide by our [code of conduct](CODE_OF_CONDUCT.md).
4+
5+
## Steps to contribute
6+
7+
1. Fork, then clone the repository:
8+
9+
```
10+
git clone https://github.com/YOUR-USERNAME/picosdk-python-wrappers.git
11+
```
12+
13+
2. Create a new branch - specify a name in lowercase, using hyphens to link words e.g. `fft-example`
14+
15+
3. Push to the new branch on your fork, and then submit a pull request.
16+
17+
We will then review the pull request.
18+
19+
## Pull request guidelines
20+
21+
* Follow the conventions in the other file headers if adding a new file, or changing an existing file
22+
* If contributing a new file, ensure that it is in the appropriate location in the repository directory structure
23+
* [Commit messages](https://chris.beams.io/posts/git-commit/#seven-rules) should clearly communicate the reason for the change

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Fixes #.
2+
3+
Changes proposed in this pull request:
4+
5+
*
6+
*
7+
*

.github/issue_template.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
### Setup
2+
3+
* Example filename:
4+
* Version of Python:
5+
* Pico Technology device model:
6+
* Driver name, version number and platform (32- or 64-bit):
7+
* Operating system:
8+
* USB port type (e.g. 2.0):
9+
10+
### Description
11+
12+
#### Steps to reproduce the issue
13+
14+
Use one of two methods to describe the issue:
15+
16+
1. A list of steps to reproduce the issue.
17+
1. A natural language description of what you were doing when the issue occurred if you are unable to work out what the steps are.
18+
19+
#### Actual Result
20+
21+
22+
23+
#### Expected Result
24+
25+
26+
27+
### Notes
28+
29+
Include any other information here.

anyScopeExamples/block.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Copyright (C) 2018 Pico Technology Ltd. See LICENSE file for terms.
3+
#
4+
from __future__ import print_function
5+
from picosdk.discover import find_unit
6+
from picosdk.device import ChannelConfig, TimebaseOptions
7+
import matplotlib.pyplot as plt
8+
9+
with find_unit() as device:
10+
11+
print("found PicoScope: %s" % (device.info,))
12+
13+
channel_configs = [ChannelConfig('A', True, 'DC', 5.)]
14+
microsecond = 1.e-6
15+
# the entry-level scopes only have about 8k-samples of memory onboard for block mode, so only ask for 6k samples.
16+
timebase_options = TimebaseOptions(microsecond, None, 6000 * microsecond)
17+
18+
times, voltages, overflow_warnings = device.capture_block(timebase_options, channel_configs)
19+
20+
for channel, data in voltages.items():
21+
label = "Channel %s" % channel
22+
if channel in overflow_warnings:
23+
label += " (over range)"
24+
plt.plot(times, data, label=label)
25+
26+
plt.xlabel('Time / s')
27+
plt.ylabel('Amplitude / V')
28+
plt.legend()
29+
plt.show()
30+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# Copyright (C) 2019 Pico Technology Ltd. See LICENSE file for terms.
3+
#
4+
# PICOLOG HIGH RESOLUTION DATA LOGGER SINGLE MODE EXAMPLE
5+
#
6+
# This example demonstrates how to capture a single value from an ADC-20 or ADC-24 Precision Data Logger.
7+
8+
9+
import ctypes
10+
import numpy as np
11+
from picosdk.picohrdl import picohrdl as hrdl
12+
from picosdk.functions import assert_pico2000_ok
13+
14+
# Create chandle and status ready for use
15+
chandle = ctypes.c_int16()
16+
status = {}
17+
18+
# Open unit
19+
status["openUnit"] = hrdl.HRDLOpenUnit()
20+
assert_pico2000_ok(status["openUnit"])
21+
chandle=status["openUnit"]
22+
23+
# Set mains noise rejection
24+
# Reject 50 Hz mains noise
25+
status["mainsRejection"] = hrdl.HRDLSetMains(chandle, 0)
26+
assert_pico2000_ok(status["mainsRejection"])
27+
28+
# Set single reading
29+
range = hrdl.HRDL_VOLTAGERANGE["HRDL_2500_MV"]
30+
conversionTime = hrdl.HRDL_CONVERSIONTIME["HRDL_100MS"]
31+
overflow = ctypes.c_int16(0)
32+
value = ctypes.c_int32()
33+
status["getSingleValue"] = hrdl.HRDLGetSingleValue(chandle, 5, range, conversionTime, 1, ctypes.byref(overflow), ctypes.byref(value))
34+
assert_pico2000_ok(status["getSingleValue"])
35+
36+
# Display value
37+
print(value.value)
38+
39+
# Close unit
40+
status["closeUnit"] = hrdl.HRDLCloseUnit(chandle)
41+
assert_pico2000_ok(status["closeUnit"])
42+
43+
# Print status
44+
print(status)

0 commit comments

Comments
 (0)