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
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
% App-owned chrono overlay workflow helper dispatch. Expected caller:
% labkit_ChronoOverlay_app callbacks and workflow tests.
% App-owned chrono overlay helper core dispatch. Expected caller:
% labkit_ChronoOverlay_app callbacks and package tests.
% Inputs are a command string plus the original helper arguments; outputs match
% the selected helper. Side effects are limited to drawing app-owned overlay
% plots on caller axes.
function varargout = chronoOverlayWorkflow(command, varargin)
%CHRONOOVERLAYWORKFLOW Dispatch app-owned chrono overlay helpers.
% Expected caller: labkit_ChronoOverlay_app callbacks and temporary compatibility
% workflow tests. Inputs are a command string plus the original helper arguments.
function varargout = dispatch(command, varargin)
%DISPATCH Route chrono overlay package wrapper calls to app-owned helpers.
% Expected caller: labkit_ChronoOverlay_app callbacks and % package tests. Inputs are a command string plus the original helper arguments.
% Outputs match the selected helper. Side effects are limited to drawing
% app-owned overlay plots on caller axes.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% 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);
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: chrono overlay app runner and unit tests. Inputs are one
% chrono item struct with time/current/voltage and pulse fields. Outputs return
% the aligned item and status message. No file or UI side effects.
function [item, msg] = alignByPulseGap(item)
[item, msg] = chrono_overlay.core.dispatch("alignByPulseGap", item);
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% Input is the debug context prepared by the public launcher. Output is the app
% figure. Side effects are GUI creation, user-driven file I/O, exports,
% plotting, and debug trace attachment exactly as in the original entrypoint body.
function fig = runChronoOverlayApp(debugLog)
function fig = runApp(debugLog)
%RUNCHRONOOVERLAYAPP Build and run the app body.

S = struct();
Expand Down Expand Up @@ -160,7 +160,7 @@ function postProcessAddedItems(filepaths)
end

item = S.session.items(idx);
[item, alignMsg] = chronoOverlayWorkflow("alignByPulseGap", item);
[item, alignMsg] = chrono_overlay.ops.alignByPulseGap(item);
S.session.items(idx) = item;
addLog(alignMsg);

Expand Down Expand Up @@ -204,7 +204,7 @@ function refreshFileList()

function refreshPlots()
if isempty(S.items)
chronoOverlayWorkflow("plotVTIT", axV, axI, struct([]), plotOptions());
chrono_overlay.view.plotVTIT(axV, axI, struct([]), plotOptions());
return;
end

Expand All @@ -215,7 +215,7 @@ function refreshPlots()
return;
end

chronoOverlayWorkflow("plotVTIT", axV, axI, items, plotOptions());
chrono_overlay.view.plotVTIT(axV, axI, items, plotOptions());
end

function onExportCSV(~, ~)
Expand All @@ -235,7 +235,7 @@ function onExportCSV(~, ~)
return;
end

T = chronoOverlayWorkflow("buildOverlayExportTable", items);
T = chrono_overlay.export.buildOverlayExportTable(items);
out = fullfile(p, f);
writetable(T, out);
addLog(sprintf('Exported CSV: %s', out));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: chrono overlay app runner. Inputs are voltage/current axes,
% aligned item structs, and plot option fields. Side effects are limited to
% redrawing the supplied axes.
function plotVTIT(axV, axI, items, opts)
chrono_overlay.core.dispatch("plotVTIT", axV, axI, items, opts);
end
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
error('labkit_ChronoOverlay_app:TooManyOutputs', 'labkit_ChronoOverlay_app returns at most the app figure handle.');
end

fig = runChronoOverlayApp(debugLog);
fig = chrono_overlay.ui.runApp(debugLog);
if nargout >= 1
varargout{1} = fig;
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
% App-owned CIC workflow helper dispatch. Expected caller: labkit_CIC_app
% callbacks and workflow tests. Inputs are a command string plus the original
% App-owned CIC helper core dispatch. Expected caller: labkit_CIC_app
% callbacks and package tests. Inputs are a command string plus the original
% helper arguments; outputs match the selected helper. Side effects are limited
% to CSV export writes and drawing app-owned plot annotations on caller axes.
function varargout = cicWorkflow(command, varargin)
%CICWORKFLOW Dispatch app-owned CIC analysis/export helpers.
% Expected caller: labkit_CIC_app callbacks and workflow tests.
function varargout = dispatch(command, varargin)
%DISPATCH Route CIC package wrapper calls to app-owned helpers.
% Expected caller: labkit_CIC_app callbacks and package tests.
% Inputs are a command string plus the original helper arguments. Outputs match
% the selected helper. Side effects are limited to CSV export writes and drawing
% app-owned plot annotations on caller axes.
Expand Down
6 changes: 6 additions & 0 deletions apps/electrochem/cic/+cic/+export/buildResultsTable.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: CIC app runner and export tests. Inputs are item structs and
% display unit label. Output is the stable CIC CSV result table. No file side
% effects.
function T = buildResultsTable(items, unitLabel)
T = cic.core.dispatch("buildResultsTable", items, unitLabel);
end
6 changes: 6 additions & 0 deletions apps/electrochem/cic/+cic/+export/writeResultsCSV.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: CIC app runner and export tests. Inputs are item structs,
% output filepath, and display unit label. Side effect is writing the stable CIC
% CSV file.
function [ok, msg] = writeResultsCSV(items, filepath, unitLabel)
[ok, msg] = cic.core.dispatch("writeResultsCSV", items, filepath, unitLabel);
end
6 changes: 6 additions & 0 deletions apps/electrochem/cic/+cic/+ops/computeCIC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: CIC app runner and unit tests. Inputs are a DTA item struct
% and CIC option struct. Output is the stable CIC analysis result struct. No file
% or UI side effects.
function A = computeCIC(item, opts)
A = cic.core.dispatch("computeCIC", item, opts);
end
5 changes: 5 additions & 0 deletions apps/electrochem/cic/+cic/+ops/interp1Safe.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
% Expected caller: CIC app plotting helpers. Inputs are vectors x/y and query
% points. Output mirrors the app-owned safe interpolation helper. No side effects.
function v = interp1Safe(x, y, xq)
v = cic.core.dispatch("interp1Safe", x, y, xq);
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% Input is the debug context prepared by the public launcher. Output is the app
% figure. Side effects are GUI creation, user-driven file I/O, exports,
% plotting, and debug trace attachment exactly as in the original entrypoint body.
function fig = runCICApp(debugLog)
function fig = runApp(debugLog)
%RUNCICAPP Build and run the app body.

S = struct();
Expand Down Expand Up @@ -284,7 +284,7 @@ function analyzeCurrentFile()
opts.pulseMode = ddPulseMode.Value;
opts.usedMeasuredCurrent = cbUseMeasuredCurrent.Value;

A = cicWorkflow("computeCIC", item, opts);
A = cic.ops.computeCIC(item, opts);
item.analysis = A;
if A.ok
addLog(sprintf('%s: Emc=%.6f V, Ema=%.6f V, safe=%d', item.name, A.Emc, A.Ema, A.safe));
Expand Down Expand Up @@ -344,7 +344,7 @@ function refreshFileList()

