Skip to content

Commit 2708898

Browse files
HanSur94claude
andauthored
feat: complete API coverage in examples + wiki FastPlot-to-FastSense rename
* ci: migrate wiki to main repo with sync workflow - Track wiki/ content in main repo as source of truth - Add sync-wiki.yml to push wiki/ to GitHub Wiki repo on merge - Update generate-docs.yml to write API docs to main repo wiki/ - Update wiki-links.yml to check main repo wiki/ instead of cloning remote Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address CI workflow issues in wiki sync pipeline - Add inline wiki sync to generate-docs.yml (GITHUB_TOKEN pushes don't re-trigger other workflows) - Propagate deletions in sync-wiki.yml (rm stale files before copy) - Add explicit permissions to wiki-links.yml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add generate_wiki.py with page mapping, change detection, and context assembly Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address code quality issues in generate_wiki.py - Add AUTO_GENERATED_NOTICE safety net on write - Apply exclusion filter in --all mode - Handle absolute paths in --changed-files - Promote TOKEN_BUDGET to module-level constant - Fix summary file newline handling Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: complete API coverage in examples + wiki FastPlot→FastSense rename Enhance 12 example scripts to demonstrate 25+ previously uncovered APIs including setScale, resetColorIndex, lookupMetadata, setLineMetadata, openLoupe, distFig, resetDefaults, FastSenseDefaults, undockTab, SensorRegistry register/unregister/printTable/viewer, DashboardEngine exportScript/load/removeWidget/setWidgetPosition, color palettes, setTileTheme, setViewMode, DeferDraw, ShowProgress, reapplyTheme, setViolationsVisible, updateData, currentStatus, countViolations, StateChannel.valueAt, ConsoleProgressBar, and DataStore.findViolations. Also rename all class references in 13 wiki pages from the old FastPlot names (FastPlotFigure, FastPlotDock, etc.) to the current FastSense names, while preserving FastPlot as the project/brand name. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add prompt templates for each wiki page type Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add Claude API integration for wiki page generation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: harden Claude API response handling in generate_wiki.py - Guard against empty response content list and non-text blocks - Warn on max_tokens truncation - Only strip trailing code fence when leading fence was detected Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address PR review — remaining wiki FastPlot.m references Fix three stale references found in code review: - Architecture.md: directory tree showed libs/FastPlot/ and FastPlot.m - Examples.md: "Proves FastPlot handles" → "Proves FastSense handles" - Use-Case wiki: "in FastPlot.m" → "in FastSense.m" Also add clarifying comment in example_dashboard_engine.m noting that the JSON load restores the pre-mutation state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3f69b9c commit 2708898

33 files changed

Lines changed: 4913 additions & 36 deletions

.github/workflows/generate-docs.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,43 @@ jobs:
2323
with:
2424
python-version: '3.12'
2525

26-
- name: Clone wiki repo
27-
env:
28-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29-
run: |
30-
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/HanSur94/FastSense.wiki.git" wiki
31-
3226
- name: Generate API docs
3327
run: python3 scripts/generate_api_docs.py
3428

35-
- name: Push updated wiki
29+
- name: Commit updated wiki
3630
run: |
37-
cd wiki
3831
git config user.name "github-actions[bot]"
3932
git config user.email "github-actions[bot]@users.noreply.github.com"
40-
git add -A
33+
git add wiki/
4134
if git diff --cached --quiet; then
4235
echo "No documentation changes"
4336
else
4437
git commit -m "docs: auto-update API reference from source code"
4538
git push
46-
echo "Wiki API docs updated"
39+
echo "Wiki API docs updated in main repo"
40+
fi
41+
42+
- name: Sync to wiki repo
43+
if: success()
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: |
47+
# Only sync if the commit step actually pushed changes
48+
if git log -1 --format='%s' | grep -q "auto-update API reference"; then
49+
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/HanSur94/FastSense.wiki.git" wiki-remote
50+
rm -f wiki-remote/*.md
51+
cp wiki/*.md wiki-remote/
52+
cd wiki-remote
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
git add -A
56+
if git diff --cached --quiet; then
57+
echo "Wiki repo already up to date"
58+
else
59+
git commit -m "docs: sync wiki from main repo"
60+
git push
61+
echo "Wiki repo synced"
62+
fi
63+
else
64+
echo "No wiki changes were committed, skipping sync"
4765
fi

.github/workflows/sync-wiki.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Sync Wiki
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'wiki/**'
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
sync:
14+
name: Sync wiki to GitHub Wiki repo
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout main repo
18+
uses: actions/checkout@v4
19+
20+
- name: Clone wiki repo
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/HanSur94/FastSense.wiki.git" wiki-remote
25+
26+
- name: Copy wiki content
27+
run: |
28+
rm -f wiki-remote/*.md
29+
cp wiki/*.md wiki-remote/
30+
31+
- name: Push to wiki repo
32+
run: |
33+
cd wiki-remote
34+
git config user.name "github-actions[bot]"
35+
git config user.email "github-actions[bot]@users.noreply.github.com"
36+
git add -A
37+
if git diff --cached --quiet; then
38+
echo "No wiki changes to sync"
39+
else
40+
git commit -m "docs: sync wiki from main repo"
41+
git push
42+
echo "Wiki synced successfully"
43+
fi

.github/workflows/wiki-links.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@ on:
99
- cron: '0 6 * * 1'
1010
workflow_dispatch:
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
check-links:
1417
name: Check Wiki Links
1518
runs-on: ubuntu-latest
1619
steps:
1720
- uses: actions/checkout@v4
1821

19-
- name: Clone wiki
20-
run: |
21-
git clone https://github.com/HanSur94/FastSense.wiki.git wiki-check
22-
2322
- name: Check markdown links
2423
uses: lycheeverse/lychee-action@v2
2524
with:
@@ -28,5 +27,5 @@ jobs:
2827
--exclude-loopback
2928
--exclude 'github.com/HanSur94/FastSense/wiki'
3029
--suggest
31-
wiki-check/*.md
30+
wiki/*.md
3231
fail: true

examples/example_100M.m

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,35 @@
1111
y = cumsum(randn(1, n)) / sqrt(n); % random walk
1212
fprintf('Data generated in %.1f seconds.\n', toc);
1313

14-
fprintf('Rendering with ShowProgress=true (default)...\n');
14+
fprintf('Rendering...\n');
1515
tic;
1616

17+
% DeferDraw (default: false) — when true, skips drawnow during render.
18+
% Useful in batch/headless workflows. Requires manual drawnow afterward.
19+
% ShowProgress (default: true) — when false, hides the console progress bar.
20+
% The default shows a live progress bar during render.
21+
% Both are set to their non-default values here to demonstrate the options.
1722
fp = FastSense();
18-
fp.ShowProgress = true; % show console progress bar during render (default)
19-
fp.DeferDraw = false; % allow incremental drawing (default)
23+
fp.DeferDraw = true;
24+
fp.ShowProgress = false;
2025
fp.addLine(x, y, 'DisplayName', '100M Random Walk', 'Color', [0 0.4 0.8]);
2126
fp.addThreshold(3, 'Direction', 'upper', 'ShowViolations', true);
2227
fp.addThreshold(-3, 'Direction', 'lower', 'ShowViolations', true);
2328
fp.render();
29+
drawnow; % manual drawnow needed since DeferDraw=true
2430

2531
fprintf('Rendered in %.3f seconds. Zoom in to see detail!\n', toc);
2632
title(fp.hAxes, 'FastSense — 100M Points Stress Test');
2733

28-
fprintf('\nDeferDraw=true skips drawnow during render (useful in batch/headless).\n');
29-
fprintf('ShowProgress=false hides the console progress bar.\n');
34+
%% ConsoleProgressBar — standalone usage for custom batch workflows
35+
% FastSense uses this internally when ShowProgress=true, but you can also
36+
% use it directly for your own long-running loops.
37+
pb = ConsoleProgressBar();
38+
pb.start();
39+
nSteps = 20;
40+
for k = 1:nSteps
41+
pb.update(k, nSteps, 'Processing');
42+
pause(0.05);
43+
end
44+
pb.finish();
45+
fprintf('ConsoleProgressBar demo complete.\n');

examples/example_alarm_bands.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@
4343
%% setViolationsVisible — toggle violation markers on/off
4444
fp.setViolationsVisible(false);
4545
fprintf('setViolationsVisible(false): violation markers hidden.\n');
46-
pause(1);
46+
drawnow;
4747
fp.setViolationsVisible(true);
4848
fprintf('setViolationsVisible(true): violation markers restored.\n');

examples/example_basic.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,23 @@
3737
% Exponential growth data is best viewed with log scaling
3838
n2 = 1e6;
3939
x2 = linspace(1, 1000, n2);
40-
y2 = exp(x2 / 200) + 0.1 * abs(randn(1, n2)) .* exp(x2 / 200);
40+
base2 = exp(x2 / 200);
41+
y2 = base2 .* (1 + 0.1 * abs(randn(1, n2)));
4142

4243
fp2 = FastSense();
4344
fp2.addLine(x2, y2, 'DisplayName', 'Exponential Growth');
4445
fp2.addThreshold(100, 'Direction', 'upper', 'ShowViolations', true, ...
4546
'Label', 'Warning');
4647
fp2.render();
4748

48-
% Switch Y axis to log scale (can be called before or after render)
49+
% Switch Y axis to log scale (can be called before or after render).
50+
% Try fp2.setScale('YScale', 'linear') to toggle back.
4951
fp2.setScale('YScale', 'log');
5052
title(fp2.hAxes, 'setScale — Logarithmic Y Axis');
5153
fprintf('setScale() demo: Y axis switched to log scale.\n');
54+
55+
%% updateData — replace line data on an already-rendered plot
56+
newY = cos(x * 2*pi/15) + 0.4*randn(1, n);
57+
fp.updateData(1, x, newY);
58+
title(fp.hAxes, 'updateData — line data replaced in-place');
59+
fprintf('updateData() replaced 10M-point line data on the first plot.\n');

examples/example_dashboard.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
fig.setTileXLabel(4, 'Time (s)');
6868

6969
%% setTileTheme — per-tile theme overrides
70-
% Override individual tile appearance without changing the whole grid theme
70+
% Override individual tile appearance without changing the whole grid theme.
71+
% Uses custom dark colors for tile 4 only; the other tiles keep the grid theme.
7172
fig.setTileTheme(4, struct('Background', [0.15 0.15 0.2], ...
7273
'AxesColor', [0.1 0.1 0.15], 'ForegroundColor', [0.9 0.9 0.9]));
7374
fig.reapplyTheme();

examples/example_dashboard_engine.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,18 @@
7979
d.exportScript(scriptPath);
8080
fprintf('Dashboard exported to script: %s\n', scriptPath);
8181

82-
%% 5. Load from JSON (demonstrates roundtrip)
82+
%% 5. Programmatic widget management
83+
% setWidgetPosition — move/resize a widget on the 24-column grid
84+
d.setWidgetPosition(2, [1 9 12 8]); % move pressure widget below, half-width
85+
fprintf('setWidgetPosition: moved pressure widget to [1 9 12 8].\n');
86+
87+
% removeWidget — delete a widget by index
88+
d.removeWidget(3); % remove the full-view temperature widget
89+
fprintf('removeWidget: removed widget 3 (full-view temperature).\n');
90+
91+
%% 6. Load from JSON (demonstrates roundtrip)
92+
% Loads the original 3-widget layout saved in step 3, before the
93+
% removeWidget/setWidgetPosition mutations above.
8394
% SensorResolver maps sensor keys back to Sensor objects for the loaded config
8495
sensorMap = containers.Map({'T-401', 'P-201'}, {sTemp, sPress});
8596
d2 = DashboardEngine.load(jsonPath, 'SensorResolver', @(key) sensorMap(key));

examples/example_disk_storage.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@
8787
fprintf(' First 5 status values: %s\n', strjoin(vals, ', '));
8888
fprintf(' Available columns: %s\n', strjoin(ds.listColumns(), ', '));
8989

90+
% findViolations — find threshold violations directly on disk-backed data.
91+
% Skips chunks whose y_min/y_max can't contain violations, avoiding full reads.
92+
tic;
93+
[vx, vy] = ds.findViolations(1, n_large, 1.0, true); % upper threshold at 1.0
94+
fprintf(' findViolations(upper > 1.0): %d violations in %.4f s\n', numel(vx), toc);
95+
9096
ds.cleanup(); % explicit cleanup (also happens automatically on delete)
9197
fprintf(' DataStore cleaned up.\n');
9298

examples/example_linked.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@
3838

3939
%% setViewMode — control how X-axis adjusts during live updates
4040
% 'preserve' keeps current zoom, 'follow' scrolls to track latest data,
41-
% 'reset' fits full X range.
41+
% 'reset' fits full X range. The mode takes effect when startLive() is
42+
% active; on a static plot like this it simply pre-configures the setting.
43+
% See example_event_detection_live.m for setViewMode in action with live data.
4244
fp1.setViewMode('follow');
4345
fp2.setViewMode('follow');
4446
fp3.setViewMode('follow');
45-
fprintf('setViewMode(''follow'') set on all 3 plots — ready for live scrolling.\n');
47+
fprintf('setViewMode(''follow'') set on all 3 plots — takes effect during live updates.\n');
48+
fprintf(' See example_event_detection_live.m for live scrolling in action.\n');

0 commit comments

Comments
 (0)