def test_tracks_io(): d = data_generation.CubeDataset(2, 100, 0.0, 0.3) output = StringIO() tracks_before = d.tracks tracking.save_tracks_graph(output, tracks_before) output.seek(0) tracks_after = tracking.load_tracks_graph(output) assert len(tracks_before.nodes()) == len(tracks_after.nodes()) assert len(tracks_before.edges()) == len(tracks_after.edges())
def test_tracks_io(): data = synthetic_scene.SyntheticCubeScene(2, 100, 0.0) _, _, _, graph = data.get_tracks_data(40, 0.0) output = StringIO() tracks_before = graph tracking.save_tracks_graph(output, tracks_before) output.seek(0) tracks_after = tracking.load_tracks_graph(output) assert len(tracks_before.nodes()) == len(tracks_after.nodes()) assert len(tracks_before.edges()) == len(tracks_after.edges())
def save_tracks_graph(self, graph, filename=None): with io.open_wt(self._tracks_graph_file(filename)) as fout: tracking.save_tracks_graph(fout, graph)
def save_tracks_graph(graph, file_path, filename=None): with io.open_wt(_tracks_graph_file(file_path, filename)) as fout: tracking.save_tracks_graph(fout, graph)