-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjobs_processfile_dimensions.m
101 lines (99 loc) · 4.47 KB
/
jobs_processfile_dimensions.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
function jobs_processfile_dimensions( paramstr, ...
attributions, targetdir )
%JOBS_PROCESSFILE_DIMENSIONS loads a combined job file and stores data
% tables for the dimension estimators (flat and curved Myrheim-Meyer) in
% csv files (to be plotted with LaTeX-TikZ).
% Columns in the output files are ( dimension, probability ).
%
% Arguments:
% PARAMSTR name of the file (without extension) to be processed.
%
% Optional arguments:
% ATTRIBUTIONS Nx4 cell array where each element is either a single
% index or a vector of indexes, which give the
% combination of location attributes.
% First cell array column: preferred future criteria
% (see CAUSET_FIND_PREFTIMES to process preferred
% future)
% 0 to process all links, not only preferred future
% (default)
% Second cell array column: criteria minima
% (see CAUSET_FIND_PREFTIMES to process preferred
% future)
% 0 to process all links, not only preferred future
% (default)
% Third cell array column: subvolumes
% 1 entire causet
% 2 one top volume layer removed
% 3 two top volume layers removed (default)
% ...
% Forth cell array column: diamond link arrangement
% (This column is ignored for preferred future
% analysis, and hence could be set to zero.)
% 1 links anywhere in the causet (default)
% 2 links along the chain from bottom to top
% 3 links along further chains to the top
% TARGETDIR directory for processed csv file output.
% Default: data/Dimensions
%
% Copyright 2021, C. Minz. BSD 3-Clause License.
%% set default values:
% RESCALE positive factor to rescale the interval sizes.
% Default: 1 (no rescale).
% if nargin < 2 || isempty( rescale )
% rescale = 1;
% end
if nargin < 2 || isempty( attributions )
attributions = { 0, 0, 3, 1 };
end
if nargin < 3 || isempty( targetdir )
targetdir = 'data/Dimensions';
end
%% prepare results structure:
results = load( jobs_getfilename( paramstr, 'mat' ), ...
'maxdimension' );
%% process all selected indexes:
curveset = { 'Dimflat', 'Dimcurved', 'Dimmidpoint' };
for i = 1 : size( attributions, 1 )
for cri = attributions{ i, 1 }
for cmi = attributions{ i, 2 }
for vol = attributions{ i, 3 }
for arr = attributions{ i, 4 }
%% select data:
if cri == 0
if ~isfield( results, 'dimestimators' )
temp = load( jobs_getfilename( paramstr, 'mat' ), ...
'chains', 'dimestimators' );
results.dimestimators = temp.dimestimators;
clear temp;
end
Y = results.dimestimators( :, :, vol, arr );
thisparamstr = sprintf( '%sArr%dVol%d', ...
paramstr, arr, vol );
else
if ~isfield( results, 'preffutures' )
temp = load( jobs_getfilename( paramstr, 'mat' ), ...
'preffutures' );
results.preffutures.dimestimators = temp.preffutures.dimestimators;
clear temp;
end
Y = results.preffutures.dimestimators( :, :, cri, cmi, vol );
curveset = { 'Dimflat', 'Dimcurved' };
thisparamstr = sprintf( '%sCri%dMin%dVol%d', ...
paramstr, cri, cmi, vol );
end
binsize = results.maxdimension / ( length( Y ) - 2 );
X = linspace( -binsize, results.maxdimension, length( Y ) ) ...
+ binsize / 2;
Y = double( Y );
for r = 1 : size( Y, 1 )
%% save dimension estimators to csv files:
saveas_csv( sprintf( '%s/%s%s', targetdir, thisparamstr, curveset{ r } ), ...
100 * Y( r, : ) / sum( Y( r, : ) ), X );
end
end
end
end
end
end
end