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

Add new scripts

parent 6e74f389
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
"""This script reads a graph of segments (with or without cost values)
and searches the segment containing a given instantaneous eddy.
"""
import sys
import json
import graph_tool
g = graph_tool.load_graph(sys.argv[1])
node = int(sys.argv[2])
for v in g.vertices():
if node in g.vp.inst_eddies[v]:
print("segment =", g.vp.inst_eddies[v])
break
else:
sys.exit("Node not found")
#!/usr/bin/env python3
"""This script reads a Json file containing trajectories as lists of
segments, and searches the trajectory which contains a given segment.
"""
import sys
import json
with open(sys.argv[1]) as f_obj:
traj_segm = json.load(f_obj)
segment = int(sys.argv[2])
for traj in traj_segm:
if segment in traj:
print(f"{traj=}")
break
else:
sys.exit("Trajectory not found")
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