diff --git a/Inst_eddies/Documentation_texfol/Graphiques/SHPC.odg b/Inst_eddies/Documentation_texfol/Graphiques/SHPC.odg index 462e8a82df20e3cbf298e0411f87e39c1fd17008..ffc49f6c74cf5e4d3e90635979439c49fe1fb787 100644 Binary files a/Inst_eddies/Documentation_texfol/Graphiques/SHPC.odg and b/Inst_eddies/Documentation_texfol/Graphiques/SHPC.odg differ diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py index f0886911338cd6b3d86cbcc3f791d7ee01a09759..77daba0826934f56e8b861629f7ae93c81575b73 100755 --- a/Trajectories/cost_function.py +++ b/Trajectories/cost_function.py @@ -10,7 +10,7 @@ Input: - the graph of segments without cost functions, "segments.gt" or "segments.graphml", expected to be in the current directory -- shapefiles, specified as command line arguments +- the SHPC Output: the graph of segments with cost functions, segments_cost_functions.gt or segments_cost_functions.graphml. diff --git a/Trajectories/trajectories.py b/Trajectories/trajectories.py index 721716fe19571ea8caf5e9ea36b07582f4bc4ff2..deae0c40dc4ea53e6938926711f62ec0bbf8c32b 100755 --- a/Trajectories/trajectories.py +++ b/Trajectories/trajectories.py @@ -4,7 +4,7 @@ identifies trajectories. Input: the graph of segments produced by Graph-tool (in gt or graphml -format). Output: trajectories as lists of segments and as lists of +format). Output: trajectories as lists of segments and as lists of instantaneous eddies, in JSon files. """ @@ -15,8 +15,8 @@ import sys import numpy as np g = graph_tool.load_graph(sys.argv[1]) -traj_prop = g.new_vp('int', val = - 1) -all_cost_functions = g.get_edges([g.ep.cost_function]) +traj_prop = g.new_vertex_property('int', val = - 1) +all_cost_functions = g.get_edges([g.edge_properties.cost_function]) # Array of indices that sort on cost function: ind_cf = np.argsort(all_cost_functions[:, 2]) @@ -34,10 +34,11 @@ for i in ind_cf: ind_traj += 1 traj_prop[source] = ind_traj traj_prop[target] = ind_traj - segments = [int(g.vp.name[source]), int(g.vp.name[target])] + segments = [int(g.vertex_properties.name[source]), + int(g.vertex_properties.name[target])] traj_segm.append(segments) - inst_eddies = list(g.vp.inst_eddies[source]) \ - + list(g.vp.inst_eddies[target]) + inst_eddies = list(g.vertex_properties.inst_eddies[source]) \ + + list(g.vertex_properties.inst_eddies[target]) expanded_traj.append(inst_eddies) elif traj_prop[source] == - 1: # assert traj_prop[target] != - 1 @@ -50,15 +51,15 @@ for i in ind_cf: # trajectory so we create a new trajectory for source. ind_traj += 1 traj_prop[source] = ind_traj - segments = [int(g.vp.name[source])] + segments = [int(g.vertex_properties.name[source])] traj_segm.append(segments) - inst_eddies = list(g.vp.inst_eddies[source]) + inst_eddies = list(g.vertex_properties.inst_eddies[source]) expanded_traj.append(inst_eddies) else: traj_prop[source] = traj_prop[target] - segment = int(g.vp.name[source]) + segment = int(g.vertex_properties.name[source]) traj_segm[traj_prop[source]].append(segment) - inst_eddies = list(g.vp.inst_eddies[source]) + inst_eddies = list(g.vertex_properties.inst_eddies[source]) expanded_traj[traj_prop[source]].extend(inst_eddies) elif traj_prop[target] == - 1: # assert traj_prop[source] != - 1 @@ -71,15 +72,15 @@ for i in ind_cf: # so we create a new trajectory for target. ind_traj += 1 traj_prop[target] = ind_traj - segments = [int(g.vp.name[target])] + segments = [int(g.vertex_properties.name[target])] traj_segm.append(segments) - inst_eddies = list(g.vp.inst_eddies[target]) + inst_eddies = list(g.vertex_properties.inst_eddies[target]) expanded_traj.append(inst_eddies) else: traj_prop[target] = traj_prop[source] - segment = int(g.vp.name[target]) + segment = int(g.vertex_properties.name[target]) traj_segm[traj_prop[target]].append(segment) - inst_eddies = list(g.vp.inst_eddies[target]) + inst_eddies = list(g.vertex_properties.inst_eddies[target]) expanded_traj[traj_prop[source]].extend(inst_eddies) # Create trajectories for isolated segments: @@ -87,9 +88,9 @@ for v in g.vertices(): if traj_prop[v] == - 1: ind_traj += 1 traj_prop[v] = ind_traj - segments = [int(g.vp.name[v])] + segments = [int(g.vertex_properties.name[v])] traj_segm.append(segments) - inst_eddies = list(g.vp.inst_eddies[v]) + inst_eddies = list(g.vertex_properties.inst_eddies[v]) expanded_traj.append(inst_eddies) print("Number of trajectories: ", len(traj_segm))