simulated-peak-plot
/install simulated-peak-plot
Simulated Peak Plot Skill v2.1
Generate simulated peak plots with Gaussian peaks, customizable parameters, realistic noise, Markdown table output, and CSV data export.
Overview
This skill creates simulated peak spectra for educational, testing, or presentation purposes. It supports:
- Multiple peak types including composite peaks (any number of sub-peaks combined)
- Customizable time range, baseline, and noise
- Customizable axis titles and units (X/Y labels, mV/V/absorbance/etc.)
- CSV complete data export with full data points
- Clickable file:/// path for easy image opening
- Markdown table data output (printed in console)
- Interactive configuration with point recommendations
New Features (v2.1)
1. Customizable Axis Titles
xlabel: X-axis title (default: 'Time')ylabel: Y-axis title (default: 'Response')x_unit: X-axis unit (default: 'min')y_unit: Y-axis unit (default: 'mV', can be 'V', 'absorbance', etc.)
2. CSV Full Data Export
- Export complete dataset as CSV file
- Format:
[(t1, s1), (t2, s2), ...] - RFC 4180 标准格式:UTF-8编码,逗号分隔,数值型数据
- Header:
Time_\x3Cunit>,Signal_\x3Cunit> - 输出文件路径 with
file:///URI for clicking
3. Customizable Grid Lines
grid: 是否显示网格线 (default: True)grid_linestyle: 网格线样式 -'solid','dashed','dotted','dashdot'- solid: 实线 (-)
- dashed: 虚线 (--)
- dotted: 点线 (:)
- dashdot: 点划线 (-.)
grid_alpha: 网格线透明度 (default: 0.6)
4. CSV Data Import (Device Export)
直接导入设备导出的原始CSV数据,无需手动配置峰参数。
命令行用法:
python scripts/generate_peak.py --import-csv data.csv
python scripts/generate_peak.py --import-csv data.csv --x-col 0 --y-col 1
python scripts/generate_peak.py --import-csv data.csv --no-header --output my_plot.png
参数说明:
| 参数 | 说明 |
|---|---|
--import-csv |
CSV文件路径(必需) |
--x-col |
X轴数据列索引(默认:0) |
--y-col |
Y轴数据列索引(默认:1) |
--no-header |
CSV文件无表头行 |
--output |
输出PNG文件名(默认:imported_data.png) |
支持的CSV格式:
- 设备导出的标准格式(带表头或无表头)
- 逗号分隔,UTF-8编码
- 自动跳过非数值行
3. Clickable Image Path
- Automatically outputs
file:///C:/path/to/image.png - Click directly to open in default viewer
Workflow
1. Environment Check
Always start by checking the environment:
# Check Python availability
python --version
# Check required packages
python -c "import numpy; import matplotlib; print('All packages available')"
If packages are missing, instruct user to install:
pip install numpy matplotlib
2. Parameter Configuration (Interactive Dialogue)
Engage in dialogue to configure parameters. Show the Point Recommendation Table first.
Time range:
- Start: 5 min
- End: 15 min
Default peaks (including composite with 3 sub-peaks):
- Blank: RT=5.8, Height=300, HWHM=0.1
- Peak A: RT=7.7, Height=1500, HWHM=0.08
- Peak B: RT=10.3, Height=1200, HWHM=0.12
- Composite (3 sub-peaks): RT=11.5/12.0/12.5, Heights=1100/800/600, HWHM=0.15
Signal settings:
- Baseline: 20
- Noise level: 8
Output: PNG + Markdown table (printed to console)
Ask user:
- "How many peaks do you want? (default: 4 including blank peak and composite)"
- "For each peak, provide: Name, Retention Time (RT), Height, HWHM"
- "For composite peaks: Enter number of sub-peaks (2+=composite), then provide RT/Height/HWHM for each sub-peak"
- "Do you want to modify baseline or noise level? (default: baseline=20, noise=8)"
- "Do you want to print data as Markdown table? (default: y)"
- "Sample interval for table (print every N-th point)? (default: 20)"
- "Do you want to change output filename? (default: simulated_peak)"
- "Customize axis labels? (xlabel/ylabel, x_unit, y_unit) [default: Time/min, Response/mV]"
- "Export complete data as CSV? (y/n) [default: n]"
- "Show grid lines? (y/n) [default: y]"
- If yes: "Grid line style? (1=solid, 2=dashed, 3=dotted, 4=dashdot) [default: 2]"
- If yes: "Grid transparency (0.1-1.0)? [default: 0.6]"
- Clickable file:/// path is always output for easy opening
3. Point Recommendation Table
Display a recommendation table based on:
- Time range duration
- Number of peaks
- Baseline variation
- Peak sharpness (HWHM)
Recommendation formula:
points = max(500, duration * peaks * sharpness_factor * 2)
Typical recommendations:
| Duration (min) | Peaks | Baseline | Suggested Points |
|---|---|---|---|
| 5-10 | 2-4 | Low (\x3C50) | 500-800 |
| 10-20 | 4-8 | Medium (50-100) | 800-1200 |
| 20-30 | 8+ | High (>100) | 1200-2000 |
| 30+ | Any | Any | 2000+ |
Also show calculation:
For your settings:
Duration = [t_end - t_start] min
Peaks = [num_peaks]
Baseline = [baseline]
Recommended points = max(500, [calculated_value])
4. Generate Plot and Output Data
Use the scripts/generate_peak.py script:
python scripts/generate_peak.py --interactive
The script will:
- Generate the peak plot with annotations
- Save PNG file with plot
- Print data as Markdown table in console (optional)
5. Output
The script will:
- Generate the spectrum plot (PNG)
- Output clickable file:/// path for direct opening
- Export CSV file with full data (if enabled)
- Print time and signal data as Markdown table in console (optional)
- Display plot (if running in interactive environment)
Composite Peak (N Sub-Peaks)
Composite peaks are created by combining any number of Gaussian peaks. This allows for various complex peak shapes:
Common Shapes
- Doublet (2 peaks): M-shaped or shoulder peaks
- Triplet (3 peaks): W-shaped or triple-peak patterns
- Multiple (4+ peaks):馒头形(Mantou), Poisson-like, or irregular shapes
Configuration
Composite peaks can be defined as:
{
"name": "3-peak Composite",
"type": "composite",
"peaks": [
{"RT": 11.5, "height": 1100, "HWH": 0.15},
{"RT": 12.0, "height": 800, "HWH": 0.15},
{"RT": 12.5, "height": 600, "HWH": 0.15}
]
}
Examples of Peak Shapes
| Sub-peaks | RT Distribution | Height Distribution | Resulting Shape |
|---|---|---|---|
| 2 | Close RTs | Different heights | M-shape / Shoulder |
| 3 | Evenly spaced | Gradually decreasing | W-shape / Triple |
| 4 | Close RTs | Random | Irregular / Jagged |
| 3 | Same RT | Increasing then decreasing | 馒头形 (Bun shape) |
The flexibility allows users to simulate almost any peak shape by adjusting sub-peak parameters.
Important Notes
- Blank peak preservation: Always keep the first peak as a blank/reference peak (can be unnamed)
- Peak naming: Rename compounds to generic "Peak A", "Peak B", etc. for universality
- Markdown table output: Print data as Markdown table in console for easy copy-paste
- Composite peaks: Use 'composite' type with any number of sub-peaks (1=single, 2+=complex)
- Point recommendation: Show recommendation table in interactive mode to help users choose appropriate resolution
- Flexible shapes: By adjusting sub-peak count and parameters, you can create M-shape,馒头形, Poisson-like, or any irregular shape
- Axis customization: Use xlabel/ylabel/x_unit/y_unit to customize axis labels and units
- CSV export: Set
export_csv: trueto export complete data with[(t1, s1), (t2, s2), ...]format - Clickable path: file:/// path is always output for easy image opening
- Grid lines: Set
grid: falseto hide, or customizegrid_linestyleandgrid_alpha - CSV Standard: Output follows RFC 4180 format with UTF-8 encoding
File References
- Script:
scripts/generate_peak.py- Main generation script with Markdown table output - Parameters reference:
references/parameters.md- Detailed parameter documentation
Example Usage
User request: "Generate a peak spectrum with 5 peaks including one 3-sub-peak composite, output data as table"
Response workflow:
- Check environment
- Show point recommendation table
- Ask for peak parameters (including sub-peak count for composite)
- Generate spectrum with Markdown table output
- Save PNG file and print table in console
Customization
Users can modify:
- Number of peaks (including composite peaks with N sub-peaks)
- Peak parameters (RT, height, HWHM)
- Sub-peak count in composite (2+ for complex shapes)
- Time range
- Noise and baseline levels
- Output filename and format
- Plot aesthetics (colors, labels, grid)
- Markdown table output (enable/disable, sample interval)
- Axis titles and units (xlabel, ylabel, x_unit, y_unit)
- CSV full data export (export_csv: true/false)
- Clickable file:/// path (clickable_path: true/false)
JSON Configuration Example
{
"time_range": [2, 12, 1000],
"peaks": [
{"name": " ", "RT": 3.5, "height": 1853, "HWHM": 0.12},
{"name": "Peak A", "RT": 5.0, "height": 8316, "HWHM": 0.15},
{
"name": "Peak B (composite)",
"type": "composite",
"peaks": [
{"RT": 6.3, "height": 6653, "HWHM": 0.15},
{"RT": 6.5, "height": 3259, "HWHM": 0.12},
{"RT": 6.6, "height": 2877, "HWHM": 0.12}
]
}
],
"baseline": 20,
"noise_level": 15,
"output": "custom_peak_plot.png",
"xlabel": "Time",
"ylabel": "Response",
"x_unit": "min",
"y_unit": "mV",
"export_csv": true,
"clickable_path": true,
"grid": true,
"grid_linestyle": "solid",
"grid_alpha": 0.4
}
CSV Output Format (RFC 4180 Standard)
Time_min,Signal_mV
2.000000,49.782199
2.020040,46.140969
...
| Parameter | Value | Description |
|---|---|---|
grid |
true |
Show/hide grid lines |
grid_linestyle |
solid/dashed/dotted/dashdot |
Grid line style |
grid_alpha |
0.1-1.0 |
Grid transparency |
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install simulated-peak-plot - 安装完成后,直接呼叫该 Skill 的名称或使用
/simulated-peak-plot触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
simulated-peak-plot 是什么?
Generate simulated peak plots with customizable Gaussian peaks for chromatography, spectroscopy, or any signal visualization. Use when user asks to generate... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 44 次。
如何安装 simulated-peak-plot?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install simulated-peak-plot」即可一键安装,无需额外配置。
simulated-peak-plot 是免费的吗?
是的,simulated-peak-plot 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
simulated-peak-plot 支持哪些平台?
simulated-peak-plot 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 simulated-peak-plot?
由 Lighthexuish(@ldxs001)开发并维护,当前版本 v2.1.0。