musica 0.12.2__cp39-cp39-win_arm64.whl → 0.13.0__cp39-cp39-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of musica might be problematic. Click here for more details.
- musica/CMakeLists.txt +4 -0
- musica/_musica.cp39-win_amd64.pyd +0 -0
- musica/_version.py +1 -1
- musica/binding_common.cpp +6 -9
- musica/binding_common.hpp +17 -1
- musica/grid.cpp +206 -0
- musica/grid.py +98 -0
- musica/grid_map.cpp +117 -0
- musica/grid_map.py +167 -0
- musica/mechanism_configuration/__init__.py +18 -1
- musica/mechanism_configuration/ancillary.py +6 -0
- musica/mechanism_configuration/arrhenius.py +111 -269
- musica/mechanism_configuration/branched.py +116 -275
- musica/mechanism_configuration/emission.py +63 -52
- musica/mechanism_configuration/first_order_loss.py +73 -157
- musica/mechanism_configuration/mechanism.py +93 -0
- musica/mechanism_configuration/phase.py +44 -33
- musica/mechanism_configuration/phase_species.py +58 -0
- musica/mechanism_configuration/photolysis.py +77 -67
- musica/mechanism_configuration/reaction_component.py +54 -0
- musica/mechanism_configuration/reactions.py +17 -58
- musica/mechanism_configuration/species.py +45 -71
- musica/mechanism_configuration/surface.py +78 -74
- musica/mechanism_configuration/taylor_series.py +136 -0
- musica/mechanism_configuration/ternary_chemical_activation.py +138 -330
- musica/mechanism_configuration/troe.py +138 -330
- musica/mechanism_configuration/tunneling.py +105 -229
- musica/mechanism_configuration/user_defined.py +79 -68
- musica/mechanism_configuration.cpp +54 -162
- musica/musica.cpp +2 -5
- musica/profile.cpp +294 -0
- musica/profile.py +93 -0
- musica/profile_map.cpp +117 -0
- musica/profile_map.py +167 -0
- musica/test/examples/v1/full_configuration/full_configuration.json +91 -233
- musica/test/examples/v1/full_configuration/full_configuration.yaml +191 -290
- musica/test/integration/test_chapman.py +2 -2
- musica/test/integration/test_tuvx.py +72 -15
- musica/test/unit/test_grid.py +137 -0
- musica/test/unit/test_grid_map.py +126 -0
- musica/test/unit/test_parser.py +10 -10
- musica/test/unit/test_profile.py +169 -0
- musica/test/unit/test_profile_map.py +137 -0
- musica/test/unit/test_serializer.py +17 -16
- musica/test/unit/test_state.py +17 -4
- musica/test/unit/test_util_full_mechanism.py +78 -298
- musica/tuvx.cpp +94 -15
- musica/tuvx.py +92 -22
- musica/types.py +13 -5
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/METADATA +14 -14
- musica-0.13.0.dist-info/RECORD +80 -0
- musica/mechanism_configuration/aqueous_equilibrium.py +0 -274
- musica/mechanism_configuration/condensed_phase_arrhenius.py +0 -309
- musica/mechanism_configuration/condensed_phase_photolysis.py +0 -88
- musica/mechanism_configuration/henrys_law.py +0 -44
- musica/mechanism_configuration/mechanism_configuration.py +0 -234
- musica/mechanism_configuration/simpol_phase_transfer.py +0 -217
- musica/mechanism_configuration/wet_deposition.py +0 -52
- musica-0.12.2.dist-info/RECORD +0 -70
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/WHEEL +0 -0
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/entry_points.txt +0 -0
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/licenses/AUTHORS.md +0 -0
- {musica-0.12.2.dist-info → musica-0.13.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,295 +1,196 @@
|
|
|
1
|
-
---
|
|
2
1
|
version: 1.0.0
|
|
3
2
|
name: Full Configuration
|
|
4
3
|
species:
|
|
5
|
-
- name: A
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
- name:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- name: ethanol
|
|
21
|
-
diffusion coefficient [m2 s-1]: 9.5e-06
|
|
22
|
-
N star: 2.55
|
|
23
|
-
molecular weight [kg mol-1]: 0.04607
|
|
24
|
-
__absolute tolerance: 1.0e-20
|
|
25
|
-
- name: ethanol_aq
|
|
26
|
-
molecular weight [kg mol-1]: 0.04607
|
|
27
|
-
density [kg m-3]: 1000
|
|
28
|
-
__absolute tolerance: 1.0e-20
|
|
29
|
-
- name: H2O2_aq
|
|
30
|
-
molecular weight [kg mol-1]: 0.0340147
|
|
31
|
-
density [kg m-3]: 1000
|
|
32
|
-
__absolute tolerance: 1.0e-10
|
|
33
|
-
- name: H2O_aq
|
|
34
|
-
density [kg m-3]: 1000
|
|
35
|
-
molecular weight [kg mol-1]: 0.01801
|
|
36
|
-
- name: aerosol stuff
|
|
37
|
-
molecular weight [kg mol-1]: 0.5
|
|
38
|
-
density [kg m-3]: 1000
|
|
39
|
-
__absolute tolerance: 1.0e-20
|
|
40
|
-
- name: more aerosol stuff
|
|
41
|
-
molecular weight [kg mol-1]: 0.2
|
|
42
|
-
density [kg m-3]: 1000
|
|
43
|
-
__absolute tolerance: 1.0e-20
|
|
4
|
+
- name: A
|
|
5
|
+
molecular weight [kg mol-1]: 0.02897
|
|
6
|
+
__absolute tolerance: 1.0e-30
|
|
7
|
+
- name: B
|
|
8
|
+
constant concentration [mol m-3]: 1.0e19
|
|
9
|
+
- name: C
|
|
10
|
+
constant mixing ratio [mol mol-1]: 1.0e-20
|
|
11
|
+
- name: M
|
|
12
|
+
is third body: true
|
|
13
|
+
- name: H2O2
|
|
14
|
+
molecular weight [kg mol-1]: 0.0340147
|
|
15
|
+
__absolute tolerance: 1.0e-10
|
|
16
|
+
- name: ethanol
|
|
17
|
+
molecular weight [kg mol-1]: 0.04607
|
|
18
|
+
__absolute tolerance: 1.0e-20
|
|
44
19
|
phases:
|
|
45
|
-
- name: gas
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- name:
|
|
52
|
-
|
|
53
|
-
- H2O2_aq
|
|
54
|
-
- H2O_aq
|
|
55
|
-
- ethanol_aq
|
|
56
|
-
- A
|
|
57
|
-
- B
|
|
58
|
-
- C
|
|
59
|
-
- name: surface reacting phase
|
|
60
|
-
species:
|
|
61
|
-
- aerosol stuff
|
|
62
|
-
- more aerosol stuff
|
|
63
|
-
- name: cloud
|
|
64
|
-
species:
|
|
65
|
-
- B
|
|
66
|
-
- C
|
|
20
|
+
- name: gas
|
|
21
|
+
species:
|
|
22
|
+
- name: A
|
|
23
|
+
diffusion coefficient [m2 s-1]: 1.0
|
|
24
|
+
- name: B
|
|
25
|
+
- name: C
|
|
26
|
+
- name: ethanol
|
|
27
|
+
- name: H2O2
|
|
67
28
|
reactions:
|
|
68
|
-
- type:
|
|
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
|
-
- gas phase: gas
|
|
237
|
-
type: TUNNELING
|
|
238
|
-
name: "my tunneling"
|
|
239
|
-
A: 123.45
|
|
240
|
-
B: 1200
|
|
241
|
-
C: 100000000
|
|
242
|
-
reactants:
|
|
243
|
-
- species name: B
|
|
244
|
-
coefficient: 1
|
|
245
|
-
products:
|
|
246
|
-
- species name: C
|
|
247
|
-
coefficient: 1
|
|
248
|
-
__irrelevant: "2"
|
|
249
|
-
- type: WET_DEPOSITION
|
|
250
|
-
condensed phase: cloud
|
|
251
|
-
name: rxn cloud
|
|
252
|
-
scaling factor: 12.3
|
|
253
|
-
__irrelevant: "2"
|
|
254
|
-
- type: ARRHENIUS
|
|
255
|
-
gas phase: gas
|
|
256
|
-
reactants:
|
|
257
|
-
- species name: B
|
|
258
|
-
coefficient: 1
|
|
259
|
-
products:
|
|
260
|
-
- species name: C
|
|
261
|
-
coefficient: 1
|
|
262
|
-
A: 32.1
|
|
263
|
-
B: -2.3
|
|
264
|
-
C: 102.3
|
|
265
|
-
D: 63.4
|
|
266
|
-
E: -1.3
|
|
267
|
-
name: my arrhenius
|
|
268
|
-
__irrelevant: "2"
|
|
269
|
-
- type: ARRHENIUS
|
|
270
|
-
gas phase: gas
|
|
271
|
-
reactants:
|
|
272
|
-
- species name: A
|
|
273
|
-
coefficient: 1
|
|
274
|
-
products:
|
|
275
|
-
- species name: B
|
|
276
|
-
coefficient: 1.2
|
|
277
|
-
A: 29.3
|
|
278
|
-
B: -1.5
|
|
279
|
-
Ea: 101.2
|
|
280
|
-
D: 82.6
|
|
281
|
-
E: -0.98
|
|
282
|
-
name: my other arrhenius
|
|
283
|
-
- type: USER_DEFINED
|
|
284
|
-
gas phase: gas
|
|
285
|
-
reactants:
|
|
286
|
-
- species name: A
|
|
287
|
-
coefficient: 1
|
|
288
|
-
- species name: B
|
|
289
|
-
coefficient: 1
|
|
290
|
-
products:
|
|
291
|
-
- species name: C
|
|
292
|
-
coefficient: 1.3
|
|
293
|
-
name: my user defined
|
|
294
|
-
scaling factor: 12.3
|
|
295
|
-
__irrelevant: "2"
|
|
29
|
+
- type: EMISSION
|
|
30
|
+
name: my emission
|
|
31
|
+
scaling factor: 12.3
|
|
32
|
+
gas phase: gas
|
|
33
|
+
products:
|
|
34
|
+
- species name: B
|
|
35
|
+
coefficient: 1
|
|
36
|
+
__irrelevant: 2
|
|
37
|
+
- type: FIRST_ORDER_LOSS
|
|
38
|
+
name: my first order loss
|
|
39
|
+
scaling factor: 12.3
|
|
40
|
+
gas phase: gas
|
|
41
|
+
reactants:
|
|
42
|
+
- species name: C
|
|
43
|
+
coefficient: 1
|
|
44
|
+
__irrelevant: 2
|
|
45
|
+
- type: PHOTOLYSIS
|
|
46
|
+
name: photo B
|
|
47
|
+
scaling factor: 12.3
|
|
48
|
+
gas phase: gas
|
|
49
|
+
reactants:
|
|
50
|
+
- species name: B
|
|
51
|
+
coefficient: 1
|
|
52
|
+
products:
|
|
53
|
+
- species name: C
|
|
54
|
+
coefficient: 1
|
|
55
|
+
__irrelevant: 2
|
|
56
|
+
- type: SURFACE
|
|
57
|
+
name: my surface
|
|
58
|
+
reaction probability: 2.0e-2
|
|
59
|
+
gas phase: gas
|
|
60
|
+
gas-phase species: A
|
|
61
|
+
gas-phase products:
|
|
62
|
+
- species name: B
|
|
63
|
+
coefficient: 1
|
|
64
|
+
- species name: C
|
|
65
|
+
coefficient: 1
|
|
66
|
+
__irrelevant: 2
|
|
67
|
+
- type: TROE
|
|
68
|
+
name: my troe
|
|
69
|
+
k0_A: 1.2e-12
|
|
70
|
+
k0_B: 167
|
|
71
|
+
k0_C: 3
|
|
72
|
+
kinf_A: 136
|
|
73
|
+
kinf_B: 5
|
|
74
|
+
kinf_C: 24
|
|
75
|
+
Fc: 0.9
|
|
76
|
+
N: 0.8
|
|
77
|
+
gas phase: gas
|
|
78
|
+
reactants:
|
|
79
|
+
- species name: B
|
|
80
|
+
coefficient: 1
|
|
81
|
+
- species name: M
|
|
82
|
+
coefficient: 1
|
|
83
|
+
products:
|
|
84
|
+
- species name: C
|
|
85
|
+
coefficient: 1
|
|
86
|
+
__irrelevant: 2
|
|
87
|
+
- type: TERNARY_CHEMICAL_ACTIVATION
|
|
88
|
+
name: my ternary chemical activation
|
|
89
|
+
gas phase: gas
|
|
90
|
+
k0_A: 32.1
|
|
91
|
+
k0_B: -2.3
|
|
92
|
+
k0_C: 102.3
|
|
93
|
+
kinf_A: 63.4
|
|
94
|
+
kinf_B: -1.3
|
|
95
|
+
kinf_C: 908.5
|
|
96
|
+
Fc: 1.3
|
|
97
|
+
N: 32.1
|
|
98
|
+
reactants:
|
|
99
|
+
- species name: B
|
|
100
|
+
coefficient: 1
|
|
101
|
+
- species name: M
|
|
102
|
+
coefficient: 1
|
|
103
|
+
products:
|
|
104
|
+
- species name: C
|
|
105
|
+
coefficient: 1
|
|
106
|
+
__irrelevant: 2
|
|
107
|
+
- type: BRANCHED_NO_RO2
|
|
108
|
+
name: my branched
|
|
109
|
+
X: 1.2e-4
|
|
110
|
+
Y: 167
|
|
111
|
+
a0: 0.15
|
|
112
|
+
n: 9
|
|
113
|
+
gas phase: gas
|
|
114
|
+
reactants:
|
|
115
|
+
- species name: A
|
|
116
|
+
coefficient: 1
|
|
117
|
+
alkoxy products:
|
|
118
|
+
- species name: B
|
|
119
|
+
coefficient: 1
|
|
120
|
+
nitrate products:
|
|
121
|
+
- species name: C
|
|
122
|
+
coefficient: 1
|
|
123
|
+
__irrelevant: 2
|
|
124
|
+
- type: TUNNELING
|
|
125
|
+
name: my tunneling
|
|
126
|
+
A: 123.45
|
|
127
|
+
B: 1200.0
|
|
128
|
+
C: 1.0e8
|
|
129
|
+
gas phase: gas
|
|
130
|
+
reactants:
|
|
131
|
+
- species name: B
|
|
132
|
+
coefficient: 1
|
|
133
|
+
products:
|
|
134
|
+
- species name: C
|
|
135
|
+
coefficient: 1
|
|
136
|
+
__irrelevant: 2
|
|
137
|
+
- type: ARRHENIUS
|
|
138
|
+
name: my arrhenius
|
|
139
|
+
gas phase: gas
|
|
140
|
+
A: 32.1
|
|
141
|
+
B: -2.3
|
|
142
|
+
C: 102.3
|
|
143
|
+
D: 63.4
|
|
144
|
+
E: -1.3
|
|
145
|
+
reactants:
|
|
146
|
+
- species name: B
|
|
147
|
+
coefficient: 1
|
|
148
|
+
products:
|
|
149
|
+
- species name: C
|
|
150
|
+
coefficient: 1
|
|
151
|
+
__irrelevant: 2
|
|
152
|
+
- type: ARRHENIUS
|
|
153
|
+
name: my other arrhenius
|
|
154
|
+
A: 29.3
|
|
155
|
+
B: -1.5
|
|
156
|
+
Ea: 101.2
|
|
157
|
+
D: 82.6
|
|
158
|
+
E: -0.98
|
|
159
|
+
gas phase: gas
|
|
160
|
+
reactants:
|
|
161
|
+
- species name: A
|
|
162
|
+
coefficient: 1
|
|
163
|
+
products:
|
|
164
|
+
- species name: B
|
|
165
|
+
coefficient: 1.2
|
|
166
|
+
- type: USER_DEFINED
|
|
167
|
+
name: my user defined
|
|
168
|
+
scaling factor: 12.3
|
|
169
|
+
gas phase: gas
|
|
170
|
+
reactants:
|
|
171
|
+
- species name: A
|
|
172
|
+
coefficient: 1
|
|
173
|
+
- species name: B
|
|
174
|
+
coefficient: 1
|
|
175
|
+
products:
|
|
176
|
+
- species name: C
|
|
177
|
+
coefficient: 1.3
|
|
178
|
+
__irrelevant: 2
|
|
179
|
+
- type: TAYLOR_SERIES
|
|
180
|
+
name: my taylor series
|
|
181
|
+
A: 12.3
|
|
182
|
+
B: -1.5
|
|
183
|
+
C: 1.0e-6
|
|
184
|
+
D: 340.0
|
|
185
|
+
E: 0.00032
|
|
186
|
+
taylor coefficients:
|
|
187
|
+
- 1.0
|
|
188
|
+
- 0.1
|
|
189
|
+
- -0.01
|
|
190
|
+
gas phase: gas
|
|
191
|
+
reactants:
|
|
192
|
+
- species name: B
|
|
193
|
+
coefficient: 1
|
|
194
|
+
products:
|
|
195
|
+
- species name: C
|
|
196
|
+
coefficient: 1
|
|
@@ -73,8 +73,8 @@ def TestSolve(solver):
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
def GetMechanism():
|
|
76
|
-
M = mc.Species(
|
|
77
|
-
O2 = mc.Species(name="O2"
|
|
76
|
+
M = mc.Species(is_third_body=True)
|
|
77
|
+
O2 = mc.Species(name="O2")
|
|
78
78
|
O = mc.Species(name="O", other_properties={
|
|
79
79
|
"__absolute_tolerance": "1e-12"})
|
|
80
80
|
O1D = mc.Species(name="O1D", other_properties={
|
|
@@ -18,19 +18,64 @@ def test_full_tuvx(monkeypatch):
|
|
|
18
18
|
tuvx = musica.TUVX(file)
|
|
19
19
|
assert tuvx is not None
|
|
20
20
|
|
|
21
|
-
heating_rates = tuvx.
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
photolysis_rates, heating_rates, dose_rates = tuvx.run()
|
|
22
|
+
|
|
23
|
+
assert len(tuvx.heating_rate_names) == 0, "Heating rate names should be empty for this config"
|
|
24
|
+
assert len(tuvx.photolysis_rate_names) > 0, "No photolysis rate names found"
|
|
25
|
+
assert len(tuvx.dose_rate_names) > 0, "No dose rate names found"
|
|
26
|
+
assert len(heating_rates) == 2, "Number of solar zenith angles should be 2 for heating rates"
|
|
27
|
+
assert len(photolysis_rates) == 2, "Number of solar zenith angles should be 2 for photolysis rates"
|
|
28
|
+
assert len(dose_rates) == 2, "Number of solar zenith angles should be 2 for dose rates"
|
|
29
|
+
assert heating_rates.shape[1] == 121, "Number of layers should be 121 for heating rates"
|
|
30
|
+
assert photolysis_rates.shape[1] == 121, "Number of layers should be 121 for photolysis rates"
|
|
31
|
+
assert dose_rates.shape[1] == 121, "Number of layers should be 121 for dose rates"
|
|
32
|
+
assert heating_rates.shape[2] == 0, "Should be no heating rates for this config"
|
|
33
|
+
assert photolysis_rates.shape[2] == len(tuvx.photolysis_rate_names), "Photolysis rates shape mismatch"
|
|
34
|
+
assert dose_rates.shape[2] == len(tuvx.dose_rate_names), "Dose rates shape mismatch"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_fixed_tuvx_from_file(monkeypatch):
|
|
38
|
+
monkeypatch.chdir("src")
|
|
39
|
+
file = "test/data/tuvx/fixed/config.json"
|
|
40
|
+
tuvx = musica.TUVX(config_path=file)
|
|
41
|
+
assert tuvx is not None
|
|
42
|
+
|
|
43
|
+
# Access properties multiple times
|
|
44
|
+
photolysis_names_1 = tuvx.photolysis_rate_names
|
|
45
|
+
photolysis_names_2 = tuvx.photolysis_rate_names
|
|
46
|
+
heating_names_1 = tuvx.heating_rate_names
|
|
47
|
+
heating_names_2 = tuvx.heating_rate_names
|
|
48
|
+
dose_names_1 = tuvx.dose_rate_names
|
|
49
|
+
dose_names_2 = tuvx.dose_rate_names
|
|
24
50
|
|
|
25
|
-
|
|
26
|
-
assert
|
|
27
|
-
assert
|
|
51
|
+
# Verify they return the same object (cached)
|
|
52
|
+
assert photolysis_names_1 is photolysis_names_2
|
|
53
|
+
assert heating_names_1 is heating_names_2
|
|
54
|
+
assert dose_names_1 is dose_names_2
|
|
55
|
+
|
|
56
|
+
assert len(photolysis_names_1) == 3, "Unexpected number of photolysis rates found"
|
|
57
|
+
assert len(heating_names_1) == 2, "Unexpected number of heating rates found"
|
|
58
|
+
assert len(dose_names_1) == 3, "Unexpected number of dose rates found"
|
|
59
|
+
|
|
60
|
+
photolysis_rates, heating_rates, dose_rates = tuvx.run()
|
|
28
61
|
|
|
62
|
+
assert len(photolysis_rates) == 5, "Unexpected number of solar zenith angles for photolysis rates"
|
|
63
|
+
assert len(heating_rates) == 5, "Unexpected number of solar zenith angles for heating rates"
|
|
64
|
+
assert len(dose_rates) == 5, "Unexpected number of solar zenith angles for dose rates"
|
|
65
|
+
assert photolysis_rates.shape[1] == 4, "Unexpected number of layers for photolysis rates"
|
|
66
|
+
assert heating_rates.shape[1] == 4, "Unexpected number of layers for heating rates"
|
|
67
|
+
assert dose_rates.shape[1] == 4, "Unexpected number of layers for dose rates"
|
|
68
|
+
assert photolysis_rates.shape[2] == len(photolysis_names_1), "Photolysis rates shape mismatch"
|
|
69
|
+
assert heating_rates.shape[2] == len(heating_names_1), "Heating rates shape mismatch"
|
|
70
|
+
assert dose_rates.shape[2] == len(dose_names_1), "Dose rates shape mismatch"
|
|
29
71
|
|
|
30
|
-
|
|
72
|
+
|
|
73
|
+
def test_fixed_tuvx_from_string(monkeypatch):
|
|
31
74
|
monkeypatch.chdir("src")
|
|
32
75
|
file = "test/data/tuvx/fixed/config.json"
|
|
33
|
-
|
|
76
|
+
with open(file, 'r') as f:
|
|
77
|
+
config_str = f.read()
|
|
78
|
+
tuvx = musica.TUVX(config_string=config_str)
|
|
34
79
|
assert tuvx is not None
|
|
35
80
|
|
|
36
81
|
# Access properties multiple times
|
|
@@ -38,17 +83,29 @@ def test_fixed_tuvx(monkeypatch):
|
|
|
38
83
|
photolysis_names_2 = tuvx.photolysis_rate_names
|
|
39
84
|
heating_names_1 = tuvx.heating_rate_names
|
|
40
85
|
heating_names_2 = tuvx.heating_rate_names
|
|
86
|
+
dose_names_1 = tuvx.dose_rate_names
|
|
87
|
+
dose_names_2 = tuvx.dose_rate_names
|
|
41
88
|
|
|
42
89
|
# Verify they return the same object (cached)
|
|
43
90
|
assert photolysis_names_1 is photolysis_names_2
|
|
44
91
|
assert heating_names_1 is heating_names_2
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
assert len(photolysis_names_1)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
92
|
+
assert dose_names_1 is dose_names_2
|
|
93
|
+
|
|
94
|
+
assert len(photolysis_names_1) == 3, "Unexpected number of photolysis rates found"
|
|
95
|
+
assert len(heating_names_1) == 2, "Unexpected number of heating rates found"
|
|
96
|
+
assert len(dose_names_1) == 3, "Unexpected number of dose rates found"
|
|
97
|
+
|
|
98
|
+
photolysis_rates, heating_rates, dose_rates = tuvx.run()
|
|
99
|
+
|
|
100
|
+
assert len(photolysis_rates) == 5, "Unexpected number of solar zenith angles for photolysis rates"
|
|
101
|
+
assert len(heating_rates) == 5, "Unexpected number of solar zenith angles for heating rates"
|
|
102
|
+
assert len(dose_rates) == 5, "Unexpected number of solar zenith angles for dose rates"
|
|
103
|
+
assert photolysis_rates.shape[1] == 4, "Unexpected number of layers for photolysis rates"
|
|
104
|
+
assert heating_rates.shape[1] == 4, "Unexpected number of layers for heating rates"
|
|
105
|
+
assert dose_rates.shape[1] == 4, "Unexpected number of layers for dose rates"
|
|
106
|
+
assert photolysis_rates.shape[2] == len(photolysis_names_1), "Photolysis rates shape mismatch"
|
|
107
|
+
assert heating_rates.shape[2] == len(heating_names_1), "Heating rates shape mismatch"
|
|
108
|
+
assert dose_rates.shape[2] == len(dose_names_1), "Dose rates shape mismatch"
|
|
52
109
|
|
|
53
110
|
|
|
54
111
|
def test_tuvx_initialization_errors():
|