Skip to content
Snippets Groups Projects
Commit 9d8cc9fd authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Polish

parent ad73a9ec
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ import bisect ...@@ -32,7 +32,7 @@ import bisect
def calculate_radii_and_rossby(start, end, inc, segment, e_overestim, handlers, def calculate_radii_and_rossby(start, end, inc, segment, e_overestim, handlers,
array_d_init): array_d_init):
radii = 0 #[m] radii = 0 # in m
rossby = 0 rossby = 0
days_modifier = 0 days_modifier = 0
...@@ -112,7 +112,7 @@ print("Number of edges:", g.num_edges()) ...@@ -112,7 +112,7 @@ print("Number of edges:", g.num_edges())
print("Internal properties:") print("Internal properties:")
g.list_properties() g.list_properties()
t1 = time.perf_counter() t1 = time.perf_counter()
timings.write(f"loading: {t1 - t0} s\n") timings.write(f"loading: {t1 - t0:.0f} s\n")
t0 = t1 t0 = t1
g.vp['pos_first'] = g.new_vp('object') g.vp['pos_first'] = g.new_vp('object')
...@@ -226,7 +226,7 @@ for n in g.vertices(): ...@@ -226,7 +226,7 @@ for n in g.vertices():
g.vp.last_av_rad[n] = radii g.vp.last_av_rad[n] = radii
t1 = time.perf_counter() t1 = time.perf_counter()
timings.write(f"iterating on vertices: {t1 - t0} s\n") timings.write(f"iterating on vertices: {t1 - t0:.0f} s\n")
t0 = t1 t0 = t1
print("Iterating on edges...") print("Iterating on edges...")
...@@ -285,11 +285,11 @@ for edge in g.edges(): ...@@ -285,11 +285,11 @@ for edge in g.edges():
g.ep.cost_function[edge] = cf g.ep.cost_function[edge] = cf
t1 = time.perf_counter() t1 = time.perf_counter()
timings.write(f"iterating on edges: {t1 - t0} s\n") timings.write(f"iterating on edges: {t1 - t0:.0f} s\n")
t0 = t1 t0 = t1
print("Saving...") print("Saving...")
g.save('segments_cost_functions.gt') g.save('segments_cost_functions.gt')
print('All done') print('All done')
t1 = time.perf_counter() t1 = time.perf_counter()
timings.write(f"saving: {t1 - t0} s\n") timings.write(f"saving: {t1 - t0:.0f} s\n")
timings.close() timings.close()
...@@ -13,10 +13,6 @@ import time ...@@ -13,10 +13,6 @@ import time
import sys import sys
import pathlib import pathlib
##########################
# load the edgelist file #
##########################
if len(sys.argv) != 3: sys.exit("Required arguments: input-file output-file") if len(sys.argv) != 3: sys.exit("Required arguments: input-file output-file")
if pathlib.Path(sys.argv[2]).suffix not in {".gt", ".graphml"}: if pathlib.Path(sys.argv[2]).suffix not in {".gt", ".graphml"}:
...@@ -37,9 +33,7 @@ t1 = time.perf_counter() ...@@ -37,9 +33,7 @@ t1 = time.perf_counter()
print(f'Loading done in {t1 - t0:.0f} s') print(f'Loading done in {t1 - t0:.0f} s')
t0 = t1 t0 = t1
############## # Processing:
# Processing #
##############
g.vp['segment'] = g.new_vp('object') # this object will be a list g.vp['segment'] = g.new_vp('object') # this object will be a list
print('Collapsing into segments...') print('Collapsing into segments...')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment