Changeset 682 for mds-and-trees
- Timestamp:
- 09/02/17 14:12:51 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mds-and-trees/tree-genealogy.py
r681 r682 390 390 x1_dist = 0 391 391 x2_dist = 0 392 miny = y-20 393 maxy = y+20 392 miny = y-2000 393 maxy = y+2000 394 394 i_left = bisect.bisect_left(self.y_sorted, miny) 395 395 i_right = bisect.bisect_right(self.y_sorted, maxy) … … 524 524 visited[0] = 1 525 525 self.props["depth"][0] = 0 526 527 526 while True: 528 527 current_node = nodes_to_visit[0] 528 529 529 for child in self.tree.children[current_node]: 530 530 if visited[child] == 0: … … 657 657 line_arr = line_arr[1].split(' ', 1) 658 658 if line_arr[0] == "[OFFSPRING]": 659 creature = json.loads(line_arr[1]) 659 try: 660 creature = json.loads(line_arr[1]) 661 except ValueError: 662 print("Json format error - the line cannot be read. Breaking the loading loop.") 663 # fixing arrays by removing the last element 664 # ! assuming that only the last line is broken ! 665 self.parents.pop() 666 self.children.pop() 667 self.time.pop() 668 self.kind.pop() 669 self.life_lenght.pop() 670 nodes -= 1 671 break 672 660 673 if "FromIDs" in creature: 661 674 … … 769 782 tree.load(dir, max_nodes=args.max_nodes) 770 783 784 771 785 designer = Designer(tree, jitter=JITTER, time=TIME, balance=BALANCE) 772 786 designer.calculate_measures()
Note: See TracChangeset
for help on using the changeset viewer.