Commit 2fc5fc49 authored by Andyara Oliveira Callegare's avatar Andyara Oliveira Callegare
Browse files

Update to python 3.8

parent 025b3cae
......@@ -35,10 +35,10 @@ def cdf_matrix(pdfmat, var_span, verbose=False, pbar=False):
"""
nt = pdfmat.shape[0]
bj = 0.5 * np.r_[
var_span[1] - var_span[0],
var_span[2:] - var_span[:-2],
var_span[-1] - var_span[-2]
] # Riemann sum width
var_span[1] - var_span[0],
var_span[2:] - var_span[:-2],
var_span[-1] - var_span[-2]
] # Riemann sum width
_printmsg("Estimating CDFs...", verbose)
cdfmat = np.zeros(pdfmat.shape)
prog_bar = _progressbar_start(nt, pbar)
......
......@@ -71,7 +71,7 @@ def __divide_at_midpoint(G):
return G1, G2
def community_strength_data(G, time, wsize, wstep,
def community_strength_data(G, time, wsize, wstep,
verbose=False, pbar=False):
"""
Saves intra-community link fraction for specified data set.
......@@ -111,7 +111,7 @@ def community_strength_random_model(G, time, wsize, wstep, nsurr,
tmid = []
Qsurr, LDsurr = [np.zeros((nwind, nsurr), "float") for i in range(2)]
_printmsg("Estimating intra-community link fraction...", verbose)
prog_bar = _progressbar_start(nwind*nsurr, pbar)
prog_bar = _progressbar_start(nwind * nsurr, pbar)
count = 0
for i in range(nwind):
k = i * wstep
......@@ -165,7 +165,7 @@ def holm(pvals, alpha=0.05, corr_type="dunn"):
p_ = pvals[sortidx]
j = np.arange(1, n + 1)
if corr_type == "bonf":
corr_factor = alpha / (n - j + 1)
corr_factor = alpha / (n - j + 1)
elif corr_type == "dunn":
corr_factor = 1. - (1. - alpha) ** (1. / (n - j + 1))
try:
......@@ -174,4 +174,3 @@ def holm(pvals, alpha=0.05, corr_type="dunn"):
except IndexError:
idx = []
return idx
......@@ -132,7 +132,7 @@ def _precnet_check_limits(dist_list, var_span, ld, iqr,
if not cond:
str0 = "Target link density could not be bracketed!"
str1 = "Increase initial THR bracket or change target LD."
str2 = "LD = %.3f for THR = %.2E and %.3f for THR = %.2f"\
str2 = "LD = %.3f for THR = %.2E and %.3f for THR = %.2f" \
% (ld_lims[0], thr_lims[0], ld_lims[1], thr_lims[1])
print(str0 + "\n" + str1 + "\n" + str2)
return cond, ld_lims
......@@ -175,7 +175,7 @@ def _precnet_igraph(dist_list, var_span, e, verbose=False, pbar=False):
Returns weighted igraph object by estimating prob. of rec. mat.
"""
P = prob_recurrence_matrix(dist_list, var_span, e, verbose, pbar)
np.fill_diagonal(P, 0.) # remove self-loops
np.fill_diagonal(P, 0.) # remove self-loops
G = _precmat_to_igraph(P)
return G
......@@ -297,11 +297,11 @@ def prob_recurrence_matrix(dist_list, var_span, e=0.1,
_printmsg("\tPairwise recurrence probability bounds...", verbose)
f1, f2 = np.zeros((n, len(u))), np.zeros((n, len(u)))
for j in range(n):
f1[j, :] = np.interp(u - e, u, dist_list[j]) # for z = e
f2[j, :] = np.interp(u + e, u, dist_list[j]) # for z = -e
f1[j, :] = np.interp(u - e, u, dist_list[j]) # for z = e
f2[j, :] = np.interp(u + e, u, dist_list[j]) # for z = -e
prog_bar = _progressbar_start(n, pbar)
for i in range(n):
fi = np.interp(u, u, dist_list[i]) # Xi.cdf(u)
fi = np.interp(u, u, dist_list[i]) # Xi.cdf(u)
plus_lo, plus_hi = _bounds_williamson(fi, f1)
mnus_lo, mnus_hi = _bounds_williamson(fi, f2)
diff = plus_lo - mnus_hi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment