dsh-origin-bridge 0.4.1 → 0.4.3
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.
- package/README.md +299 -234
- package/asciiio.py +82 -12
- package/docs/preview.png +0 -0
- package/edge_checks.py +10 -0
- package/originlab.py +475 -50
- package/package.json +76 -74
- package/scripts/make_preview.py +77 -0
- package/server.py +612 -577
- package/smoke_test.py +37 -7
- package/test_lifecycle.py +232 -0
package/package.json
CHANGED
|
@@ -1,74 +1,76 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-origin-bridge",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Drive local Origin/OriginPro from chat: import .dat/.csv/Excel/workstation .bin data, plot, fit, and save editable .opju projects. Third-party tool, not affiliated with or endorsed by OriginLab Corporation.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/caob23/dsh-origin-bridge.git"
|
|
10
|
-
},
|
|
11
|
-
"bugs": {
|
|
12
|
-
"url": "https://github.com/caob23/dsh-origin-bridge/issues"
|
|
13
|
-
},
|
|
14
|
-
"homepage": "https://github.com/caob23/dsh-origin-bridge#readme",
|
|
15
|
-
"main": "./index.js",
|
|
16
|
-
"icon": "./icon.svg",
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"@deepseek-ai/dsh-mcp-client": ">=0.1.0-rc.1"
|
|
19
|
-
},
|
|
20
|
-
"bin": {
|
|
21
|
-
"origin-bridge": "bin/origin-bridge.mjs"
|
|
22
|
-
},
|
|
23
|
-
"exports": {
|
|
24
|
-
".": "./index.js",
|
|
25
|
-
"./package.json": "./package.json",
|
|
26
|
-
"./locale/*.json": "./locale/*.json"
|
|
27
|
-
},
|
|
28
|
-
"files": [
|
|
29
|
-
"index.js",
|
|
30
|
-
"bin/origin-bridge.mjs",
|
|
31
|
-
"install_dsh.ps1",
|
|
32
|
-
"cordis.patch.yml",
|
|
33
|
-
"icon.svg",
|
|
34
|
-
"locale/en.json",
|
|
35
|
-
"locale/zh.json",
|
|
36
|
-
"docs/preview.png",
|
|
37
|
-
"scripts/make_icon.py",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"fixtures
|
|
45
|
-
"fixtures/*.
|
|
46
|
-
"fixtures/*.
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"dsh
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-origin-bridge",
|
|
3
|
+
"version": "0.4.3",
|
|
4
|
+
"description": "Drive local Origin/OriginPro from chat: import .dat/.csv/Excel/workstation .bin data, plot, fit, and save editable .opju projects. Third-party tool, not affiliated with or endorsed by OriginLab Corporation.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/caob23/dsh-origin-bridge.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/caob23/dsh-origin-bridge/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/caob23/dsh-origin-bridge#readme",
|
|
15
|
+
"main": "./index.js",
|
|
16
|
+
"icon": "./icon.svg",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@deepseek-ai/dsh-mcp-client": ">=0.1.0-rc.1"
|
|
19
|
+
},
|
|
20
|
+
"bin": {
|
|
21
|
+
"origin-bridge": "bin/origin-bridge.mjs"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./index.js",
|
|
25
|
+
"./package.json": "./package.json",
|
|
26
|
+
"./locale/*.json": "./locale/*.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"index.js",
|
|
30
|
+
"bin/origin-bridge.mjs",
|
|
31
|
+
"install_dsh.ps1",
|
|
32
|
+
"cordis.patch.yml",
|
|
33
|
+
"icon.svg",
|
|
34
|
+
"locale/en.json",
|
|
35
|
+
"locale/zh.json",
|
|
36
|
+
"docs/preview.png",
|
|
37
|
+
"scripts/make_icon.py",
|
|
38
|
+
"scripts/make_preview.py",
|
|
39
|
+
"server.py",
|
|
40
|
+
"originlab.py",
|
|
41
|
+
"asciiio.py",
|
|
42
|
+
"binio.py",
|
|
43
|
+
"templates_catalog.py",
|
|
44
|
+
"fixtures/make_fixtures.py",
|
|
45
|
+
"fixtures/*.dat",
|
|
46
|
+
"fixtures/*.csv",
|
|
47
|
+
"fixtures/*.txt",
|
|
48
|
+
"smoke_test.py",
|
|
49
|
+
"edge_checks.py",
|
|
50
|
+
"test_asciiio.py",
|
|
51
|
+
"test_binio.py",
|
|
52
|
+
"test_lifecycle.py",
|
|
53
|
+
"client_check.py",
|
|
54
|
+
"requirements.txt",
|
|
55
|
+
"sample.dat",
|
|
56
|
+
"README.md",
|
|
57
|
+
"LICENSE"
|
|
58
|
+
],
|
|
59
|
+
"dsh": {
|
|
60
|
+
"bundle": {
|
|
61
|
+
"patch": "./cordis.patch.yml"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"keywords": [
|
|
65
|
+
"dsh",
|
|
66
|
+
"dsh-plugin",
|
|
67
|
+
"dsh-bundle",
|
|
68
|
+
"deepseek-harness",
|
|
69
|
+
"mcp",
|
|
70
|
+
"origin",
|
|
71
|
+
"originpro",
|
|
72
|
+
"opju",
|
|
73
|
+
"scientific-plotting",
|
|
74
|
+
"electrochemistry"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Regenerate docs/preview.png through the real engine.
|
|
2
|
+
|
|
3
|
+
The picture is a genuine Origin export (3216x2461), so it is rebuilt the same
|
|
4
|
+
way the plugin serves it rather than touched with an image editor: the legend
|
|
5
|
+
box sits on top of the rising curve, so erasing it would leave a hole.
|
|
6
|
+
|
|
7
|
+
Note that `figure(legend=False)` SKIPS our legend step -- it does not hide the
|
|
8
|
+
legend Origin's own template already put on the layer. Switching it off needs
|
|
9
|
+
an explicit legend_entries(show=False), and the readback is asserted here so a
|
|
10
|
+
silent regression cannot ship a legend-bearing preview.
|
|
11
|
+
|
|
12
|
+
`Smoothed` is a trailing 9-point mean of the sample column, which lags the
|
|
13
|
+
exponential the way the original demo did.
|
|
14
|
+
|
|
15
|
+
python scripts/make_preview.py
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
import sys
|
|
20
|
+
|
|
21
|
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
22
|
+
ROOT = os.path.dirname(HERE)
|
|
23
|
+
sys.path.insert(0, ROOT)
|
|
24
|
+
|
|
25
|
+
import asciiio # noqa: E402
|
|
26
|
+
import originlab # noqa: E402
|
|
27
|
+
|
|
28
|
+
SMOOTH_WINDOW = 9
|
|
29
|
+
OUT = os.path.join(ROOT, "docs", "preview.png")
|
|
30
|
+
# Origin's default theme for a two-curve line+symbol graph: blue squares and a
|
|
31
|
+
# red dashed line with triangles.
|
|
32
|
+
SERIES_STYLE = ((0, "blue", 2, 2.5), (1, "red", 3, 1.5))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def trailing_mean(values, window=SMOOTH_WINDOW):
|
|
36
|
+
out = []
|
|
37
|
+
for i in range(len(values)):
|
|
38
|
+
part = values[max(0, i - window + 1):i + 1]
|
|
39
|
+
out.append(sum(part) / len(part))
|
|
40
|
+
return out
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def main():
|
|
44
|
+
table = asciiio.parse(os.path.join(ROOT, "sample.dat"))
|
|
45
|
+
cols = table["columns"]
|
|
46
|
+
x = [float(v) for v in cols[0]["values"]]
|
|
47
|
+
y = [float(v) for v in cols[1]["values"]]
|
|
48
|
+
|
|
49
|
+
sheet = originlab.write_columns({"X": x, "Y": y, "Smoothed": trailing_mean(y)})
|
|
50
|
+
p = originlab.plot(sheet["worksheet"], x=1, y=[2, 3], plot_type="line_symbol",
|
|
51
|
+
template="linesymb")
|
|
52
|
+
titles = originlab.style(p["graph"], x_title="Time (s)", y_title="Signal (mV)")
|
|
53
|
+
|
|
54
|
+
hidden = originlab.legend_entries(p["graph"], show=False)
|
|
55
|
+
shown = [op for op in hidden.get("applied", []) if op.get("op") == "show"]
|
|
56
|
+
if not shown or shown[0].get("readback") != 0:
|
|
57
|
+
raise SystemExit("图例没能关掉(readback=%r),不导出" % (shown or "没有 show 这项",))
|
|
58
|
+
if hidden.get("failed"):
|
|
59
|
+
raise SystemExit("图例设置部分失败:%s" % hidden["failed"])
|
|
60
|
+
|
|
61
|
+
for series, color, symbol, width in SERIES_STYLE:
|
|
62
|
+
originlab.style(p["graph"], series=series, color=color,
|
|
63
|
+
symbol_kind=symbol, line_width=width)
|
|
64
|
+
|
|
65
|
+
export = originlab.export(p["graph"], OUT, fmt="png", width=1600)
|
|
66
|
+
print("wrote %s" % export["path"])
|
|
67
|
+
print(" bytes : %s dimensions: %s channel=%s"
|
|
68
|
+
% (export["bytes"], export.get("dimensions"), export.get("channel")))
|
|
69
|
+
print(" 标题读回 : %s" % [o.get("readback") for o in titles.get("applied", [])])
|
|
70
|
+
print(" 图例 : show 读回 %s" % shown[0].get("readback"))
|
|
71
|
+
print(" 数据 : %d 行 x 3 列(X / Y / Smoothed),graph=%s"
|
|
72
|
+
% (len(x), p["graph_page"]))
|
|
73
|
+
originlab.close_pages("graph", [p["graph_page"]])
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if __name__ == "__main__":
|
|
77
|
+
main()
|