-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunplot_figure_3.ipy
93 lines (79 loc) · 2.68 KB
/
runplot_figure_3.ipy
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
import numpy as np
import matplotlib.pyplot as plt
from pskf.tools.plot import specs as sc
from pskf.tools.plot import plotfunctions as pf
import pskf.scripts.numcomp.arrays as na
import pskf.scripts.numcomp.plot as npl
import pskf.scripts.numcomp.read as nr
import pskf.tools.run.pythonmodule as pm
# Switches
is_read = 0
is_matrix = 1
is_save = 0
is_show = 1
is_backup = 0
model_name = 'wavereal'
n_comparisons = 10000
method = 'meanc'
ensemble_sizes = [50, 70, 100, 250]
for which_methods in [[0, 1, 2, 3, 4, 5, 6]]:
for ensemble_size in ensemble_sizes[::3]:
# Sort which_methods
indsorts = pf.indsort(np.sort(which_methods),
model_name=model_name,
ensemble_size=ensemble_size,
ensemble_sizes=ensemble_sizes,
)
which_methods_sorted = [which_methods[indsorts[i]]
for i in range(len(which_methods))]
for n_syn in [1, 10, 100]:
# Read
if is_read:
probs_array, probs_array_name = nr.read(
which_methods=which_methods_sorted,
model=model_name,
ensemble_size=ensemble_size,
n_syn=n_syn,
n_comparisons=n_comparisons,
method=method,
)
np.save(probs_array_name, probs_array)
print('Saved as ' + probs_array_name)
# Matrix
if is_matrix:
# Figure
fig = plt.figure('numcomp', figsize=[10, 10])
# Run plot function
ax, pic_name = npl.matrix(
fig.add_subplot(1, 1, 1),
which_methods=which_methods_sorted,
model=model_name,
ensemble_size=ensemble_size,
n_syn=n_syn,
n_comparisons=n_comparisons,
method=method,
is_text=True,
is_longnames=False,
ticklabelfontsize=20,
is_color_trafo=True,
)
# Save
if is_save:
plt.savefig(pic_name)
print('Saved as ' + pic_name)
# Show
if is_show:
plt.show()
else:
plt.clf()
# Backup
if is_backup:
pm.py_backup(
pm.python_scripts_dir,
na.tag,
"runplot_figure_3",
"ipy",
sc.specl(model_name,
'_'.join([str(i) for i in which_methods])[:],
'2018_08_10')
)