-
Notifications
You must be signed in to change notification settings - Fork 0
/
jobs_processfile_propertimes.m
104 lines (102 loc) · 4.61 KB
/
jobs_processfile_propertimes.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
102
103
104
function jobs_processfile_propertimes( paramstr, ...
attributions, targetdir )
%JOBS_PROCESSFILE_PROPERTIMES loads a combined job file and stores data
% tables for proper time separation distribution in csv files (to be
% plotted with LaTeX-TikZ).
% Columns in the output files are ( proper time, 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: geodesic from event 1 to N by longest link chain
% 3: geodesic from event 1 to N by maximal volume
% TARGETDIR directory for processed csv file output.
% Default: data/ProperTimes
%
% 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/ProperTimes';
end
%% load data:
results = load( jobs_getfilename( paramstr, 'mat' ), 'maxpropertime' );
%% process all selected indexes:
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, 'propertimes' )
temp = load( jobs_getfilename( paramstr, 'mat' ), ...
'propertimes' );
results.propertimes = temp.propertimes;
clear temp;
end
Y = results.propertimes( :, vol, arr );
thisparamstr = sprintf( '%sArr%dVol%d', ...
paramstr, arr, vol );
else
if ~isfield( results, 'preffutures' )
temp = load( jobs_getfilename( paramstr, 'mat' ), ...
'preffutures' );
results.preffutures.propertimes = ...
temp.preffutures.propertimes;
clear temp;
end
Y = results.preffutures.propertimes( :, cri, cmi, vol );
thisparamstr = sprintf( '%sCri%dMin%dVol%d', ...
paramstr, cri, cmi, vol );
end
Xbinsize = results.maxpropertime / ( length( Y ) - 1 );
X = ( 1 : length( Y ) ) - 1.5;
Y = transpose( double( Y ) );
Ysum = sum( Y );
%% save proper time seperations to csv files:
saveas_csv( sprintf( '%s/%s', targetdir, thisparamstr ), ...
100 * Y / Ysum, Xbinsize * X );
% ... change this to - 1.5 for negative underflow bin
fileID = fopen( sprintf( '%s/%sev.tex', ...
targetdir, thisparamstr ), 'w' );
fprintf( fileID, '\\def\\expectationvalue{%0.6f}\n', ...
Xbinsize * sum( Y .* X ) / Ysum );
fprintf( fileID, '\\def\\xbinwidth{%0.6f}\n', Xbinsize );
fclose( fileID );
end
end
end
end
end
end