Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bedartha Goswami
uncertise
Commits
938e25e4
Commit
938e25e4
authored
May 05, 2020
by
Norbert Marwan
Browse files
Merge commit '
2fc5fc49
'
* commit '
2fc5fc49
': Update to python 3.8
parents
b9d35494
2fc5fc49
Changes
3
Hide whitespace changes
Inline
Side-by-side
distributions.py
View file @
938e25e4
...
...
@@ -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
)
...
...
events.py
View file @
938e25e4
...
...
@@ -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
((
int
(
nwind
),
int
(
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
(
int
(
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
networks.py
View file @
938e25e4
...
...
@@ -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
(
"
\t
Pairwise 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment