XiaoMaColtAI/math-modeling-skill / dsh-plugin/math-modeling-agent/skills/math-modeling/references/roles/编程手
编程手
Verified数学建模的 Python 或 MATLAB 实现、运行、表格输出、可视化和复现阶段。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.3 KB |
| references/MATLAB规范.md | markdown | 3.4 KB |
| references/工作流程.md | markdown | 9.9 KB |
| references/质检清单.md | markdown | 4.2 KB |
| scripts/apply_publication_style.m | other | 2.2 KB |
| scripts/audit_publication_figure.m | other | 3.4 KB |
| scripts/check_env.py | script | 2.7 KB |
| scripts/check_matlab_env.m | other | 1.3 KB |
| scripts/export_publication_figure.m | other | 1.4 KB |
| scripts/figure_audit.py | script | 7.1 KB |
| scripts/plot_style.py | script | 16.8 KB |
| scripts/repro_manifest.py | script | 4.2 KB |
scripts/export_publication_figure.m
View on GitHubfunction outputs = export_publication_figure(fig, outputStem, dpi, grayscalePreview, strictDesign)
%EXPORT_PUBLICATION_FIGURE 通过设计门禁后输出 SVG、PNG 与灰度质检图。
arguments
fig (1,1) matlab.ui.Figure
outputStem (1,1) string
dpi (1,1) double {mustBeInteger,mustBeGreaterThanOrEqual(dpi,300)} = 300
grayscalePreview (1,1) logical = true
strictDesign (1,1) logical = true
end
[folder, name, ~] = fileparts(outputStem);
if strlength(folder) == 0
folder = ".";
end
if ~isfolder(folder)
mkdir(folder);
end
stem = fullfile(folder, name);
svgPath = stem + ".svg";
pngPath = stem + ".png";
fig.PaperPositionMode = "auto";
drawnow;
designIssues = audit_publication_figure(fig);
if strictDesign && ~isempty(designIssues)
error("出版设计预检未通过:%s", join(designIssues, ";"));
end
exportgraphics(fig, svgPath, "ContentType", "vector");
exportgraphics(fig, pngPath, "Resolution", dpi);
outputs = struct("svg", svgPath, "png", pngPath);
if grayscalePreview
qaFolder = fullfile(folder, "_qa");
if ~isfolder(qaFolder)
mkdir(qaFolder);
end
image = imread(pngPath);
rgb = double(image(:,:,1:3));
if isinteger(image)
rgb = rgb / double(intmax(class(image)));
end
gray = 0.2126 * rgb(:,:,1) + 0.7152 * rgb(:,:,2) + 0.0722 * rgb(:,:,3);
grayPath = fullfile(qaFolder, name + "_grayscale.png");
imwrite(gray, grayPath);
outputs.grayscale = grayPath;
end
end
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |