mirror of https://github.com/jlizier/jidt
Continuing (2) to make CA demo scripts have full Matlab compatibility, including loading initial state of CAs from file (since octave and matlab generate different initial states)
This commit is contained in:
parent
23bffaf688
commit
b20d103b56
|
|
@ -139,7 +139,7 @@ phi_par_timeSteps = 200;
|
|||
measureParams.k=10; % Shorter for phi_par
|
||||
fprintf('\nStarting rule phi_par ...\n');
|
||||
fprintf('\nPlotting active info storage ...\n');
|
||||
phiparInitialState = plotLocalInfoMeasureForCA(phi_par_neighbourhood, caStates, phi_par, phi_par_cells, phi_par_timeSteps, 'active', measureParams, options);
|
||||
plotLocalInfoMeasureForCA(phi_par_neighbourhood, caStates, phi_par, phi_par_cells, phi_par_timeSteps, 'active', measureParams, options);
|
||||
options.plotRawCa = false;
|
||||
fprintf('\nPress any key when ready for apparent transfer entropy j = -1 ...\n');
|
||||
pause
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -12,6 +12,15 @@ options.plotOptions.plotCols = 60;
|
|||
options.plotOptions.plotStartRow = 125;
|
||||
options.plotOptions.plotStartCol = 125;
|
||||
options.seed = 1;
|
||||
if (exist('initialStates/MovingFrameDemo2013-initialState.txt', 'file'))
|
||||
% A file specifying the initial state exists -- this
|
||||
% ensures that Matlab and Octave use the same initial state
|
||||
% (otherwise only Octave recreates the same initial state used in our chapter).
|
||||
% (You can delete/move the initial state file if you want them generated from scratch.)
|
||||
options.initialState = load('initialStates/MovingFrameDemo2013-initialState.txt');
|
||||
elseif (isfield(options, 'initialState'))
|
||||
options = rmfield(options, 'initialState');
|
||||
end
|
||||
options.saveImages = true;
|
||||
options.plotOptions.scaleColoursToSubsetOfPlot = true;
|
||||
% Turn up the contrast so that the small values aren't disproportionately visible:
|
||||
|
|
@ -20,41 +29,41 @@ options.plotOptions.scalingScdryComponent = 0.15;
|
|||
options.movingFrameSpeed = 0;
|
||||
|
||||
% Examining rule 54, stationary frame:
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "active", measureParams, options);
|
||||
printf("\nPress any key when ready for apparent transfer entropy ...\n");
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'active', measureParams, options);
|
||||
fprintf('\nPress any key when ready for apparent transfer entropy ...\n');
|
||||
pause
|
||||
measureParams.j = -1;
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "transfer", measureParams, options);
|
||||
printf("\nPress any key when ready for complete transfer entropy ...\n");
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'transfer', measureParams, options);
|
||||
fprintf('\nPress any key when ready for complete transfer entropy ...\n');
|
||||
pause
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "transfercomplete", measureParams, options);
|
||||
printf("\nPress any key when ready for apparent transfer entropy j=1 channel...\n");
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'transfercomplete', measureParams, options);
|
||||
fprintf('\nPress any key when ready for apparent transfer entropy j=1 channel...\n');
|
||||
pause
|
||||
measureParams.j = 1;
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "transfer", measureParams, options);
|
||||
printf("\nPress any key when ready for complete transfer entropy ...\n");
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'transfer', measureParams, options);
|
||||
fprintf('\nPress any key when ready for complete transfer entropy ...\n');
|
||||
pause
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "transfercomplete", measureParams, options);
|
||||
printf("\nCopy the figures from the figures directory, then press any key")
|
||||
printf("\nwhen ready for the measures in a moving frame of reference\n")
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'transfercomplete', measureParams, options);
|
||||
fprintf('\nCopy the figures from the figures directory, then press any key')
|
||||
fprintf('\nwhen ready for the measures in a moving frame of reference\n')
|
||||
pause
|
||||
|
||||
options.movingFrameSpeed = 1;
|
||||
% Examining rule 54, f=1 frame:
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "active", measureParams, options);
|
||||
printf("\nPress any key when ready for apparent transfer entropy ...\n");
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'active', measureParams, options);
|
||||
fprintf('\nPress any key when ready for apparent transfer entropy ...\n');
|
||||
pause
|
||||
measureParams.j = -1;
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "transfer", measureParams, options);
|
||||
printf("\nPress any key when ready for complete transfer entropy ...\n");
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'transfer', measureParams, options);
|
||||
fprintf('\nPress any key when ready for complete transfer entropy ...\n');
|
||||
pause
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "transfercomplete", measureParams, options);
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'transfercomplete', measureParams, options);
|
||||
% Also plot TE for channel j=0 in the moving frame:
|
||||
measureParams.j = 0;
|
||||
printf("\nPress any key when ready for apparent transfer entropy with j=0...\n");
|
||||
fprintf('\nPress any key when ready for apparent transfer entropy with j=0...\n');
|
||||
pause
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "transfer", measureParams, options);
|
||||
printf("\nPress any key when ready for complete transfer entropy with j=0...\n");
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'transfer', measureParams, options);
|
||||
fprintf('\nPress any key when ready for complete transfer entropy with j=0...\n');
|
||||
pause
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, "transfercomplete", measureParams, options);
|
||||
plotLocalInfoMeasureForCA(3, 2, 54, 10000, 600, 'transfercomplete', measureParams, options);
|
||||
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ end
|
|||
% the second by shiftPerRow, the third by 2*shiftPerRow, and so on
|
||||
function shiftedMatrix = accumulateShift(matrix, shiftPerRow)
|
||||
% Allocate required space up front (makes this much faster):
|
||||
shiftedMatrix = zeros(size(matrix,1), columns(matrix));
|
||||
shiftedMatrix = zeros(size(matrix,1), size(matrix, 2));
|
||||
shiftedMatrix(1,:) = matrix(1,:);
|
||||
for r = 2 : size(matrix,1)
|
||||
% circshift operates on shifting rows, so we transpose the input and output to it:
|
||||
|
|
|
|||
Loading…
Reference in New Issue