From c193e2313c5ece381f0cf7bb5a46038a345057a4 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Wed, 20 Apr 2022 04:07:19 +0200
Subject: [PATCH] Polish

---
 Overlap/report_graph.py |  1 -
 cost_function.py        | 16 ++++++----------
 segments.py             |  2 ++
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/Overlap/report_graph.py b/Overlap/report_graph.py
index 7d7a1927..fdf8b3c0 100755
--- a/Overlap/report_graph.py
+++ b/Overlap/report_graph.py
@@ -5,7 +5,6 @@
 """
 
 import networkx as nx
-import csv
 import shapefile
 from os import path
 from networkx import nx_agraph
diff --git a/cost_function.py b/cost_function.py
index cc8f2dcc..2c48729e 100755
--- a/cost_function.py
+++ b/cost_function.py
@@ -4,10 +4,9 @@
 # non-local cost function calculation where each edge will have a cost
 # function assigned to it. 
 # Inputs (to be changed within the script):
-    # Orientation
-    # node_id_param_file location and name
-    # gt graph name and location
-    # shapefiles names and location
+    # node_id_param_file
+    # gt graph
+    # shapefiles
 # Output: a gt graph with cost functions and an xml graph with cost functions
 
 import graph_tool
@@ -71,10 +70,10 @@ def get_SHPC(array_d_ini, date_index):
     assert i_SHPC >= 1
     return i_SHPC - 1
 
-###############################
-# grab e_overestim
-###############################
+if len(sys.argv) == 1:
+    sys.exit("Required arguments: SHPC-directory [SHPC-directory] ...")
 
+# Grab e_overestim:
 with open("node_id_param.json") as f: node_id_param = json.load(f)
 # assign attributes to the whole graphs
 e_overestim = node_id_param["e_overestim"]
@@ -119,9 +118,6 @@ g.ep['nl_cost_function'] = g.new_ep('float')
 
 # Set up the list of SHPC:
 
-if len(sys.argv) == 1:
-    sys.exit("Required arguments: SHPC-directory [SHPC-directory] ...")
-
 handlers = [util_eddies.open_shpc(shp_dir) for shp_dir in sys.argv[1:]]
 
 array_d_init = [handler["d_init"] for handler in handlers]
diff --git a/segments.py b/segments.py
index f9388ff0..87666697 100755
--- a/segments.py
+++ b/segments.py
@@ -32,6 +32,8 @@ g = graph_tool.load_graph_from_csv(sys.argv[1],
 print("Input graph:")
 print("Number of vertices:", g.num_vertices())
 print("Number of edges:", g.num_edges())
+print("Internal properties:")
+g.list_properties()
 t1 = time.perf_counter()
 print(f'Loading done in {t1 - t0:.0f} s')
 t0 = t1
-- 
GitLab