Skip to content

Commit f950c3e

Browse files
committed
Code comments added.
1 parent deb70b4 commit f950c3e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

structure_threader/wrappers/maverick_wrapper.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,14 @@ def maverick_normalization(x_mean, x_sd, klist, draws=1e6, limit=95):
179179
This is essentially a port from the C++ code written by Bob Verity.
180180
"""
181181

182+
# subtract maximum value from x_mean (this has no effect on final outcome
183+
# but prevents under/overflow)
184+
# Just like in the original implementation (even though it should not be
185+
# required in the python version)
182186
z_array = np.zeros([len(x_mean), draws])
183187

188+
# draw random values of Z, exponentiate, and sort them in a bidimensional
189+
# array
184190
for i in range(z_array.shape[0]):
185191
y_array = np.array([np.exp(rnorm(x_mean[i], x_sd[i]))
186192
for _ in range(draws)])
@@ -191,6 +197,7 @@ def maverick_normalization(x_mean, x_sd, klist, draws=1e6, limit=95):
191197
l_limit = (100 - limit) / 2
192198
u_limit = 100 - l_limit
193199

200+
# Gather mean and CI values and return them as a single dict.
194201
norm_res = dict(
195202
(i, {"norm_mean": np.mean(z_array[i]),
196203
"lower_limit": np.percentile(z_array[i], l_limit),

0 commit comments

Comments
 (0)