bb5e2d88c0
Add variation_power.m (self-contained Monte-Carlo power for the paper's stim x day interaction, using each folder's own data as ground truth; scores per-animal cluster-honest power + LME power across N=[3..24] and effect multipliers 1/0.5) and make_variation_power.m, which drops powersim.m into every variations/<name>/ folder and runs it, writing power_result.txt beside the existing data.csv/analyze.m/result.txt. Named powersim (not power) to avoid shadowing the MATLAB builtin. All 28 folders processed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
30 lines
1.0 KiB
Matlab
30 lines
1.0 KiB
Matlab
function make_variation_power()
|
|
%MAKE_VARIATION_POWER Add a power-simulation script + result to every variation.
|
|
% MAKE_VARIATION_POWER() copies variation_power.m into each
|
|
% variations/<name>/ folder that contains a data.csv (as powersim.m) and runs
|
|
% it, producing power_result.txt beside the existing data.csv / analyze.m /
|
|
% result.txt. Re-runnable; also picks up any folders added later.
|
|
|
|
thisDir = fileparts(mfilename('fullpath'));
|
|
template = fullfile(thisDir, 'variation_power.m');
|
|
root = fullfile(thisDir, 'variations');
|
|
|
|
d = dir(root);
|
|
n = 0;
|
|
for i = 1:numel(d)
|
|
if ~d(i).isdir || ismember(d(i).name, {'.', '..'}); continue; end
|
|
folder = fullfile(root, d(i).name);
|
|
if ~exist(fullfile(folder, 'data.csv'), 'file'); continue; end
|
|
copyfile(template, fullfile(folder, 'powersim.m'));
|
|
fprintf('\n### %s ###\n', d(i).name);
|
|
localRun(fullfile(folder, 'powersim.m'));
|
|
n = n + 1;
|
|
end
|
|
fprintf('\nAdded powersim.m + power_result.txt to %d variation folders.\n', n);
|
|
|
|
end
|
|
|
|
function localRun(scriptPath)
|
|
run(scriptPath);
|
|
end
|