Commit 47843ad6 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix syntax error with Python 2

parent 563c3dde
......@@ -739,16 +739,16 @@ class BlockState(object):
mcmc_state.state = self._state
if _bm_test():
Si = self.entropy(**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]),
xi_fast=True, dl_deg_alt=False)
Si = self.entropy(xi_fast=True, dl_deg_alt=False,
**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]))
dS, nmoves = self._mcmc_sweep_dispatch(mcmc_state)
if _bm_test():
Sf = self.entropy(**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]),
xi_fast=True, dl_deg_alt=False)
Sf = self.entropy(xi_fast=True, dl_deg_alt=False,
**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]))
assert abs(dS - (Sf - Si)) < 1e-6, \
"inconsistent entropy delta %g (%g): %s" % (dS, Sf - Si,
str(entropy_args))
......@@ -828,16 +828,16 @@ class BlockState(object):
gibbs_state.state = self._state
if _bm_test():
Si = self.entropy(**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]),
xi_fast=True, dl_deg_alt=False)
Si = self.entropy(xi_fast=True, dl_deg_alt=False,
**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]))
dS, nmoves = self._gibbs_sweep_dispatch(gibbs_state)
if _bm_test():
Sf = self.entropy(**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]),
xi_fast=True, dl_deg_alt=False)
Sf = self.entropy(xi_fast=True, dl_deg_alt=False,
**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]))
assert abs(dS - (Sf - Si)) < 1e-6, \
"inconsistent entropy delta %g (%g): %s" % (dS, Sf - Si,
str(entropy_args))
......@@ -919,9 +919,9 @@ class BlockState(object):
else:
multi_state.vlist.extend(vertices)
multi_state.E = self.E
multi_state.S = self.entropy(**dmask(entropy_args,
["xi_fast", "deg_dl_alt"]),
xi_fast=True, dl_deg_alt=False)
multi_state.S = self.entropy(xi_fast=True, dl_deg_alt=False,
**dmask(entropy_args,
["xi_fast", "deg_dl_alt"]))
multi_state.state = self._state
multi_state.S_min = m_state._S_min
......@@ -932,8 +932,8 @@ class BlockState(object):
S, nmoves = self._multicanonical_sweep_dispatch(multi_state)
if _bm_test():
Sf = self.entropy(**dmask(entropy_args, ["xi_fast", "deg_dl_alt"]),
xi_fast=True, dl_deg_alt=False)
Sf = self.entropy(xi_fast=True, dl_deg_alt=False,
**dmask(entropy_args, ["xi_fast", "deg_dl_alt"]))
assert abs(dS - (Sf - Si)) < 1e-6, \
"inconsistent entropy delta %g (%g): %s" % (dS, Sf - Si,
str(entropy_args))
......@@ -1004,16 +1004,16 @@ class BlockState(object):
if _bm_test():
del merge_state["self"]
Si = self.entropy(**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]),
xi_fast=True, dl_deg_alt=False)
Si = self.entropy(xi_fast=True, dl_deg_alt=False,
**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]))
dS, nmoves = self._merge_sweep_dispatch(merge_state)
if _bm_test():
Sf = self.entropy(**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]),
xi_fast=True, dl_deg_alt=False)
Sf = self.entropy(xi_fast=True, dl_deg_alt=False,
**dmask(entropy_args, ["xi_fast", "deg_dl_alt",
"callback"]))
assert abs(dS - (Sf - Si)) < 1e-6, \
"inconsistent entropy delta %g (%g): %s" % (dS, Sf - Si,
str(entropy_args))
......
......@@ -528,7 +528,7 @@ class LayeredBlockState(BlockState):
assert not isnan(S) and not isinf(S), \
"invalid entropy %g (%s) " % (S, str(args))
Salt = self.copy().entropy(**args, test=False)
Salt = self.copy().entropy(test=False, **args)
assert abs(S - Salt) < 1e-6, \
"entropy discrepancy after copying (%g %g)" % (S, Salt)
......
......@@ -295,8 +295,8 @@ def minimize_blockmodel_dl(g, B_min=None, B_max=None, b_min=None, b_max=None,
state_args=state_args,
mcmc_multilevel_args=mcmc_multilevel_args)
state = bisection_minimize([min_state, max_state], **bisection_args,
verbose=verbose)
state = bisection_minimize([min_state, max_state], verbose=verbose,
**bisection_args)
return state
......@@ -472,10 +472,11 @@ def minimize_nested_blockmodel_dl(g, B_min=None, B_max=None, b_min=None,
bs = []
bstate = max_state
for B in Bs:
bstate = mcmc_multilevel(bstate, B=B, **mcmc_multilevel_args,
bstate = mcmc_multilevel(bstate, B=B,
verbose=verbose_push(verbose,
("l = %d " %
len(bs))))
len(bs))),
**mcmc_multilevel_args)
bs.append(bstate.b.a)
bstate = bstate.get_block_state()
......
......@@ -97,7 +97,7 @@ class NestedBlockState(object):
def __setstate__(self, state):
conv_pickle_state(state)
self.__init__(**dmask(state, ["kwargs"]), **state["kwargs"])
self.__init__(**overlay(dmask(state, ["kwargs"]), **state["kwargs"]))
return state
def project_partition(self, j, l):
......
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