To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 1a002f9c authored by sfritschi's avatar sfritschi
Browse files

Minor refactoring

parent 95e62d2a
......@@ -11,7 +11,7 @@ def main():
raise AssertionError("Usage: python3 generate.py <nthreads> <n1> <n2> <n3>")
nthreads = int(sys.argv[1])
print("Using %d threads" % nthreads)
print("Using %d thread(s)" % nthreads)
basenet = netflow.load_network_from('../netflow/network/network.h5', isGenerator=True)
print("Network statistics:")
print("Throats: %d" % len(basenet.throats))
......
......@@ -668,7 +668,10 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
# check target size (must be > basenet.Lmax)
if any([Lc < basenet.Lmax for Lc in L]):
raise NameError('targetsize leads network < Lmax of basenet!')
# check valid number of threads
if (nthreads < 1):
raise ValueError('Number of threads must be >= 1!')
# pores, distributed based on dendrogram of basenet
if (not mute): print("distributing pores...")
# make indexable and discard in-/outflow pores
......@@ -772,9 +775,10 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
if (not mute): print("Total throats: %d" % totalThroats)
# Maximum number of iterations until we give up
maxIters = 6
# Additional parameters:
maxIters = 6 # Maximum number of iterations until we give up
throatTolerance = 0.002 # Max. 0.2% may not be realized
iterCount = 0
throatsLeft = totalThroats
throatThreshold = int(throatTolerance * totalThroats)
......
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