rigol-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rigol_mcp-0.1.0/.env.example +38 -0
- rigol_mcp-0.1.0/.gitattributes +2 -0
- rigol_mcp-0.1.0/.github/workflows/ci.yml +39 -0
- rigol_mcp-0.1.0/.github/workflows/release.yml +109 -0
- rigol_mcp-0.1.0/.gitignore +12 -0
- rigol_mcp-0.1.0/.python-version +1 -0
- rigol_mcp-0.1.0/LICENSE +21 -0
- rigol_mcp-0.1.0/PKG-INFO +180 -0
- rigol_mcp-0.1.0/README.md +156 -0
- rigol_mcp-0.1.0/docs/acquisition-export.md +60 -0
- rigol_mcp-0.1.0/docs/hardware-support.md +72 -0
- rigol_mcp-0.1.0/docs/hardware-testing.md +42 -0
- rigol_mcp-0.1.0/docs/lan-connection.md +28 -0
- rigol_mcp-0.1.0/docs/releases/0.1.0.md +7 -0
- rigol_mcp-0.1.0/docs/releasing.md +28 -0
- rigol_mcp-0.1.0/docs/remote-operation.md +252 -0
- rigol_mcp-0.1.0/docs/usb-connection.md +56 -0
- rigol_mcp-0.1.0/examples/check_connection.py +17 -0
- rigol_mcp-0.1.0/examples/read_acquisition.py +58 -0
- rigol_mcp-0.1.0/media/example.png +0 -0
- rigol_mcp-0.1.0/pyproject.toml +57 -0
- rigol_mcp-0.1.0/src/rigol_mcp/__init__.py +0 -0
- rigol_mcp-0.1.0/src/rigol_mcp/acquisition_settings.py +298 -0
- rigol_mcp-0.1.0/src/rigol_mcp/drivers.py +499 -0
- rigol_mcp-0.1.0/src/rigol_mcp/lan.py +98 -0
- rigol_mcp-0.1.0/src/rigol_mcp/memory_export.py +278 -0
- rigol_mcp-0.1.0/src/rigol_mcp/models.py +84 -0
- rigol_mcp-0.1.0/src/rigol_mcp/models.toml +98 -0
- rigol_mcp-0.1.0/src/rigol_mcp/scope.py +1190 -0
- rigol_mcp-0.1.0/src/rigol_mcp/scpi.py +41 -0
- rigol_mcp-0.1.0/src/rigol_mcp/server.py +1005 -0
- rigol_mcp-0.1.0/src/rigol_mcp/waveform_analysis.py +319 -0
- rigol_mcp-0.1.0/src/rigol_mcp/worker.py +80 -0
- rigol_mcp-0.1.0/tests/conftest.py +139 -0
- rigol_mcp-0.1.0/tests/fixtures/ds1104z_1khz_2vpp.json +1 -0
- rigol_mcp-0.1.0/tests/test_acquisition_settings.py +417 -0
- rigol_mcp-0.1.0/tests/test_http.py +373 -0
- rigol_mcp-0.1.0/tests/test_https.py +193 -0
- rigol_mcp-0.1.0/tests/test_in_step.py +187 -0
- rigol_mcp-0.1.0/tests/test_installed_package.py +36 -0
- rigol_mcp-0.1.0/tests/test_lan_clear.py +188 -0
- rigol_mcp-0.1.0/tests/test_memory_export.py +756 -0
- rigol_mcp-0.1.0/tests/test_mho900.py +229 -0
- rigol_mcp-0.1.0/tests/test_model_capabilities.py +215 -0
- rigol_mcp-0.1.0/tests/test_model_catalog.py +78 -0
- rigol_mcp-0.1.0/tests/test_model_protocol.py +254 -0
- rigol_mcp-0.1.0/tests/test_scope.py +1004 -0
- rigol_mcp-0.1.0/tests/test_send_raw.py +35 -0
- rigol_mcp-0.1.0/tests/test_server.py +529 -0
- rigol_mcp-0.1.0/tests/test_waveform_analysis.py +265 -0
- rigol_mcp-0.1.0/tests/test_worker.py +193 -0
- rigol_mcp-0.1.0/uv.lock +978 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Scope connection. This template selects USB. See docs/usb-connection.md.
|
|
2
|
+
RIGOL_USB=1
|
|
3
|
+
|
|
4
|
+
# Optional: pin a specific scope by serial number when several are connected.
|
|
5
|
+
#RIGOL_USB_SERIAL=
|
|
6
|
+
|
|
7
|
+
# Optional: open this exact USB VISA address instead of discovering devices.
|
|
8
|
+
# Requires RIGOL_USB=1 and takes precedence over RIGOL_USB_SERIAL.
|
|
9
|
+
#RIGOL_USB_RESOURCE=
|
|
10
|
+
|
|
11
|
+
# Optional: skip VISA device clear on USB if it hangs during connection or recovery.
|
|
12
|
+
#RIGOL_USB_SKIP_CLEAR=1
|
|
13
|
+
|
|
14
|
+
# For Ethernet, change RIGOL_USB above to 0 and set the scope's LAN address.
|
|
15
|
+
# Replace the documentation address below. See docs/lan-connection.md.
|
|
16
|
+
#RIGOL_IP=192.0.2.10
|
|
17
|
+
|
|
18
|
+
# Optional output directories, relative to the server's working directory.
|
|
19
|
+
#RIGOL_SCREENSHOT_DIR=screenshots
|
|
20
|
+
#RIGOL_WAVEFORM_DIR=waveforms
|
|
21
|
+
|
|
22
|
+
# Enable the send_raw tool (arbitrary SCPI). Off by default — only the dedicated
|
|
23
|
+
# tools are exposed unless this is set.
|
|
24
|
+
#RIGOL_ENABLE_SEND_RAW=1
|
|
25
|
+
|
|
26
|
+
# Optional: serve MCP over HTTP. These configure the SERVER, not the client.
|
|
27
|
+
# Set a generated token before exposing a non-loopback address.
|
|
28
|
+
# See docs/remote-operation.md for client URL/authentication setup.
|
|
29
|
+
#RIGOL_MCP_TRANSPORT=http
|
|
30
|
+
#RIGOL_MCP_HOST=0.0.0.0
|
|
31
|
+
#RIGOL_MCP_PORT=8000
|
|
32
|
+
#RIGOL_MCP_TOKEN=
|
|
33
|
+
|
|
34
|
+
# Optional: enable HTTPS on the same port. Supply both files.
|
|
35
|
+
# Paths are relative to the server's working directory. Clients must trust the CA.
|
|
36
|
+
#RIGOL_MCP_TRANSPORT=https
|
|
37
|
+
#RIGOL_MCP_SSL_CERTFILE=certs/server.pem
|
|
38
|
+
#RIGOL_MCP_SSL_KEYFILE=certs/server-key.pem
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.11", "3.12"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Install uv
|
|
23
|
+
uses: astral-sh/setup-uv@v6
|
|
24
|
+
with:
|
|
25
|
+
enable-cache: true
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
# Installs the project (src/ layout) plus the test extra from the locked versions.
|
|
29
|
+
# Tests are fully offline — no instrument, NI-VISA, or system libusb required.
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: uv sync --locked --extra test
|
|
32
|
+
|
|
33
|
+
- name: Run tests
|
|
34
|
+
run: uv run --no-sync pytest
|
|
35
|
+
|
|
36
|
+
- name: Check the installed wheel
|
|
37
|
+
run: |
|
|
38
|
+
uv build
|
|
39
|
+
uv run --isolated --no-project --with dist/*.whl python -I tests/test_installed_package.py
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
paths:
|
|
6
|
+
- .github/workflows/release.yml
|
|
7
|
+
- docs/releases/**
|
|
8
|
+
- pyproject.toml
|
|
9
|
+
- tests/test_installed_package.py
|
|
10
|
+
push:
|
|
11
|
+
tags: ['v*']
|
|
12
|
+
|
|
13
|
+
permissions: {}
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: release-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: false
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build:
|
|
21
|
+
if: github.event_name == 'pull_request' || github.event.created
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
27
|
+
with:
|
|
28
|
+
persist-credentials: false
|
|
29
|
+
- uses: astral-sh/setup-uv@36300bab3f61b84e19f32b6bd26b7897f3c7e951 # v10.4.2
|
|
30
|
+
with:
|
|
31
|
+
version: latest-known
|
|
32
|
+
python-version: '3.13'
|
|
33
|
+
|
|
34
|
+
- name: Check the version and select release notes
|
|
35
|
+
id: package
|
|
36
|
+
run: |
|
|
37
|
+
version=$(uv version --short)
|
|
38
|
+
if [[ "$GITHUB_REF_TYPE" == tag && "$GITHUB_REF_NAME" != "v$version" ]]; then
|
|
39
|
+
echo "::error::The release tag must match v$version from pyproject.toml"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
test -s "docs/releases/$version.md"
|
|
43
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
44
|
+
|
|
45
|
+
- name: Run the offline suite on the tag
|
|
46
|
+
if: github.ref_type == 'tag'
|
|
47
|
+
run: uv run --locked --extra test pytest
|
|
48
|
+
|
|
49
|
+
- name: Build and check distributions
|
|
50
|
+
run: |
|
|
51
|
+
uv build --no-sources
|
|
52
|
+
uvx twine check --strict dist/*
|
|
53
|
+
uv run --isolated --no-project --with dist/*.whl python -I tests/test_installed_package.py
|
|
54
|
+
|
|
55
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
56
|
+
with:
|
|
57
|
+
name: release-bundle
|
|
58
|
+
path: |
|
|
59
|
+
dist/*.whl
|
|
60
|
+
dist/*.tar.gz
|
|
61
|
+
docs/releases/${{ steps.package.outputs.version }}.md
|
|
62
|
+
if-no-files-found: error
|
|
63
|
+
|
|
64
|
+
publish-pypi:
|
|
65
|
+
if: github.event_name == 'push' && github.ref_type == 'tag'
|
|
66
|
+
needs: build
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
environment:
|
|
69
|
+
name: pypi
|
|
70
|
+
url: https://pypi.org/project/rigol-mcp/
|
|
71
|
+
permissions:
|
|
72
|
+
id-token: write
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
75
|
+
with:
|
|
76
|
+
name: release-bundle
|
|
77
|
+
- uses: astral-sh/setup-uv@36300bab3f61b84e19f32b6bd26b7897f3c7e951 # v10.4.2
|
|
78
|
+
with:
|
|
79
|
+
version: latest-known
|
|
80
|
+
enable-cache: false
|
|
81
|
+
- name: Publish distributions with PyPI Trusted Publishing
|
|
82
|
+
run: uv publish --trusted-publishing always dist/*.whl dist/*.tar.gz
|
|
83
|
+
|
|
84
|
+
github-release:
|
|
85
|
+
needs: publish-pypi
|
|
86
|
+
runs-on: ubuntu-latest
|
|
87
|
+
permissions:
|
|
88
|
+
contents: write
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
91
|
+
with:
|
|
92
|
+
name: release-bundle
|
|
93
|
+
- name: Publish the GitHub Release
|
|
94
|
+
env:
|
|
95
|
+
GH_REPO: ${{ github.repository }}
|
|
96
|
+
GH_TOKEN: ${{ github.token }}
|
|
97
|
+
run: |
|
|
98
|
+
notes="docs/releases/${GITHUB_REF_NAME#v}.md"
|
|
99
|
+
if ! draft=$(gh release view "$GITHUB_REF_NAME" --json isDraft --jq '.isDraft' 2>/dev/null); then
|
|
100
|
+
gh release create "$GITHUB_REF_NAME" dist/* --verify-tag --title "$GITHUB_REF_NAME" --notes-file "$notes"
|
|
101
|
+
elif [[ "$draft" == true ]]; then
|
|
102
|
+
gh release upload "$GITHUB_REF_NAME" dist/* --clobber
|
|
103
|
+
gh release edit "$GITHUB_REF_NAME" --notes-file "$notes" --draft=false
|
|
104
|
+
else
|
|
105
|
+
gh release download "$GITHUB_REF_NAME" --dir "$RUNNER_TEMP/published" --pattern '*.whl' --pattern '*.tar.gz'
|
|
106
|
+
for file in dist/*; do
|
|
107
|
+
cmp "$file" "$RUNNER_TEMP/published/${file##*/}"
|
|
108
|
+
done
|
|
109
|
+
fi
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
rigol_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stig Manning
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
rigol_mcp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: rigol-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for controlling Rigol oscilloscopes over USB or Ethernet
|
|
5
|
+
Project-URL: Documentation, https://github.com/erebusnz/rigol-mcp#readme
|
|
6
|
+
Project-URL: Source, https://github.com/erebusnz/rigol-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/erebusnz/rigol-mcp/issues
|
|
8
|
+
Project-URL: Releases, https://github.com/erebusnz/rigol-mcp/releases
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Requires-Dist: anyio>=4.5
|
|
13
|
+
Requires-Dist: libusb-package>=1.0.26.0; python_version < '3.14'
|
|
14
|
+
Requires-Dist: mcp[cli]<2,>=1.30
|
|
15
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
16
|
+
Requires-Dist: pyusb>=1.2.0
|
|
17
|
+
Requires-Dist: pyvisa-py>=0.7.0
|
|
18
|
+
Requires-Dist: pyvisa>=1.14.0
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
|
|
21
|
+
Requires-Dist: pytest>=8.0; extra == 'test'
|
|
22
|
+
Requires-Dist: trustme>=1.2; extra == 'test'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# rigol-mcp
|
|
26
|
+
|
|
27
|
+
Control a Rigol oscilloscope from Claude, Codex, Cursor, or another Model Context Protocol (MCP) client. You can configure the scope, take measurements, inspect the displayed waveform, and save a triggered acquisition for offline analysis.
|
|
28
|
+
|
|
29
|
+
## Choose how to connect
|
|
30
|
+
|
|
31
|
+
Your MCP client connects to the `rigol-mcp` server, and the server connects to the oscilloscope. Choose each connection independently. For example, a laptop can reach a bench computer over HTTPS while that computer reads the scope over USB.
|
|
32
|
+
|
|
33
|
+
### Client to server
|
|
34
|
+
|
|
35
|
+
You can use a single PC connected directly to your scope, or where you wish to have multiple clients, use a remote shared server (e.g. Raspberry Pi with 1GB RAM) to manage requests.
|
|
36
|
+
|
|
37
|
+
| Setup | How it works | Instructions |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| Local server (stdio) | Your MCP client launches `rigol-mcp` on the same computer that's connected to the scope. | [Install the server](https://github.com/erebusnz/rigol-mcp#installation) · [Configure your local client](https://github.com/erebusnz/rigol-mcp#mcp-client-setup) |
|
|
40
|
+
| Remote shared server (Streamable HTTP) | One server stays running for one or more clients. To use an existing server, configure your client with the server's HTTP or HTTPS `/mcp` URL and any required token. | [Connect to an existing server](https://github.com/erebusnz/rigol-mcp/blob/main/docs/remote-operation.md#configure-mcp-clients) · [Host a shared server](https://github.com/erebusnz/rigol-mcp/blob/main/docs/remote-operation.md) |
|
|
41
|
+
|
|
42
|
+
### Server to scope
|
|
43
|
+
|
|
44
|
+
If you host `rigol-mcp`, configure the instrument connection on the server computer.
|
|
45
|
+
|
|
46
|
+
| Connection | On the scope | In the server's settings file | Instructions |
|
|
47
|
+
|---|---|---|---|
|
|
48
|
+
| Ethernet (LAN) | Connect Ethernet and find the scope's IP in its LAN settings. | Set `RIGOL_USB=0` and `RIGOL_IP` to the scope's IP address. | [LAN setup](https://github.com/erebusnz/rigol-mcp/blob/main/docs/lan-connection.md) |
|
|
49
|
+
| USB | Connect the scope's USB **Device** port to the server computer. | Set `RIGOL_USB=1`. A single Rigol scope is discovered automatically. | [USB drivers and scope selection](https://github.com/erebusnz/rigol-mcp/blob/main/docs/usb-connection.md) |
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
Install [uv](https://docs.astral.sh/uv/getting-started/installation/) on the computer that will run `rigol-mcp`. The server requires Python 3.11 or later. The examples select Python 3.13 to use the project's bundled USB backend.
|
|
54
|
+
|
|
55
|
+
### Run a published release
|
|
56
|
+
|
|
57
|
+
Save your USB or LAN settings in a file such as `rigol.env` on the server computer. For one USB scope, the file needs just `RIGOL_USB=1`. Use the file's absolute path when launching the pinned package with `uvx`.
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
uvx --python 3.13 --env-file "/absolute/path/to/rigol.env" rigol-mcp@0.1.0 --transport stdio
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
For a local MCP client, put this command in the client configuration below so the client starts the server itself. If you supply the connection settings in the process environment, you can omit `--env-file` and its path.
|
|
64
|
+
|
|
65
|
+
### Run from a checkout
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
git clone https://github.com/erebusnz/rigol-mcp.git
|
|
69
|
+
cd rigol-mcp
|
|
70
|
+
uv sync --locked
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Create a `.env` file beside `pyproject.toml` with the settings for your [scope connection](https://github.com/erebusnz/rigol-mcp#server-to-scope). You can also copy [.env.example](https://github.com/erebusnz/rigol-mcp/blob/main/.env.example), which starts with USB selected. Variables already set in the server process take precedence over the file.
|
|
74
|
+
|
|
75
|
+
Before starting the server, check the instrument connection from the checkout. The [connection example](https://github.com/erebusnz/rigol-mcp/blob/main/examples/check_connection.py) prints the instrument's manufacturer, model, serial number, and firmware, then releases the connection.
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
uv run python examples/check_connection.py
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## MCP client setup
|
|
82
|
+
|
|
83
|
+
The examples below launch a local server over stdio. For a running HTTP or HTTPS server, use the [client configurations for connecting by URL](https://github.com/erebusnz/rigol-mcp/blob/main/docs/remote-operation.md#configure-mcp-clients).
|
|
84
|
+
|
|
85
|
+
Replace `/absolute/path/to/rigol.env` with your settings file. On Windows, forward slashes work in paths such as `C:/config/rigol.env`. If a desktop client cannot find `uvx`, use its absolute executable path. To launch from a checkout, use `uv` as the command and `["--directory", "/absolute/path/to/rigol-mcp", "run", "rigol-mcp", "--transport", "stdio"]` as its arguments.
|
|
86
|
+
|
|
87
|
+
### Claude Desktop and Cursor
|
|
88
|
+
|
|
89
|
+
Both clients accept the following JSON. Merge the `rigol` entry into `mcpServers` if you already have other servers configured.
|
|
90
|
+
|
|
91
|
+
| Client | Configuration file |
|
|
92
|
+
|---|---|
|
|
93
|
+
| Claude Desktop | On macOS, `~/Library/Application Support/Claude/claude_desktop_config.json`. On Windows, `%APPDATA%\Claude\claude_desktop_config.json`. [Claude Desktop setup](https://py.sdk.modelcontextprotocol.io/get-started/real-host/) |
|
|
94
|
+
| Cursor | `.cursor/mcp.json` in the project, or `~/.cursor/mcp.json` for all projects. [Cursor MCP guide](https://cursor.com/guides/coding-agent-mcp) |
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"rigol": {
|
|
100
|
+
"command": "uvx",
|
|
101
|
+
"args": ["--python", "3.13", "--env-file", "/absolute/path/to/rigol.env", "rigol-mcp@0.1.0", "--transport", "stdio"]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Restart Claude Desktop after saving. In Cursor, open MCP settings and check that `rigol` is enabled.
|
|
108
|
+
|
|
109
|
+
### Claude Code
|
|
110
|
+
|
|
111
|
+
Run this in the project where you want to use the scope, then check the server with `/mcp`. [Claude Code MCP guide](https://code.claude.com/docs/en/mcp)
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
claude mcp add --transport stdio rigol -- uvx --python 3.13 --env-file "/absolute/path/to/rigol.env" rigol-mcp@0.1.0 --transport stdio
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Codex
|
|
118
|
+
|
|
119
|
+
Add this table to `~/.codex/config.toml`. You can check the entry with `codex mcp list`. [Codex MCP guide](https://developers.openai.com/codex/mcp/)
|
|
120
|
+
|
|
121
|
+
```toml
|
|
122
|
+
[mcp_servers.rigol]
|
|
123
|
+
command = "uvx"
|
|
124
|
+
args = ["--python", "3.13", "--env-file", "/absolute/path/to/rigol.env", "rigol-mcp@0.1.0", "--transport", "stdio"]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
From your client, ask **“Use `idn` to identify the scope, then show me which channels are enabled.”**
|
|
128
|
+
|
|
129
|
+
## Tools
|
|
130
|
+
|
|
131
|
+
| Task | Tools | What you can do |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| Inspect the instrument | `idn`, `get_scope_state`, `get_acquisition_info` | Identify the scope, read channel and trigger settings, and check acquisition status and available transfer modes. |
|
|
134
|
+
| Control acquisition | `run`, `stop`, `single`, `autoscale`, `wait_for_trigger` | Run continuously, freeze the record, arm a single capture, autoscale, or wait for a running scope to report a trigger. |
|
|
135
|
+
| Set channels and timebase | `set_channel`, `set_timebase` | Set channel scale, offset, coupling and probe ratio, or change the time per division and horizontal offset. |
|
|
136
|
+
| Configure triggering and acquisition | `set_trigger`, `set_trigger_options`, `set_acquisition` | Configure the edge trigger, sweep, holdoff and coupling. Choose the acquisition type, average count and memory depth. [Capture settings](https://github.com/erebusnz/rigol-mcp/blob/main/docs/acquisition-export.md#capture-settings) |
|
|
137
|
+
| Take measurements | `measure`, `measure_between` | Read voltage, frequency, rise time, and other single-channel measurements, or measure delay and phase between channels. |
|
|
138
|
+
| Displayed waveform (**Screen**) | `get_waveform` | Get a text analysis of one channel. Set `return_points=true` for its `times_s` and `voltages_v` arrays. Older clients can use the `raw_data` alias. |
|
|
139
|
+
| Acquisition record (**Memory**) | `export_acquisition` | Save the full stopped record for enabled channels as binary files and a JSON manifest on the server. [Acquisition export and Python example](https://github.com/erebusnz/rigol-mcp/blob/main/docs/acquisition-export.md) |
|
|
140
|
+
| Use cursors | `set_cursors`, `get_cursor_values` | Position cursors in seconds and read their time and amplitude differences. |
|
|
141
|
+
| Capture the display | `screenshot` | Return a PNG image and save it under `RIGOL_SCREENSHOT_DIR` (default `screenshots/`). |
|
|
142
|
+
| Manage the connection | `check_error`, `disconnect` | Read the SCPI error queue or release the server's VISA connection. A later tool call can reconnect. |
|
|
143
|
+
| Send a SCPI command | `send_raw` | Enable this optional tool with `RIGOL_ENABLE_SEND_RAW=1` in the server environment. |
|
|
144
|
+
|
|
145
|
+
## Supported hardware
|
|
146
|
+
|
|
147
|
+
Support is selected by exact model name and covers analog channels.
|
|
148
|
+
|
|
149
|
+
| Rigol series | Analog channels | Supported operations |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| DS1000Z / MSO1000Z | 4 | Control, measurements, screenshots, displayed waveforms, acquisition information, and full memory export |
|
|
152
|
+
| DHO800 / DHO900 / DHO1000 / DHO1000U / DHO4000 | 2 or 4 | Control, measurements, screenshots, displayed waveforms, acquisition information, and full memory export |
|
|
153
|
+
| MHO900 / MHO98 | 4 | Control, measurements, screenshots, displayed waveforms, and acquisition information |
|
|
154
|
+
| DS2000A / MSO2000A, MHO2000, DHO5000 / MHO5000, MSO/DS9000 | 2, 4, 6, or 8 | Model and channel information only ([pending hardware testing](https://github.com/erebusnz/rigol-mcp/blob/main/docs/hardware-testing.md)) |
|
|
155
|
+
|
|
156
|
+
Find your exact model in the [hardware catalog](https://github.com/erebusnz/rigol-mcp/blob/main/docs/hardware-support.md#model-catalog). If you have access to a Rigol scope, we welcome [pull requests with hardware test results](https://github.com/erebusnz/rigol-mcp/blob/main/docs/hardware-testing.md#contribute-a-test).
|
|
157
|
+
|
|
158
|
+
## Example prompts
|
|
159
|
+
|
|
160
|
+
> Measure the frequency and peak-to-peak voltage on channel 1. Adjust the timebase until two complete cycles are visible, then describe the waveform.
|
|
161
|
+
|
|
162
|
+
> Channel 1 is the input to an amplifier and channel 2 is the output. Measure the gain in dB.
|
|
163
|
+
|
|
164
|
+
> The rising edge on channel 1 rings. Place the cursors on two adjacent peaks and measure the ringing period.
|
|
165
|
+
|
|
166
|
+

|
|
167
|
+
|
|
168
|
+
## Testing
|
|
169
|
+
|
|
170
|
+
Run the offline suite from the checkout. It uses simulated VISA instruments.
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
uv run --locked --extra test pytest
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Maintainers can find the publishing steps in the [release guide](https://github.com/erebusnz/rigol-mcp/blob/main/docs/releasing.md).
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
[MIT](https://github.com/erebusnz/rigol-mcp/blob/main/LICENSE)
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# rigol-mcp
|
|
2
|
+
|
|
3
|
+
Control a Rigol oscilloscope from Claude, Codex, Cursor, or another Model Context Protocol (MCP) client. You can configure the scope, take measurements, inspect the displayed waveform, and save a triggered acquisition for offline analysis.
|
|
4
|
+
|
|
5
|
+
## Choose how to connect
|
|
6
|
+
|
|
7
|
+
Your MCP client connects to the `rigol-mcp` server, and the server connects to the oscilloscope. Choose each connection independently. For example, a laptop can reach a bench computer over HTTPS while that computer reads the scope over USB.
|
|
8
|
+
|
|
9
|
+
### Client to server
|
|
10
|
+
|
|
11
|
+
You can use a single PC connected directly to your scope, or where you wish to have multiple clients, use a remote shared server (e.g. Raspberry Pi with 1GB RAM) to manage requests.
|
|
12
|
+
|
|
13
|
+
| Setup | How it works | Instructions |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| Local server (stdio) | Your MCP client launches `rigol-mcp` on the same computer that's connected to the scope. | [Install the server](https://github.com/erebusnz/rigol-mcp#installation) · [Configure your local client](https://github.com/erebusnz/rigol-mcp#mcp-client-setup) |
|
|
16
|
+
| Remote shared server (Streamable HTTP) | One server stays running for one or more clients. To use an existing server, configure your client with the server's HTTP or HTTPS `/mcp` URL and any required token. | [Connect to an existing server](https://github.com/erebusnz/rigol-mcp/blob/main/docs/remote-operation.md#configure-mcp-clients) · [Host a shared server](https://github.com/erebusnz/rigol-mcp/blob/main/docs/remote-operation.md) |
|
|
17
|
+
|
|
18
|
+
### Server to scope
|
|
19
|
+
|
|
20
|
+
If you host `rigol-mcp`, configure the instrument connection on the server computer.
|
|
21
|
+
|
|
22
|
+
| Connection | On the scope | In the server's settings file | Instructions |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| Ethernet (LAN) | Connect Ethernet and find the scope's IP in its LAN settings. | Set `RIGOL_USB=0` and `RIGOL_IP` to the scope's IP address. | [LAN setup](https://github.com/erebusnz/rigol-mcp/blob/main/docs/lan-connection.md) |
|
|
25
|
+
| USB | Connect the scope's USB **Device** port to the server computer. | Set `RIGOL_USB=1`. A single Rigol scope is discovered automatically. | [USB drivers and scope selection](https://github.com/erebusnz/rigol-mcp/blob/main/docs/usb-connection.md) |
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Install [uv](https://docs.astral.sh/uv/getting-started/installation/) on the computer that will run `rigol-mcp`. The server requires Python 3.11 or later. The examples select Python 3.13 to use the project's bundled USB backend.
|
|
30
|
+
|
|
31
|
+
### Run a published release
|
|
32
|
+
|
|
33
|
+
Save your USB or LAN settings in a file such as `rigol.env` on the server computer. For one USB scope, the file needs just `RIGOL_USB=1`. Use the file's absolute path when launching the pinned package with `uvx`.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
uvx --python 3.13 --env-file "/absolute/path/to/rigol.env" rigol-mcp@0.1.0 --transport stdio
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For a local MCP client, put this command in the client configuration below so the client starts the server itself. If you supply the connection settings in the process environment, you can omit `--env-file` and its path.
|
|
40
|
+
|
|
41
|
+
### Run from a checkout
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
git clone https://github.com/erebusnz/rigol-mcp.git
|
|
45
|
+
cd rigol-mcp
|
|
46
|
+
uv sync --locked
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Create a `.env` file beside `pyproject.toml` with the settings for your [scope connection](https://github.com/erebusnz/rigol-mcp#server-to-scope). You can also copy [.env.example](https://github.com/erebusnz/rigol-mcp/blob/main/.env.example), which starts with USB selected. Variables already set in the server process take precedence over the file.
|
|
50
|
+
|
|
51
|
+
Before starting the server, check the instrument connection from the checkout. The [connection example](https://github.com/erebusnz/rigol-mcp/blob/main/examples/check_connection.py) prints the instrument's manufacturer, model, serial number, and firmware, then releases the connection.
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
uv run python examples/check_connection.py
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## MCP client setup
|
|
58
|
+
|
|
59
|
+
The examples below launch a local server over stdio. For a running HTTP or HTTPS server, use the [client configurations for connecting by URL](https://github.com/erebusnz/rigol-mcp/blob/main/docs/remote-operation.md#configure-mcp-clients).
|
|
60
|
+
|
|
61
|
+
Replace `/absolute/path/to/rigol.env` with your settings file. On Windows, forward slashes work in paths such as `C:/config/rigol.env`. If a desktop client cannot find `uvx`, use its absolute executable path. To launch from a checkout, use `uv` as the command and `["--directory", "/absolute/path/to/rigol-mcp", "run", "rigol-mcp", "--transport", "stdio"]` as its arguments.
|
|
62
|
+
|
|
63
|
+
### Claude Desktop and Cursor
|
|
64
|
+
|
|
65
|
+
Both clients accept the following JSON. Merge the `rigol` entry into `mcpServers` if you already have other servers configured.
|
|
66
|
+
|
|
67
|
+
| Client | Configuration file |
|
|
68
|
+
|---|---|
|
|
69
|
+
| Claude Desktop | On macOS, `~/Library/Application Support/Claude/claude_desktop_config.json`. On Windows, `%APPDATA%\Claude\claude_desktop_config.json`. [Claude Desktop setup](https://py.sdk.modelcontextprotocol.io/get-started/real-host/) |
|
|
70
|
+
| Cursor | `.cursor/mcp.json` in the project, or `~/.cursor/mcp.json` for all projects. [Cursor MCP guide](https://cursor.com/guides/coding-agent-mcp) |
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"rigol": {
|
|
76
|
+
"command": "uvx",
|
|
77
|
+
"args": ["--python", "3.13", "--env-file", "/absolute/path/to/rigol.env", "rigol-mcp@0.1.0", "--transport", "stdio"]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Restart Claude Desktop after saving. In Cursor, open MCP settings and check that `rigol` is enabled.
|
|
84
|
+
|
|
85
|
+
### Claude Code
|
|
86
|
+
|
|
87
|
+
Run this in the project where you want to use the scope, then check the server with `/mcp`. [Claude Code MCP guide](https://code.claude.com/docs/en/mcp)
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
claude mcp add --transport stdio rigol -- uvx --python 3.13 --env-file "/absolute/path/to/rigol.env" rigol-mcp@0.1.0 --transport stdio
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Codex
|
|
94
|
+
|
|
95
|
+
Add this table to `~/.codex/config.toml`. You can check the entry with `codex mcp list`. [Codex MCP guide](https://developers.openai.com/codex/mcp/)
|
|
96
|
+
|
|
97
|
+
```toml
|
|
98
|
+
[mcp_servers.rigol]
|
|
99
|
+
command = "uvx"
|
|
100
|
+
args = ["--python", "3.13", "--env-file", "/absolute/path/to/rigol.env", "rigol-mcp@0.1.0", "--transport", "stdio"]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
From your client, ask **“Use `idn` to identify the scope, then show me which channels are enabled.”**
|
|
104
|
+
|
|
105
|
+
## Tools
|
|
106
|
+
|
|
107
|
+
| Task | Tools | What you can do |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| Inspect the instrument | `idn`, `get_scope_state`, `get_acquisition_info` | Identify the scope, read channel and trigger settings, and check acquisition status and available transfer modes. |
|
|
110
|
+
| Control acquisition | `run`, `stop`, `single`, `autoscale`, `wait_for_trigger` | Run continuously, freeze the record, arm a single capture, autoscale, or wait for a running scope to report a trigger. |
|
|
111
|
+
| Set channels and timebase | `set_channel`, `set_timebase` | Set channel scale, offset, coupling and probe ratio, or change the time per division and horizontal offset. |
|
|
112
|
+
| Configure triggering and acquisition | `set_trigger`, `set_trigger_options`, `set_acquisition` | Configure the edge trigger, sweep, holdoff and coupling. Choose the acquisition type, average count and memory depth. [Capture settings](https://github.com/erebusnz/rigol-mcp/blob/main/docs/acquisition-export.md#capture-settings) |
|
|
113
|
+
| Take measurements | `measure`, `measure_between` | Read voltage, frequency, rise time, and other single-channel measurements, or measure delay and phase between channels. |
|
|
114
|
+
| Displayed waveform (**Screen**) | `get_waveform` | Get a text analysis of one channel. Set `return_points=true` for its `times_s` and `voltages_v` arrays. Older clients can use the `raw_data` alias. |
|
|
115
|
+
| Acquisition record (**Memory**) | `export_acquisition` | Save the full stopped record for enabled channels as binary files and a JSON manifest on the server. [Acquisition export and Python example](https://github.com/erebusnz/rigol-mcp/blob/main/docs/acquisition-export.md) |
|
|
116
|
+
| Use cursors | `set_cursors`, `get_cursor_values` | Position cursors in seconds and read their time and amplitude differences. |
|
|
117
|
+
| Capture the display | `screenshot` | Return a PNG image and save it under `RIGOL_SCREENSHOT_DIR` (default `screenshots/`). |
|
|
118
|
+
| Manage the connection | `check_error`, `disconnect` | Read the SCPI error queue or release the server's VISA connection. A later tool call can reconnect. |
|
|
119
|
+
| Send a SCPI command | `send_raw` | Enable this optional tool with `RIGOL_ENABLE_SEND_RAW=1` in the server environment. |
|
|
120
|
+
|
|
121
|
+
## Supported hardware
|
|
122
|
+
|
|
123
|
+
Support is selected by exact model name and covers analog channels.
|
|
124
|
+
|
|
125
|
+
| Rigol series | Analog channels | Supported operations |
|
|
126
|
+
|---|---|---|
|
|
127
|
+
| DS1000Z / MSO1000Z | 4 | Control, measurements, screenshots, displayed waveforms, acquisition information, and full memory export |
|
|
128
|
+
| DHO800 / DHO900 / DHO1000 / DHO1000U / DHO4000 | 2 or 4 | Control, measurements, screenshots, displayed waveforms, acquisition information, and full memory export |
|
|
129
|
+
| MHO900 / MHO98 | 4 | Control, measurements, screenshots, displayed waveforms, and acquisition information |
|
|
130
|
+
| DS2000A / MSO2000A, MHO2000, DHO5000 / MHO5000, MSO/DS9000 | 2, 4, 6, or 8 | Model and channel information only ([pending hardware testing](https://github.com/erebusnz/rigol-mcp/blob/main/docs/hardware-testing.md)) |
|
|
131
|
+
|
|
132
|
+
Find your exact model in the [hardware catalog](https://github.com/erebusnz/rigol-mcp/blob/main/docs/hardware-support.md#model-catalog). If you have access to a Rigol scope, we welcome [pull requests with hardware test results](https://github.com/erebusnz/rigol-mcp/blob/main/docs/hardware-testing.md#contribute-a-test).
|
|
133
|
+
|
|
134
|
+
## Example prompts
|
|
135
|
+
|
|
136
|
+
> Measure the frequency and peak-to-peak voltage on channel 1. Adjust the timebase until two complete cycles are visible, then describe the waveform.
|
|
137
|
+
|
|
138
|
+
> Channel 1 is the input to an amplifier and channel 2 is the output. Measure the gain in dB.
|
|
139
|
+
|
|
140
|
+
> The rising edge on channel 1 rings. Place the cursors on two adjacent peaks and measure the ringing period.
|
|
141
|
+
|
|
142
|
+

|
|
143
|
+
|
|
144
|
+
## Testing
|
|
145
|
+
|
|
146
|
+
Run the offline suite from the checkout. It uses simulated VISA instruments.
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
uv run --locked --extra test pytest
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Maintainers can find the publishing steps in the [release guide](https://github.com/erebusnz/rigol-mcp/blob/main/docs/releasing.md).
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
[MIT](https://github.com/erebusnz/rigol-mcp/blob/main/LICENSE)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Export acquisition memory
|
|
2
|
+
|
|
3
|
+
Use `export_acquisition` to save the full stopped record from a DS1000Z/MSO1000Z or a supported DHO model. It writes one binary file per channel and a JSON manifest on the server computer. [Supported models](hardware-support.md)
|
|
4
|
+
|
|
5
|
+
## Choose the waveform source
|
|
6
|
+
|
|
7
|
+
Rigol's waveform reading mode determines which points the scope returns. [Rigol waveform reading modes](https://download.rigol.com/en/Manual/Digital%20Oscilloscope/DHO800/DHO800900_ProgrammingGuide_EN.pdf#page=427)
|
|
8
|
+
|
|
9
|
+
| Rigol data source | MCP call | What you receive |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| **Screen** (`NORM`) | `get_waveform` on one channel | A text analysis of the displayed waveform. Set `return_points=true` for the `times_s` and `voltages_v` arrays. The display read covers up to 1,200 waveform points on DS1000Z or 1,000 on DHO. |
|
|
12
|
+
| **Memory** (`RAW`) | `export_acquisition` on a stopped scope | The acquired points for each requested channel, with timing and scaling information. Use these for offline filtering, decoding, or analysis of short events. |
|
|
13
|
+
|
|
14
|
+
The legacy `raw_data` flag is an alias for `return_points`. An explicit `return_points` takes precedence.
|
|
15
|
+
|
|
16
|
+
## Capture settings
|
|
17
|
+
|
|
18
|
+
Use `set_trigger` to choose the edge source, slope and level. With `set_trigger_options` you can set sweep (`AUTO` or `NORM`), holdoff in seconds, and trigger coupling (`AC`, `DC`, `LFR`, or `HFR`). Coupling requires an analog-channel edge trigger. Holdoff depends on the trigger type. Unavailable settings read back as `null`.
|
|
19
|
+
|
|
20
|
+
Use `set_acquisition` to select normal (`NORM`), peak detect (`PEAK`), or averaging (`AVER`). DS1000Z and MHO900/MHO98 also support high resolution (`HRES`). The average count is a power of two, up to 1,024 on DS1000Z or 65,536 on DHO and MHO900/MHO98. Memory depth accepts `AUTO` or a point count such as `10k` or `1M`. Available depths depend on the model, enabled channels, timebase, and acquisition type. Check `memory_depth_verification` in the result. Some scopes report a point count in automatic mode, so verification of `AUTO` can be `unavailable`.
|
|
21
|
+
|
|
22
|
+
On a running scope, `wait_for_trigger` returns `triggered: true` when it observes `TD` and `triggered: false` on timeout. The status is `null` if the timeout expires before the first reading. If the scope reports `STOP`, `triggered` is `null`. For a single capture, check for `STOP` with `get_acquisition_info` before exporting.
|
|
23
|
+
|
|
24
|
+
## Capture and export
|
|
25
|
+
|
|
26
|
+
1. Enable the channels you want and set the timebase and trigger before acquiring. Use `single` for a triggered capture, or `stop` to freeze the current acquisition.
|
|
27
|
+
2. Call `get_acquisition_info`. Check for `STOP`, the enabled channels, and `acquisition_memory` in `supported_transfer_modes`. After `single`, allow the trigger event to occur. A manually stopped record also reports `STOP`.
|
|
28
|
+
3. Call `export_acquisition` with `{}` for all enabled analog channels, or select channels as in the example below. Leave the front panel and other SCPI clients idle until it returns.
|
|
29
|
+
4. Check `complete`, `manifest_current`, and `warnings` in the result. Open the returned `manifest_path`. If you use a remote server, copy the entire acquisition directory, including its binary files, to your analysis computer.
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{"channels": ["CHAN1", "CHAN2"]}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Each export creates a unique subdirectory under `waveforms/` in the server's working directory. Set `RIGOL_WAVEFORM_DIR` to choose another parent directory, or supply `output_dir` for a single call. Requested channels must already be enabled.
|
|
36
|
+
|
|
37
|
+
## Read the files
|
|
38
|
+
|
|
39
|
+
`manifest.json` records the instrument settings, units, sample counts, and a waveform preamble for each channel. The `file` field names the corresponding binary file, for example `CHAN1.bin`.
|
|
40
|
+
|
|
41
|
+
| Family | Transfer format | Manifest `dtype` |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| DS1000Z / MSO1000Z | One unsigned byte per point | `uint8` |
|
|
44
|
+
| Supported DHO models | One little-endian unsigned 16-bit word per point | `<u2` |
|
|
45
|
+
|
|
46
|
+
The [Python reader](../examples/read_acquisition.py) converts the codes to time and channel values using NumPy. From the checkout, replace the path with the returned manifest path and select an exported channel. The command prints the first five points. The script's `read_channel` function can also load a complete channel for analysis.
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
uv run --with numpy python examples/read_acquisition.py "/path/to/acquisition/manifest.json" CHAN1
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For zero-based index `i`, the trigger-relative time in seconds is `xorigin + (i - xreference) * xincrement`. The channel value is `(code - yorigin - yreference) * yincrement`, evaluated with a signed or floating-point value for `code`. The preamble includes the probe factor. Read the unit from the channel settings. When `timestamps_aligned` is false, use each channel's own time axis.
|
|
53
|
+
|
|
54
|
+
The recorded length comes from the waveform metadata. The memory-depth setting can be `AUTO`. The export timestamps describe the file transfer. The scope does not provide the acquisition timestamp through this tool.
|
|
55
|
+
|
|
56
|
+
## Incomplete exports
|
|
57
|
+
|
|
58
|
+
If `complete` is false, inspect `error` and `warnings` before using any files. A partial channel's `points` and `exported_range` describe the validated prefix. A file interrupted during writing can contain extra bytes after that prefix.
|
|
59
|
+
|
|
60
|
+
If `manifest_current` is false, retain the tool response. Its `recovery_manifest` contains the available scaling metadata and validated counts, and `persisted_points` reports the last counts written to the on-disk manifest. If `transfer_settings_restored` is false, check the scope's waveform transfer settings before further reads.
|