Skip to content

Commit f3250ef

Browse files
committed
Merge branch 'dev' into 'master'
Dev See merge request ikroeker/ik_amr-pc!18
2 parents 97c1a5f + c5fe04a commit f3250ef

4 files changed

Lines changed: 38 additions & 20 deletions

File tree

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ignore temporary artifacts
2+
build
3+
dist
4+
.cache
5+
__pycache__
6+
*.pyc
7+
*.egg-info

aMRPC/sobol.py

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
@author: kroeker
99
https://orcid.org/0000-0003-0360-5307
1010
11+
Related publication:
12+
13+
https://doi.org/10.1007/s10596-023-10236-z
14+
1115
"""
1216
import math
1317
import itertools as it
@@ -70,7 +74,7 @@ def sobol_idx_pc(pc_coefs, alphas, idx_set, eps=1e-15):
7074

7175
def gen_idx_subsets(dim):
7276
"""
73-
Generates all possible source combination for dim-sources
77+
Generate all possible source combination for dim-sources.
7478
7579
Parameters
7680
----------
@@ -91,7 +95,7 @@ def gen_idx_subsets(dim):
9195

9296
def gen_sidx_subsets(sidx):
9397
"""
94-
Generates all possible source / index combination of sidx
98+
Generate all possible source / index combination of sidx.
9599
96100
Parameters
97101
----------
@@ -112,7 +116,7 @@ def gen_sidx_subsets(sidx):
112116

113117
def sobol_tot_sen_pc(pc_coefs, alphas, src_idxs, idx_list):
114118
"""
115-
Computes total sensitivity coeficients for polynomial-chaos (PC) expansion
119+
Compute total sensitivity coeficients for polynomial-chaos (PC) expansion.
116120
117121
Parameters
118122
----------
@@ -141,7 +145,7 @@ def sobol_tot_sen_pc(pc_coefs, alphas, src_idxs, idx_list):
141145

142146
def sobol_tot_sens(sob_dict, src_idxs, idx_list):
143147
"""
144-
total sensitivity
148+
Compute total sensitivity.
145149
146150
Parameters
147151
----------
@@ -169,8 +173,9 @@ def sobol_tot_sens(sob_dict, src_idxs, idx_list):
169173
def sobol_idx_amrpc_helper(pc_coefs, rsc_dict, mk2sid, alphas, idx_list,
170174
eps=1e-15):
171175
"""
172-
Helper function for computation of Sobol indexes for aMR-PC expansion
173-
results are required by sobol_idx_amrpc(...)
176+
Evaluate the helper function for computation of Sobol indexes for aMR-PC.
177+
178+
Results are required by sobol_idx_amrpc(...)
174179
175180
Parameters
176181
----------
@@ -249,8 +254,9 @@ def sobol_idx_amrpc_helper(pc_coefs, rsc_dict, mk2sid, alphas, idx_list,
249254

250255
def sobol_idx_amrpc(sobol_dict, idx_set):
251256
"""
252-
Computes Sobol indexes for aMR-PC expansion using dictionary provided by
253-
sobol_idx_amrpc_helper(...)
257+
Compute Sobol indexes for aMR-PC expansion.
258+
259+
Using dictionary provided by sobol_idx_amrpc_helper(...)
254260
255261
Parameters
256262
----------
@@ -281,8 +287,10 @@ def sobol_idx_amrpc(sobol_dict, idx_set):
281287
def sobol_idx_amrpc_jj(pc_coefs, rsc_dict, mk2sid, alphas, idx_list,
282288
eps=1e-15):
283289
"""
284-
Generates auxiliary values for aux. dict. for computing of Sobol coeficients
285-
for sample-based or mkey-based aMR-PC
290+
Generate auxiliary values for aux. dict.
291+
292+
Addresses computing of Sobol coeficients for sample-based or
293+
mkey-based aMR-PC
286294
287295
Parameters
288296
----------
@@ -315,8 +323,9 @@ def sobol_idx_amrpc_jj(pc_coefs, rsc_dict, mk2sid, alphas, idx_list,
315323
def sobol_idx_amrpc_jj_4s(pc_coefs, rsc_dict, mk2sid, alphas, idx_list,
316324
eps=1e-15):
317325
"""
318-
Generates auxiliary values for aux. dict. for computing of Sobol coeficients
319-
for sample-based aMR-PC
326+
Generate auxiliary values for aux. dict.
327+
328+
Addresses computing of Sobol coeficients for sample-based aMR-PC
320329
321330
Parameters
322331
----------
@@ -391,8 +400,9 @@ def sobol_idx_amrpc_jj_4s(pc_coefs, rsc_dict, mk2sid, alphas, idx_list,
391400

392401
def sobol_idx_amrpc_jj_4mkey(pc_coefs, rsc_dict, alphas, idx_list, eps=1e-15):
393402
"""
394-
Generates auxiliary values for aux. dict. for computing of Sobol coeficients
395-
for mkey-based aMR-PC
403+
Generate auxiliary values for aux. dict.
404+
405+
Addresses computing of Sobol coeficients for mkey-based aMR-PC
396406
397407
Parameters
398408
----------
@@ -466,7 +476,7 @@ def sobol_idx_amrpc_jj_4mkey(pc_coefs, rsc_dict, alphas, idx_list, eps=1e-15):
466476
def gen_sobol_amrpc_dict(pc_coefs, rsc_dict, mk2sid, alphas, idx_list,
467477
eps=1e-15):
468478
"""
469-
Generates auxiliary dictionary for computing of Sobol coeficients
479+
Generate auxiliary dictionary for computing of Sobol coeficients.
470480
471481
Parameters
472482
----------
@@ -504,8 +514,9 @@ def gen_sobol_amrpc_dict(pc_coefs, rsc_dict, mk2sid, alphas, idx_list,
504514

505515
def sobol_idx_amrpc_comb(help_sobol_dict, idx_set, tmp_sobol_dict):
506516
"""
507-
Computes Sobol indexes for aMR-PC expansion using dictionary provided by
508-
gen_sobol_amrpc_dict(...)
517+
Compute Sobol indexes for aMR-PC expansion.
518+
519+
Using dictionary provided by gen_sobol_amrpc_dict(...)
509520
510521
Parameters
511522
----------
@@ -548,7 +559,7 @@ def sobol_idx_amrpc_comb(help_sobol_dict, idx_set, tmp_sobol_dict):
548559
def sobol_idx_amrpc_dynamic(idx_set, pc_coefs, rsc_dict, mk2sid, alphas,
549560
sobol_dict, help_sobol_dict, eps=1e-15):
550561
"""
551-
computes Sobol coeficients, exploiting dynamic programming.
562+
Compute Sobol coeficients, exploiting dynamic programming.
552563
553564
Parameters
554565
----------

aMRPC/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def gen_corr_rcf(mkey, srcs):
338338
nr_pos = ParPos['aNr']
339339
correct_cf = 1
340340
for src in srcs:
341-
correct_cf *= 2**(-mkey[src][nr_pos])
341+
correct_cf *= 2.0**(-mkey[src][nr_pos])
342342
return correct_cf
343343

344344

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="aMRPC",
8-
version="1.0.3",
8+
version="1.0.4",
99
author="Ilja Kröker",
1010
author_email="ilja.kroeker@iws.uni-stuttgart.de",
1111
description="aMRPC python implementation",

0 commit comments

Comments
 (0)