os.makedirs(temporal_folder) except OSError: None ## # STEP-1: # Initializing of the common and static context of each simulation ## # 1.1 Mobile entities trough GPX traces # The track normalization is an expensive computational task. A cached file is generated in each temporal path if os.path.isfile(temporal_folder + "normalized_trajectories.csv"): input_directory = temporal_folder + "normalized_trajectories.csv" # logging.info("Loading trajectories from (cached file): %s" % input_directory) tracks = trackanimation.read_track(input_directory) else: input_directory = trajectories_path # can load csv files logging.info("Loading trajectories from (raw files): %s" % input_directory) tracks = trackanimation.read_track(input_directory) tracks = tracks.time_video_normalize( time=number_simulation_steps, framerate=1) # framerate must be one tracks.export(temporal_folder + "normalized_trajectories") # 1.2 Network infrastructure # Endpoint entities must have three attributes: level(=0) and lat/lng coordinates t = Topology() dataNetwork = json.load(open(experiment_path + 'networkDefinition.json')) t.load_all_node_attr(dataNetwork)
import trackanimation from trackanimation.animation import AnimationTrack # Simple example input_directory = "d:/robi/Turystyka/2018_Tajlandia/trk/" tha_trk = trackanimation.read_track(input_directory) tha_trk = tha_trk.time_video_normalize(time=10, framerate=10) fig = AnimationTrack(df_points=tha_trk, dpi=300, bg_map=True, map_transparency=0.9) # fig = AnimationTrack(df_points=tha_trk, dpi=300, bg_map=True, map_transparency=0.5) # print(type(fig)) fig.make_video(output_file='thailand4', framerate=10, linewidth=2.0)