Changeset 566 for mds-and-trees


Ignore:
Timestamp:
08/06/16 02:16:56 (8 years ago)
Author:
konrad
Message:

Added REAL time option for tree-genealogy.py, renamed previous REAL time to BIRTHS time

File:
1 edited

Legend:

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

    r564 r566  
    8181                    if not creature["FromIDs"][0] in nodes:
    8282                        firstnode = creature["FromIDs"][0]
     83                if "Time" in creature:
     84                    time[creature["ID"]] = creature["Time"]
    8385
    8486    for k, v in sorted(nodes.items()):
     
    150152        #print(node + "->" + c)
    151153        dissimilarity = 0.5 #random.gauss(0,0.3)
    152         if TIME == "REAL":
     154        if TIME == "BIRTHS":
    153155            id = ""
    154156            if c[0] == "c":
     
    159161        elif TIME == "GENERATIONAL":
    160162            positions[c] = [xmin_crowd(positions[node][0]-dissimilarity, positions[node][0]+dissimilarity, positions[node][1]+1), positions[node][1]+1]
     163        elif TIME == "REAL":
     164            positions[c] = [xmin_crowd(positions[node][0]-dissimilarity, positions[node][0]+dissimilarity, time[c]), time[c]]
    161165
    162166    for c in inv_nodes[node]:
     
    166170def prepos_children():
    167171    global max_height, max_width, min_width
     172
     173    if not bool(time):
     174        print("REAL time requested, but no real time data provided. Assuming BIRTHS time instead.")
     175        TIME = "BIRTHS"
    168176
    169177    positions[firstnode] = [0, 0]
     
    258266positions = {}
    259267depth = {}
     268time = {}
    260269
    261270def main():
     
    278287
    279288    #TODO: better names for those parameters
    280     parser.add_argument('--time', default='REAL', dest='time', help='values on vertical axis (REAL/GENERATIONAL)')
     289    parser.add_argument('--time', default='BIRTHS', dest='time', help='values on vertical axis (REAL/GENERATIONAL)')
    281290    parser.add_argument('--balance', default='MIN',dest='balance', help='method of placing node in the tree (RANDOM/MIN/DENSITY)')
    282291
Note: See TracChangeset for help on using the changeset viewer.