-
Notifications
You must be signed in to change notification settings - Fork 65
/
KeplerMapperVisuFromTxtFile.py
executable file
·43 lines (32 loc) · 1.54 KB
/
KeplerMapperVisuFromTxtFile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
import argparse
from gudhi.cover_complex import _save_to_html
"""This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
Author(s): Mathieu Carriere
Copyright (C) 2017 Inria
Modification(s):
- YYYY/MM Author: Description of the modification
"""
__author__ = "Mathieu Carriere"
__copyright__ = "Copyright (C) 2017 Inria"
__license__ = "GPL v3"
parser = argparse.ArgumentParser(description='Creates an html Keppler Mapper '
'file to visualize a SC.txt file.',
epilog='Example: '
'./KeplerMapperVisuFromTxtFile.py '
'-f ../../data/points/human.off_sc.txt'
'- Constructs an human.off_sc.html file.')
parser.add_argument("-f", "--file", type=str, required=True)
args = parser.parse_args()
with open(args.file, 'r') as f:
dat = f.readline()
lens = f.readline()
color = f.readline();
param = [float(i) for i in f.readline().split(" ")]
nums = [int(i) for i in f.readline().split(" ")]
points = [[float(j) for j in f.readline().split(" ")] for i in range(0, nums[0])]
edges = [[int(j) for j in f.readline().split(" ")] for i in range(0, nums[1])]
html_output_filename = args.file.rsplit('.', 1)[0] + '.html'
f.close()
_save_to_html(dat, lens, color, param, points, edges, html_output_filename)