2026-01-24 12:16:32 +08:00

48 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 电机 + Rigol 扫描CSV + 实时监视器)
### 扫描并写入 CSV
```bash
uv run motor_rigol_scan_csv.py --mm 10 --end-mm 300 --step 40
```
电机驱动为 GPIO 直控DIR/STEP默认使用 BCM 引脚DIR=22、STEP=27默认细分为 8。
如需修改:
```bash
uv run motor_rigol_scan_csv.py --mm 10 --end-mm 300 --step 40 --microsteps 8 --dir-pin 22 --step-pin 27
```
### 开启实时图形监视器Matplotlib
会在扫描进行时实时显示:
- 相位差 `dphi (deg)` vs 位置(mm)
- CH1/CH2 峰峰值 `pp (ADC counts)` vs 位置(mm)
- 频率 `f0 (Hz)` vs 位置(mm)
- 进度条(当前位置 + 完成百分比)
```bash
uv run motor_rigol_scan_csv.py --mm 10 --end-mm 300 --step 40 --live
```
如果在无图形界面的环境(例如纯 SSH、无 X11/Wayland运行Matplotlib 可能无法打开窗口;脚本会自动关闭实时监视器并继续扫描。
### 离线可视化 CSV多图表
会生成 4 个子图:相位差(dphi)、峰峰值(CH1/CH2)、频率(f0)、等效延时(dt)。
弹窗显示:
```bash
uv run visualize_scan_csv.py scan_20260120_154455.csv
```
无桌面/SSH 环境下保存图片:
```bash
uv run visualize_scan_csv.py scan_20260120_154455.csv --save out.png --smooth 5 --unwrap
```