-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_figures.py
More file actions
238 lines (208 loc) · 6.39 KB
/
create_figures.py
File metadata and controls
238 lines (208 loc) · 6.39 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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
import os
import sys
import numpy as np
from pathlib import Path
from analysisTools import DataManager, Style, set_environ_njobs, set_rc_params
from competition import create2Dplot
def create_figure_1(manager: DataManager, output_dir: Path | str = ".") -> None:
species = ["H2O", "CO", "CO2", "CH3OH", "NH3"]
T = 10.0
nH = 1e5
zeta = 1.0
radfield = 1.0
path = Path(output_dir) / "fig1.pdf"
manager.plot_abundances_against_parameter(
T,
nH,
zeta,
radfield,
species,
"#H diff",
1e4,
on_grain=True,
save_fig_path=path,
xticks=[250.0, 450.0],
)
print(f"Created figure 1 at {path}")
def create_figure_2(manager: DataManager, output_dir: Path | str = ".") -> None:
species = ["H2O", "CO", "CO2", "CH3OH", "NH3"]
T = 10.0
nH = 1e5
zeta = 1.0
radfield = 1.0
path = Path(output_dir) / "fig2.pdf"
manager.create_standard_plot(
T,
nH,
zeta,
radfield,
species,
times=np.logspace(0, 6, 100),
on_grain=True,
save_fig_path=path,
colors=[
"#bd1f01", # N, Color of N in Fig 3.
"#3f90da", # H Color of H in Fig 3.
"#e76300", # CH3, Color of CH3 in Fig 3.
"#94a4a2", # O, Color of O in Fig 3.
"#832db6", # NH, not in Fig. 3.
"#ffa90e", # CH, Color of CH in Fig 3.
"#b9ac70",
"#a96b59",
"#717581",
"#92dadd",
"#222222",
], # https://arxiv.org/pdf/2107.02270
put_legend_on_side=True,
plot_individual_samples=True,
)
print(f"Created figure 2 at {path}")
def create_figure_3(manager: DataManager, output_dir: Path | str = ".") -> None:
# Create BIG plot for H2O, CO, CO2, CH3OH, NH3
species = ["H2O", "CO", "CO2", "CH3OH", "NH3"]
temps = [10.0, 30.0, 50.0]
densities = [1e3, 1e6]
zeta = 1.0
radfield = 1.0
path = Path(output_dir) / "fig3.pdf"
manager.create_big_plot(
temps,
densities,
zeta,
radfield,
species,
on_grain=True,
times=np.logspace(0, 6, num=100),
save_fig_path=path,
colors=[
"#3f90da",
"#ffa90e",
"#bd1f01",
"#94a4a2",
"#832db6",
"#a96b59",
"#e76300",
"#b9ac70",
"#717581",
"#92dadd",
"#222222",
], # Color palette from https://arxiv.org/pdf/2107.02270, with black added.
)
print(f"Created figure 3 at {path}")
def create_figure_4(manager: DataManager, output_dir: Path | str = ".") -> None:
species = ["H2O", "CO", "CO2", "CH3OH", "NH3"]
temps = [10.0, 20.0, 30.0, 40.0, 50.0]
densities = [1e3, 1e4, 1e5, 1e6]
zeta = 1.0
radfield = 1.0
confidence_level = 0.6827
path = Path(output_dir) / "fig4.pdf"
manager.create_widths_plot(
temps,
densities,
zeta,
radfield,
species,
confidence_level=confidence_level,
on_grain=True,
times=np.logspace(0, 6, num=100),
save_fig_path=path,
)
print(f"Created figure 4 at {path}")
def create_figure_5(output_dir: Path | str = ".") -> None:
path = Path(output_dir) / "fig5.pdf"
temp = 10.0
diffusionBarriers = np.linspace(200, 700, num=200, endpoint=True)
reactionBarriers = np.linspace(0, 4000, num=200, endpoint=True)
create2Dplot(
diffusionBarriers,
reactionBarriers,
temp,
tunnelingMass=[1.0, 12.0],
label_levels=False,
save_fig_path=path,
)
print(f"Created figure 5 at {path}")
def create_figure_D1(manager: DataManager, output_dir: Path | str = ".") -> None:
species = ["CH3CHO", "HCOOCH3", "CH3OCH3", "NH2CHO"]
temps = [10.0, 30.0, 50.0]
densities = [1e3, 1e6]
zeta = 1.0
radfield = 1.0
path = Path(output_dir) / "figD1.pdf"
manager.create_big_plot(
temps,
densities,
zeta,
radfield,
species,
on_grain=True,
times=np.logspace(0, 6, num=100),
save_fig_path=path,
colors=[
"#5790fc",
"#f89c20",
"#e42536",
"#964a8b",
"#9c9ca1",
"#7a21dd",
], # https://arxiv.org/pdf/2107.02270
)
print(f"Created figure D1 at {path}")
def create_figure_D2(manager: DataManager, output_dir: Path | str = ".") -> None:
species = ["CH3CHO", "HCOOCH3", "CH3OCH3", "NH2CHO"]
temps = [10.0, 20.0, 30.0, 40.0, 50.0]
densities = [1e3, 1e4, 1e5, 1e6]
zeta = 1.0
radfield = 1.0
confidence_level = 0.6827
path = Path(output_dir) / "figD2.pdf"
manager.create_widths_plot(
temps,
densities,
zeta,
radfield,
species,
confidence_level=confidence_level,
on_grain=True,
times=np.logspace(0, 6, num=100),
save_fig_path=path,
)
print(f"Created figure D2 at {path}")
def create_figure_D3(manager: DataManager, output_dir: Path | str = "."):
species = ["H2O", "CO", "CO2", "CH3OH", "NH3"]
temps = [10.0, 20.0, 30.0, 40.0, 50.0]
densities = [1e3, 1e4, 1e5, 1e6]
zeta = 1.0
radfield = 1.0
confidence_level = 0.6827
path = Path(output_dir) / "figD3.pdf"
manager.create_widths_plot(
temps,
densities,
zeta,
radfield,
species,
confidence_level=confidence_level,
on_grain=True,
times=np.logspace(0, 6, num=100),
save_fig_path=path,
)
print(f"Created figure D3 at {path}")
if __name__ == "__main__":
set_rc_params()
njobs = 20
set_environ_njobs(njobs)
output_dir = Path("../04_figures")
all_directory = Path("../02_data/varying_all")
all_manager = DataManager(all_directory, njobs=njobs)
create_figure_1(all_manager, output_dir=output_dir)
create_figure_2(all_manager, output_dir=output_dir)
create_figure_3(all_manager, output_dir=output_dir)
create_figure_4(all_manager, output_dir=output_dir)
create_figure_5(output_dir=output_dir)
create_figure_D1(all_manager, output_dir=output_dir)
create_figure_D2(all_manager, output_dir=output_dir)
reactions_directory = Path("../02_data/varying_reactions")
reactions_manager = DataManager(reactions_directory, njobs=njobs)
create_figure_D3(reactions_manager, output_dir=output_dir)