-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup_vars.m
119 lines (101 loc) · 3.1 KB
/
setup_vars.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
function [params] = setup_vars(params)
%SETUP_VARS Function responsible for initialising the correct
% dataset and graph output paths based on OS type while printing
% our current execution configuration.
%
% Based on work of Grammenos et al.: https://arxiv.org/abs/1907.08059
%
% Author Andreas Grammenos ([email protected])
%
% Last touched date 31/05/2020
%
% License: GPLv3
%
if ispc
fprintf("\n !! Detected Windows PC !!\n");
params.graph_path = ".\graphs\";
params.dataset_path = ".\datasets\";
else
fprintf("\n !! Detected Unix-like PC !!\n");
params.graph_path = './graphs/';
params.dataset_path = './datasets/';
end
%% Execution parameters
fprintf("\n !! Execution parameters\n");
% check if have a block error enabled
if ~isfield(params, 'use_blk_err')
params.use_blk_err = 1;
end
% check if we print figures
if ~isfield(params, 'fig_print')
params.fig_print = 1;
end
% check if we print pdf's
if ~isfield(params, 'pdf_print')
params.pdf_print = 1;
end
% check if we print png images
if ~isfield(params, 'png_print')
params.png_print = 1;
end
if params.use_blk_err == 1
fprintf("\n\t ** Per block error calculation: ENABLED (VERY GOOD!!)");
else
fprintf("\n\t ** Per block error calculation: DISABLED (snif!)");
end
% if params.run_synthetic == 1
% fprintf("\n\t ** Running synthetic dataset tests: ENABLED");
% else
% fprintf("\n\t ** Running synthetic dataset tests: DISABLED");
% end
%
% if params.run_real == 1
% fprintf("\n\t ** Running real dataset tests: ENABLED");
% else
% fprintf("\n\t ** Running real dataset tests: DISABLED");
% end
% check if we have an execution type
if ~isfield(params, 'type')
fprintf("\n\t ** WARN: No execution type detected, setting to unknown");
params.type = "unknown";
end
% spacing
fprintf("\n\n");
%% Figure printing configuration
if params.pflag == 1
fprintf("\n !! Printing functionality is: ENABLED\n");
% if we do, make sure the directory is created please note that the name
% adheres to the ISO-8601 timestamp format tagged with the type of run.
fp = sprintf("%s%s-%s", params.graph_path, ...
datestr(now, 'yyyymmddTHHMMSS'), params.type);
fprintf("\n\t** Trying to create save folder in: %s", fp);
[s, ~, ~] = mkdir(char(fp));
if s ~= 1
fprintf("\n\t!! Error, could not create the folder; disabling figure export\n");
params.pflag = 0;
else
fprintf("\n\t** Folder %s created successfully", fp);
% update the path with the specific runtime folder
if ispc
params.graph_path = strcat(fp, "\");
else
params.graph_path = strcat(fp, '/');
end
fprintf("\n\t** Target graph dir: %s", params.graph_path);
end
% check if we are printing a .pdf or .png
if params.pdf_print == 1
fprintf("\n\t** Printing output is set to: PDF");
else
fprintf("\n\t** Printing output is set to: PNG");
end
% check if we are printing .fig
if params.fig_print == 1
fprintf("\n\t** Printing to .fig format is: ENABLED\n");
else
fprintf("\n\t** Printing to .fig format is: DISABLED\n");
end
else
fprintf("\n !! Printing functionality is: DISABLED\n");
end
end