-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsensitivity_plot.py
More file actions
61 lines (46 loc) · 1.71 KB
/
sensitivity_plot.py
File metadata and controls
61 lines (46 loc) · 1.71 KB
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
"""
sensitivity plot
"""
import os
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pylab as plt
from matplotlib.ticker import FormatStrFormatter
import global_settings
from color_marker import get_colors_markers_linestyles
def bar_1D_SI(data_dir, n_2_o_idx=None):
"""
bar
"""
colors, markers, _ = get_colors_markers_linestyles()
SI_1st_data = np.loadtxt(os.path.join(
data_dir, "output", "SI_1st.csv"), delimiter=',', dtype=float)
# figure object
fig, ax = plt.subplots(1, 1, sharex=False, sharey=False)
n_size = len(SI_1st_data)
x = np.arange(n_size) # the x locations for the groups
width = 0.35 # the width of the bars: can also be len(x) sequence
bar1 = ax.bar(x, SI_1st_data, width, color=colors,
bottom=0, align="center")
ax.set_xticks(x)
if n_2_o_idx is None:
ticks = [str(i) for i in range(n_size)]
else:
ticks = [str(n_2_o_idx[i]) for i in range(n_size)]
ax.set_xticklabels(ticks, rotation=45, fontsize=8)
ax.ticklabel_format(axis='y', style='sci', scilimits=(-2, 2))
ax.margins(0.01)
# ax.set_xbound(0, 23)
ax.set_ybound(0, 1.0)
ax.set_xlabel("species")
ax.set_ylabel("$1^{st}$" + " order SI")
ax.set_title("$1^{st}$" + " order SI" +
" of ignition delay time wrt. initial concentration")
ax.text(1, 1.0 - 0.1, "SUM($1^{st}$ order SI): " +
"%1.4g" % (np.sum(SI_1st_data)))
plt.subplots_adjust(left=None, bottom=None, right=None,
top=None, wspace=None, hspace=None)
o_f_n = os.path.join(data_dir, "output", "SI_1st.png")
fig.savefig(o_f_n, dpi=500, bbox_inches='tight')
plt.close(fig)