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
db7961be
Commit
db7961be
authored
Jan 09, 2018
by
Bedartha Goswami
Browse files
remove 'save' flag & save-to-disk util functions
parent
cc18ab05
Changes
3
Hide whitespace changes
Inline
Side-by-side
distributions.py
View file @
db7961be
...
...
@@ -6,7 +6,7 @@ A few functions to assist in estimating the cumulative distributions
"""
# Created: Thu May 26, 2016 11:12PM
# Last modified: Tue
Aug 15
, 201
7
0
1:28pm
# Last modified: Tue
Jan 09
, 201
8
0
2:02PM
# Copyright: Bedartha Goswami <goswami@pik-potsdam.de>
...
...
@@ -18,7 +18,7 @@ from utils import _progressbar_update
from
utils
import
_progressbar_finish
def
cumulative
(
pdfmat
,
var_span
,
verbose
,
save
,
pbar
):
def
cumulative
(
pdfmat
,
var_span
,
verbose
,
pbar
):
"""
Estimates the cumulative distributions for the specified dataset.
"""
...
...
events.py
View file @
db7961be
...
...
@@ -6,7 +6,7 @@ A suite of functions that assist in carrying out the event-detection analysis
"""
# Created: Thu May 26, 2016 03:50PM
# Last modified: Tue Jan 09, 2018 0
1:5
3PM
# Last modified: Tue Jan 09, 2018 0
2:0
3PM
# Copyright: Bedartha Goswami <goswami@pik-potsdam.de>
import
numpy
as
np
...
...
@@ -72,8 +72,8 @@ def __divide_at_midpoint(G):
return
G1
,
G2
def
community_strength_data
(
G
,
time
,
ld
,
wsize
,
wstep
,
verbose
=
False
,
save
=
True
,
pbar
=
False
):
def
community_strength_data
(
G
,
time
,
ld
,
wsize
,
wstep
,
verbose
=
False
,
pbar
=
False
):
"""
Saves intra-community link fraction for specified data set.
"""
...
...
@@ -100,7 +100,7 @@ def community_strength_data(G, time, ld, wsize, wstep,
def
community_strength_random_model
(
G
,
time
,
ld
,
wsize
,
wstep
,
nsurr
,
verbose
=
False
,
save
=
True
,
pbar
=
False
):
verbose
=
False
,
pbar
=
False
):
"""
Saves intra-community link fraction for surrogates of specified data set.
"""
...
...
@@ -142,7 +142,7 @@ def community_strength_random_model(G, time, ld, wsize, wstep, nsurr,
return
Qsurr
,
LDsurr
,
tmid
def
pvalues
(
Q
,
Qsurr
,
nwind
,
verbose
=
False
,
save
=
True
,
pbar
=
False
):
def
pvalues
(
Q
,
Qsurr
,
nwind
,
verbose
=
False
,
pbar
=
False
):
"""
Returns the p-value of obtaining intra-community link density.
"""
...
...
utils.py
View file @
db7961be
...
...
@@ -6,7 +6,7 @@ A suite of utility functions that assist in carrying out the analysis
"""
# Created: Thu May 26, 2016 03:50PM
# Last modified:
Fri
J
u
n 0
3
, 201
6
1
2:
55A
M
# Last modified:
Tue
J
a
n 0
9
, 201
8
0
2:
01P
M
# Copyright: Bedartha Goswami <goswami@pik-potsdam.de>
from
progressbar
import
ProgressBar
,
Bar
,
Percentage
,
ETA
...
...
@@ -14,48 +14,6 @@ import matplotlib.pyplot as pl
import
numpy
as
np
def
_savedat
(
path
,
filename
,
verbose
=
False
,
save
=
False
,
**
kwargs
):
"""
Saves the data in kwargs in filename under given path.
"""
if
save
:
_printmsg
(
"Saving output..."
,
verbose
)
f
=
path
+
filename
locals
().
update
(
kwargs
)
var_list
=
[
"%s=%s, "
%
(
key
,
key
)
for
key
in
kwargs
]
var_list
=
""
.
join
(
var_list
)
save_cmd
=
"np.savez('%s', %s)"
%
(
f
,
var_list
)
exec
(
save_cmd
)
_printmsg
(
"Saved to: %s.npz"
%
f
,
verbose
)
return
None
def
_savefig
(
path
,
filename
,
verbose
=
False
,
save
=
False
):
"""
Saves the data in kwargs in filename under given path.
"""
if
save
:
_printmsg
(
"Saving figure..."
,
verbose
)
f
=
path
+
filename
pl
.
savefig
(
f
)
_printmsg
(
"Saved to: %s"
%
f
,
verbose
)
else
:
pl
.
show
()
return
None
def
_savegraph
(
path
,
filename
,
G
,
verbose
=
False
,
save
=
False
):
"""
Saves igraph Graph object in filename under given path.
"""
if
save
:
_printmsg
(
"Saving igraph Graph..."
,
verbose
)
f
=
path
+
filename
G
.
write_pickle
(
f
)
_printmsg
(
"Saved to: %s"
%
f
,
verbose
)
return
None
def
_printmsg
(
msg
,
verbose
):
"""
Prints given message according to specified varbosity level.
...
...
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