pycosdk
Yet another wrapper for the PicoSDK.
pycosdk is a thin, fully type-annotated ctypes binding to Pico Technology's
PicoScope driver libraries. It stays deliberately close to the C API: method
names mirror the driver functions, and the enums and structs are transcribed
from the SDK headers as IntEnum/IntFlag and ctypes.Structure types.
Requirements
- Python 3.11+
- The PicoSDK drivers, installed separately.
pycosdkdoes not bundle or install them — it locates the shared libraries at runtime viactypes.util.find_library. Download them from picotech.com/downloads.
Installation
pip install pycosdk
Supported drivers
| Driver | Wrapper class |
|---|---|
ps3000a |
PicoScope3000aWrapper |
ps5000a |
PicoScope5000aWrapper |
ps6000 |
PicoScope6000Wrapper |
ps6000a |
PicoScope6000aWrapper |
psospa |
PicoScope3000eWrapper |
Each wrapper binds every function declared in the corresponding SDK header
(for ps6000a including ps6000aApiExperimental.h). Functions that the
installed driver does not export raise MissingFunctionException when called,
so an older driver version does not prevent the wrapper from loading.
Usage
Instantiating a wrapper loads the corresponding shared library. Pass an
explicit library_path if it is not on the default search path; otherwise a
MissingLibraryException is raised when the library cannot be found.
Methods return the driver's PICO_STATUS as an enum member, followed by any
output parameters. By default, a status other than PICO_OK raises a
StatusException (see Status handling).
from pycosdk import (
PICO_BANDWIDTH_LIMITER,
PICO_CHANNEL,
PICO_CONNECT_PROBE_RANGE,
PICO_COUPLING,
PICO_DEVICE_RESOLUTION,
PicoScope6000aWrapper,
)
scope = PicoScope6000aWrapper()
status, handle = scope.ps6000aOpenUnit(None, PICO_DEVICE_RESOLUTION.PICO_DR_8BIT)
scope.ps6000aSetChannelOn(
handle,
PICO_CHANNEL.PICO_CHANNEL_A,
PICO_COUPLING.PICO_DC_50OHM,
PICO_CONNECT_PROBE_RANGE.PICO_X1_PROBE_1V,
0.0,
PICO_BANDWIDTH_LIMITER.PICO_BW_FULL,
)
scope.ps6000aCloseUnit(handle)
Status handling
Non-OK statuses fall into three categories, each handled by one of the actions
"raise" (raise StatusException), "warn" (emit a StatusWarning) or
"ignore". Unless a method raises, it still returns the status.
| Category | Statuses | Default |
|---|---|---|
error |
everything not covered below | "raise" |
warning |
PICO_WARNING_* and PICO_SHOTS_SWEEPS_WARNING |
"warn" |
info |
statuses a specific function uses to report a non-error condition | "ignore" |
Examples for info statuses are the power-source statuses returned by
ps3000aOpenUnit or ps5000aCurrentPowerSource (e.g.
PICO_POWER_SUPPLY_NOT_CONNECTED) and PICO_WAITING_FOR_DATA_BUFFERS from
ps6000aGetStreamingLatestValues.
Like NumPy's seterr/errstate, the configuration is global rather than per
wrapper instance:
import pycosdk
# Process-wide; returns the previous settings.
old = pycosdk.seterr(error="warn", info="warn")
pycosdk.seterr(**old)
# Temporarily, as context manager or decorator. Overrides are local to the
# current thread / asyncio task.
with pycosdk.errstate(error="ignore"):
status = scope.ps6000aStop(handle)
try:
scope.ps6000aSetChannelOn(handle, ...)
except pycosdk.StatusException as e:
print(e.function, e.status)
Callbacks registered with the driver (e.g. via RunBlock or the
Set*InteractionCallback functions) receive the status as a parameter and are
not subject to this configuration. The wrappers keep references to the
callback objects handed to the driver, so passing a lambda is safe.
Type checking
The package ships a py.typed marker, so annotations are visible to mypy,
pyright, and friends.
License
MIT License — see LICENSE.
Metadata
Release files for pycosdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pycosdk-0.1.0.tar.gz | 77.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycosdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 160.0 kB
Release files / pycosdk-0.1.0.tar.gz
| Download URL | pycosdk-0.1.0.tar.gz |
|---|---|
| Size | 77.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37f60486bfd5243b117ea1f6f57e310c75c11318671f6d01121c522a12ec9cf1
|
|
BLAKE2b-256 checksum How to use checksums |
4881a9e579515d01f5608b890a9cfa272e09bf2ca907be3258da57d0f2068e96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pycosdk-0.1.0-py3-none-any.whl
| Download URL | pycosdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 82.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a8efdf3d3ad997ee723bc85fd13b318214570780e15d82746c68c24c5531242
|
|
BLAKE2b-256 checksum How to use checksums |
d5346bebc3c82038b3c5f81f18579136c02f4ec76d3b805bcc23a9a1fe9c83b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for pycosdk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.