Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ Apps are first-class deliverables. Do not treat them as examples for a hidden pl
package components instead of adding new `private/` runners or string-dispatch
workflow adapters.
- Do not add new `*Workflow.m` files or app-owned `+core/dispatch.m` string
routers. The existing electrochemistry dispatch files are temporary migration
debt documented in `docs/architecture.md`.
routers.
- When a public app file grows large, prefer moving GUI-free app-owned calculations, export builders, formatting utilities, deterministic image/signal transforms, and focused control construction into `apps/<family>/<app_slug>/+<app_slug>/...`.
- Do not add new `apps/<family>/private/` helpers unless the helper is genuinely shared by multiple apps in that family and the user approves that family-level boundary.
- Keep the public app entry point responsible for GUI state, callbacks, user alerts, app workflow order, debug launch routing, and user-facing log wording.
Expand Down
283 changes: 0 additions & 283 deletions apps/electrochem/chrono_overlay/+chrono_overlay/+core/dispatch.m

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,67 @@
% Expected caller: chrono overlay app runner and export tests. Inputs are aligned
% chrono item structs. Output is the stable overlay export table. No file side
% effects.

function T = buildOverlayExportTable(items)
T = chrono_overlay.core.dispatch("buildOverlayExportTable", items);
timeUnion = [];
for i = 1:numel(items)
timeUnion = [timeUnion; chronoAlignedTime(items(i))]; %#ok<AGROW>
end
timeUnion = unique(timeUnion);
timeUnion = sort(timeUnion);

T = table(timeUnion, 'VariableNames', {'TimeGapCenterAligned_s'});
for i = 1:numel(items)
safeName = sanitizeFieldName(items(i).name);
vName = ['V_' safeName];
iName = ['I_' safeName];

tAligned = chronoAlignedTime(items(i));
Vf = chronoVoltage(items(i));
Im = chronoCurrent(items(i));
if numel(tAligned) >= 2
vData = interp1(tAligned, Vf, timeUnion, 'linear', NaN);
iData = interp1(tAligned, Im, timeUnion, 'linear', NaN);
else
vData = NaN(size(timeUnion));
iData = NaN(size(timeUnion));
end

T.(vName) = vData;
T.(iName) = iData;
end
end

function t = chronoAlignedTime(item)
if isfield(item, 'tAligned') && ~isempty(item.tAligned)
t = item.tAligned(:);
elseif isfield(item, 'tAligned_s') && ~isempty(item.tAligned_s)
t = item.tAligned_s(:);
else
t = [];
end
end

function v = chronoVoltage(item)
if isfield(item, 'Vf') && ~isempty(item.Vf)
v = item.Vf(:);
elseif isfield(item, 'Vf_V') && ~isempty(item.Vf_V)
v = item.Vf_V(:);
else
v = [];
end
end

function i = chronoCurrent(item)
if isfield(item, 'Im') && ~isempty(item.Im)
i = item.Im(:);
elseif isfield(item, 'Im_A') && ~isempty(item.Im_A)
i = item.Im_A(:);
else
i = [];
end
end

function out = sanitizeFieldName(txt)
out = matlab.lang.makeValidName(txt);
end
Loading
Loading