function refreshBatchTable()
[~, unitLabel] = cicDisplayUnit();
[C, columnNames] = cicWorkflow("buildBatchTableData", S.items, unitLabel);
[C, columnNames] = cic.view.buildBatchTableData(S.items, unitLabel);
tbl.ColumnName = columnNames;
if isempty(S.items)
tbl.Data = cell(0,8);
Expand Down Expand Up @@ -386,12 +386,12 @@ function refreshResultsSummary()
A = it.analysis;
S.txtDetect.Value = sprintf('%s | %s', A.detectMode, A.detectMsg);
S.txtDelay.Value = sprintf('%.3f us', 1e6 * A.delay_s);
S.txtArea.Value = cicWorkflow("formatMaybeNum", A.area_cm2,'%.8g cm^2');
S.txtArea.Value = cic.view.formatMaybeNum(A.area_cm2,'%.8g cm^2');
S.txtEmc.Value = sprintf('%.6f V @ %.6fus', A.Emc, 1e6*A.t_emc);
S.txtEma.Value = sprintf('%.6f V @ %.6fus', A.Ema, 1e6*A.t_ema);
S.txtQc.Value = cicWorkflow("formatChargeDensity", A.Qc_C, A.CICc_mCcm2, ddCICUnit.Value);
S.txtQa.Value = cicWorkflow("formatChargeDensity", A.Qa_C, A.CICa_mCcm2, ddCICUnit.Value);
S.txtQt.Value = cicWorkflow("formatChargeDensity", A.Qt_C, A.CICt_mCcm2, ddCICUnit.Value);
S.txtQc.Value = cic.view.formatChargeDensity(A.Qc_C, A.CICc_mCcm2, ddCICUnit.Value);
S.txtQa.Value = cic.view.formatChargeDensity(A.Qa_C, A.CICa_mCcm2, ddCICUnit.Value);
S.txtQt.Value = cic.view.formatChargeDensity(A.Qt_C, A.CICt_mCcm2, ddCICUnit.Value);
if A.safe
safeText = 'SAFE';
else
Expand Down Expand Up @@ -505,12 +505,12 @@ function plotOneAxis(ax, A, xChoice, yChoice, showGrid)
if strcmp(xChoice,'Sample #')
x = A.pt;
xlab = 'Sample #';
cathStartX = cicWorkflow("interp1Safe", A.t, A.pt, A.pulse.cath_start);
cathEndX = cicWorkflow("interp1Safe", A.t, A.pt, A.pulse.cath_end);
anodStartX = cicWorkflow("interp1Safe", A.t, A.pt, A.pulse.anod_start);
anodEndX = cicWorkflow("interp1Safe", A.t, A.pt, A.pulse.anod_end);
emcX = cicWorkflow("interp1Safe", A.t, A.pt, A.t_emc);
emaX = cicWorkflow("interp1Safe", A.t, A.pt, A.t_ema);
cathStartX = cic.ops.interp1Safe(A.t, A.pt, A.pulse.cath_start);
cathEndX = cic.ops.interp1Safe(A.t, A.pt, A.pulse.cath_end);
anodStartX = cic.ops.interp1Safe(A.t, A.pt, A.pulse.anod_start);
anodEndX = cic.ops.interp1Safe(A.t, A.pt, A.pulse.anod_end);
emcX = cic.ops.interp1Safe(A.t, A.pt, A.t_emc);
emaX = cic.ops.interp1Safe(A.t, A.pt, A.t_ema);
else
x = A.t;
xlab = 'Time (s)';
Expand All @@ -530,8 +530,8 @@ function plotOneAxis(ax, A, xChoice, yChoice, showGrid)
hold(ax,'on');

if cbShowShading.Value
cicWorkflow("shadeWindow", ax, cathStartX, cathEndX, [0.85 0.93 1.00]);
cicWorkflow("shadeWindow", ax, anodStartX, anodEndX, [1.00 0.92 0.85]);
cic.view.shadeWindow(ax, cathStartX, cathEndX, [0.85 0.93 1.00]);
cic.view.shadeWindow(ax, anodStartX, anodEndX, [1.00 0.92 0.85]);
end

if cbShowLimits.Value
Expand All @@ -541,14 +541,14 @@ function plotOneAxis(ax, A, xChoice, yChoice, showGrid)
'Color',[0.85 0.2 0.2],'LabelHorizontalAlignment','left');
end

cicWorkflow("addBaselineYLines", ax, A);
cic.view.addBaselineYLines(ax, A);

