Changeset 687


Ignore:
Timestamp:
09/03/17 17:37:43 (7 years ago)
Author:
konrad
Message:

Using "inherited' to decide horizontal distance from the parent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mds-and-trees/tree-genealogy.py

    r686 r687  
    471471                if len(self.tree.parents[child]) == 1:
    472472                # if current_node is the only parent
    473                     parent = [par for par, v in self.tree.parents[child].items()][0]
     473                    parent, similarity = [(par, v) for par, v in self.tree.parents[child].items()][0]
    474474
    475475                    if self.JITTER:
    476                         dissimilarity = random.gauss(0, 0.5)
     476                        dissimilarity = (1-similarity) + random.gauss(0, 0.5) + 0.001
    477477                    else:
    478                         dissimilarity = 1
     478                        dissimilarity = (1-similarity) + 0.001
    479479                    add_node({'id':child, 'y':ypos, 'x':
    480480                             self.xmin_crowd(self.positions[parent]['x']-dissimilarity,
     
    690690                            else:
    691691                                parent_id = get_id("virtual_parent")
    692                             inherited = 1 #(creature["Inherited"][i] if 'Inherited' in creature else 1) #ONLY FOR NOW
     692                            inherited = (creature["Inherited"][i] if 'Inherited' in creature else 1)
    693693                            self.parents[creature_id][parent_id] = inherited
    694694
Note: See TracChangeset for help on using the changeset viewer.