forked from verivital/slsf_randgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisconsistent.m
68 lines (47 loc) · 1.35 KB
/
isconsistent.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
function [ret, first, cur] = isconsistent( varargin )
%COVEXP_CON Check consistency of coverage experiments
% Detailed explanation goes here
covexp.addpaths();
l = logging.getLogger('consistency');
ret = true; % success
first = []; % baseline experiment against which the comparisons are made
cur = []; % current comparison
subdir = '';
if nargin > 0
subdir = [varargin{1} filesep '/' ];
end
report_base = [covcfg.RESULT_DIR_COVEXP filesep subdir];
file_list = dir([report_base '*.mat' ]);
all = utility.cell(10); % capacity
for i=1:numel(file_list)
clear covexp_result;
cur_file = file_list(i).name;
% if file_list(i).isdir || strcmp(cur_file, '.') || strcmp(cur_file, '..')
% continue;
% end
load([report_base filesep cur_file]);
all.add(covexp_result);
end
if all.len < 1
l.info('No experiment files!');
return;
end
first_w = all.get(1);
first = first_w.models;
first = delete_fields(first);
for i=1:all.len
cur_w = all.get(i);
cur = cur_w.models;
cur = delete_fields(cur);
if ~ isequal(first, cur)
l.error(sprintf('Did not match: %d exp', i));
ret = false;
return;
end
end
l.info('End of consistency check... no issues!');
end
function ret = delete_fields(p)
ret = rmfield(p, 'duration');
ret = rmfield(ret, 'simdur');
end