if cbShowMarkers.Value
xline(ax, cathStartX, ':', 'Cath start','Color',[0.2 0.4 0.8]);
xline(ax, cathEndX, ':', 'Cath end','Color',[0.2 0.4 0.8]);
xline(ax, anodStartX, ':', 'Anod start','Color',[0.8 0.4 0.2]);
xline(ax, anodEndX, ':', 'Anod end','Color',[0.8 0.4 0.2]);
cicWorkflow("addPaperStyleVTAnnotations", ax, A, xChoice, ...
cic.view.addPaperStyleVTAnnotations(ax, A, xChoice, ...
cathStartX, cathEndX, anodStartX, anodEndX, emcX, emaX);
end
hold(ax,'off');
Expand All @@ -566,16 +566,16 @@ function plotOneAxis(ax, A, xChoice, yChoice, showGrid)
hold(ax,'on');

if cbShowShading.Value
cicWorkflow("shadeWindow", ax, cathStartX, cathEndX, [0.85 0.93 1.00]);
cicWorkflow("shadeWindow", ax, anodStartX, anodEndX, [1.00 0.92 0.85]);
cic.view.shadeWindow(ax, cathStartX, cathEndX, [0.85 0.93 1.00]);
cic.view.shadeWindow(ax, anodStartX, anodEndX, [1.00 0.92 0.85]);
end

if cbShowMarkers.Value
xline(ax, cathStartX, ':', 'Cath start','Color',[0.2 0.4 0.8]);
xline(ax, cathEndX, ':', 'Cath end','Color',[0.2 0.4 0.8]);
xline(ax, anodStartX, ':', 'Anod start','Color',[0.8 0.4 0.2]);
xline(ax, anodEndX, ':', 'Anod end','Color',[0.8 0.4 0.2]);
cicWorkflow("addPaperStyleITAnnotations", ax, A, xChoice, ...
cic.view.addPaperStyleITAnnotations(ax, A, xChoice, ...
cathStartX, cathEndX, anodStartX, anodEndX, emcX, emaX);
end
hold(ax,'off');
Expand Down Expand Up @@ -627,7 +627,7 @@ function exportResultsCSV()
end
out = fullfile(p,f);
[~, unitLabel] = cicDisplayUnit();
[ok, msg] = cicWorkflow("writeResultsCSV", S.items, out, unitLabel);
[ok, msg] = cic.export.writeResultsCSV(S.items, out, unitLabel);
if ~ok
uialert(fig,msg,'Export');
return;
Expand Down
5 changes: 5 additions & 0 deletions apps/electrochem/cic/+cic/+view/addBaselineYLines.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
% Expected caller: CIC app plotting helpers. Inputs are an axes and CIC result
% struct. Side effects are limited to drawing baseline guides on the axes.
function addBaselineYLines(ax, A)
cic.core.dispatch("addBaselineYLines", ax, A);
end
6 changes: 6 additions & 0 deletions apps/electrochem/cic/+cic/+view/addPaperStyleITAnnotations.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: CIC app plotting helpers. Inputs mirror the app-owned IT
% annotation helper. Side effects are limited to annotating the supplied axes.
function addPaperStyleITAnnotations(ax, A, xChoice, cathStartX, cathEndX, anodStartX, anodEndX)
cic.core.dispatch("addPaperStyleITAnnotations", ax, A, xChoice, ...
cathStartX, cathEndX, anodStartX, anodEndX);
end
6 changes: 6 additions & 0 deletions apps/electrochem/cic/+cic/+view/addPaperStyleVTAnnotations.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: CIC app plotting helpers. Inputs mirror the app-owned VT
% annotation helper. Side effects are limited to annotating the supplied axes.
function addPaperStyleVTAnnotations(ax, A, xChoice, cathStartX, cathEndX, anodStartX, anodEndX, emcX, emaX)
cic.core.dispatch("addPaperStyleVTAnnotations", ax, A, xChoice, ...
cathStartX, cathEndX, anodStartX, anodEndX, emcX, emaX);
end
6 changes: 6 additions & 0 deletions apps/electrochem/cic/+cic/+view/buildBatchTableData.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: CIC app runner and unit tests. Inputs are item structs and a
% display unit label. Outputs are the stable UI table cell data and column names.
% No file side effects.
function [C, columnNames] = buildBatchTableData(items, unitLabel)
[C, columnNames] = cic.core.dispatch("buildBatchTableData", items, unitLabel);
end
5 changes: 5 additions & 0 deletions apps/electrochem/cic/+cic/+view/formatChargeDensity.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
% Expected caller: CIC app runner. Inputs are charge, density, and display unit
% label. Output is the stable read-only UI text. No side effects.
function txt = formatChargeDensity(charge_C, density_mCcm2, unitLabel)
txt = cic.core.dispatch("formatChargeDensity", charge_C, density_mCcm2, unitLabel);
end
5 changes: 5 additions & 0 deletions apps/electrochem/cic/+cic/+view/formatMaybeNum.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
% Expected caller: CIC app runner. Inputs are a numeric value and sprintf format.
% Output is the stable UI text for finite or missing values. No side effects.
function txt = formatMaybeNum(value, fmt)
txt = cic.core.dispatch("formatMaybeNum", value, fmt);
end
5 changes: 5 additions & 0 deletions apps/electrochem/cic/+cic/+view/shadeWindow.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
% Expected caller: CIC app plotting helpers. Inputs are an axes, x-window, and
% color. Side effects are limited to adding the app-owned patch to the axes.
function shadeWindow(ax, x1, x2, color)
cic.core.dispatch("shadeWindow", ax, x1, x2, color);
end
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
error('labkit_CIC_app:TooManyOutputs', 'labkit_CIC_app returns at most the app figure handle.');
end

fig = runCICApp(debugLog);
fig = cic.ui.runApp(debugLog);
if nargout >= 1
varargout{1} = fig;
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
% App-owned CSC workflow helper dispatch. Expected caller: labkit_CSC_app
% callbacks and workflow tests. Inputs are a command
% App-owned CSC helper core dispatch. Expected caller: labkit_CSC_app
% callbacks and package tests. Inputs are a command
% string plus the original helper arguments; outputs match the selected helper.
% This helper has no file side effects.
function varargout = cscWorkflow(command, varargin)
%CSCWORKFLOW Dispatch app-owned CSC calculation helpers.
% Expected caller: labkit_CSC_app callbacks and workflow tests. Inputs are a
function varargout = dispatch(command, varargin)
%DISPATCH Route CSC package wrapper calls to app-owned helpers.
% Expected caller: labkit_CSC_app callbacks and package tests. Inputs are a
% command string plus the original helper arguments.
% Outputs match the selected helper. This helper has no file side effects.

Expand Down
6 changes: 6 additions & 0 deletions apps/electrochem/csc/+csc/+ops/computeCSC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: CSC app runner and unit tests. Inputs are a CV/CT curve struct
% and CSC options. Output is the stable CSC comparison result struct. No file or
% UI side effects.
function A = computeCSC(curve, opts)
A = csc.core.dispatch("computeCSC", curve, opts);
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% Input is the debug context prepared by the public launcher. Output is the app
% figure. Side effects are GUI creation, user-driven file I/O, exports,
% plotting, and debug trace attachment exactly as in the original entrypoint body.
function fig = runCSCApp(debugLog)
function fig = runApp(debugLog)
%RUNCSCAPP Build and run the app body.

S = struct();
Expand Down Expand Up @@ -461,7 +461,7 @@ function refreshCompare()
opts.mode = ddMode.Value;
opts.scanRate = S.scanRate;
opts.area_cm2 = edArea.Value;
R = cscWorkflow("computeCSC", c, opts);
R = csc.ops.computeCSC(c, opts);

if ~R.ok
txtQct.Value = R.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

% Application state container

fig = runCSCApp(debugLog);
fig = csc.ui.runApp(debugLog);
if nargout >= 1
varargout{1} = fig;
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
% App-owned EIS workflow helper dispatch. Expected caller: labkit_EIS_app
% callbacks and workflow tests. Inputs are a command
% App-owned EIS helper core dispatch. Expected caller: labkit_EIS_app
% callbacks and package tests. Inputs are a command
% string plus the original helper arguments; outputs match the selected helper.
% This helper has no file side effects.
function varargout = eisWorkflow(command, varargin)
%EISWORKFLOW Dispatch app-owned EIS plot/export helpers.
% Expected caller: labkit_EIS_app callbacks and workflow tests. Inputs are a
function varargout = dispatch(command, varargin)
%DISPATCH Route EIS package wrapper calls to app-owned helpers.
% Expected caller: labkit_EIS_app callbacks and package tests. Inputs are a
% command string plus the original helper arguments.
% Outputs match the selected helper. This helper has no file side effects.

Expand Down
6 changes: 6 additions & 0 deletions apps/electrochem/eis/+eis/+export/buildExportTable.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
% Expected caller: EIS app runner and export tests. Inputs are EIS item structs,
% axis labels, and log flags. Output is the stable EIS export table. No file side
% effects.
function T = buildExportTable(items, xName, yName, useLogX, useLogY)
T = eis.core.dispatch("buildExportTable", items, xName, yName, useLogX, useLogY);
end
5 changes: 5 additions & 0 deletions apps/electrochem/eis/+eis/+ops/valuesForAxis.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
% Expected caller: EIS app runner and unit tests. Inputs are an EIS item struct
% and axis label. Output is the selected numeric vector. No side effects.
function values = valuesForAxis(item, axisName)
values = eis.core.dispatch("valuesForAxis", item, axisName);
end
Loading
Loading