From 211b152a2b73bba5c3678294a00cd5f183499aee Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Thu, 6 Jun 2024 14:31:02 +0200 Subject: [PATCH] Ignore properties of input graph We want to be able to re-compute the cost, starting from the output of a previous run of `cost_function.py`, when we have discarded the input file of the previous run. --- Trajectories/cost_function.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py index 1f43541e..e0b7abae 100755 --- a/Trajectories/cost_function.py +++ b/Trajectories/cost_function.py @@ -1,20 +1,20 @@ #!/usr/bin/env python3 -"""This script takes the graph of segments without cost and computes -the cost applied to edges. +"""This script takes a graph of segments and computes the cost applied +to edges. Input: --- the graph of segments without cost; +-- the graph of segments; -- the SHPC. Output: the graph of segments with cost. The inst_eddies property of vertices is not modified by this -script. All the content of the input graph is part of the output graph -so the input file may be removed, if desired, after running this -script. +script. The cost is an internal property of the output graph. This +internal property is created if it was not already in the input +graph. The cost is overwritten if it was already in the input graph. """ @@ -217,7 +217,18 @@ delta_r_std = 8.6953e3 # in m # Load the graph_tool file: print("Loading graph...") -g = graph_tool.load_graph(args.input_segments) +g = graph_tool.load_graph( + args.input_segments, + ignore_vp=[ + "pos_first", + "pos_last", + "first_av_rad", + "first_av_ros", + "last_av_rad", + "last_av_ros", + ], + ignore_ep=["cost_function"], +) print("Loading done...") print("Input graph:") print("Number of vertices:", g.num_vertices()) -- GitLab