Browse Source

swp2 plotting improve

tforest 1 year ago
parent
commit
bbc06411e9
1 changed files with 9 additions and 4 deletions
  1. 9 4
      swp2.py

+ 9 - 4
swp2.py View File

27
     #### END of parsing
27
     #### END of parsing
28
     # quit this file if the number of dimensions is incorrect
28
     # quit this file if the number of dimensions is incorrect
29
     if dim < breaks+1:
29
     if dim < breaks+1:
30
-        return 0,0,0 
30
+        return 0,0,0
31
     # get n, the last bin of the last group
31
     # get n, the last bin of the last group
32
-    n = int(groups[-1].split(",")[-1])
32
+    #n = int(groups[-1].split(",")[-1])
33
+    # revert the list of groups as the most recent times correspond
34
+    # to the closest and last leafs of the coal. tree.
35
+    groups = groups[::-1]
33
     # initiate the dict of times
36
     # initiate the dict of times
34
     t = {}
37
     t = {}
35
     # list of thetas 
38
     # list of thetas 
36
     theta_L = []
39
     theta_L = []
37
     sum_t = 0
40
     sum_t = 0
38
-    #groups.sort(reverse=True)
39
     for group_nb, group in enumerate(groups):
41
     for group_nb, group in enumerate(groups):
40
-        print(group_nb, group)
42
+        print(group_nb, group, theta_site[group_nb], len(theta_site))
41
         # store all the thetas one by one, with one theta per group
43
         # store all the thetas one by one, with one theta per group
42
         theta_L.append(float(theta_site[group_nb]))
44
         theta_L.append(float(theta_site[group_nb]))
43
         # if the group is of size 1
45
         # if the group is of size 1
69
     
71
     
70
     # build the time x axis
72
     # build the time x axis
71
     x = [0]
73
     x = [0]
74
+    # need to fix: t.values are sorted? and in reverse order because the groups and the times are sorted in opposite order
72
     for time in range(0, len(t.values())-1):
75
     for time in range(0, len(t.values())-1):
73
         x.append(list(t.values())[time])
76
         x.append(list(t.values())[time])
74
         x.append(list(t.values())[time])
77
         x.append(list(t.values())[time])
75
     x.append(list(t.values())[len(t.values())-1])
78
     x.append(list(t.values())[len(t.values())-1])
76
 
79
 
80
+    #x = x[::-1]
81
+    #y = y[::-1]
77
     #x.sort(reverse=True)
82
     #x.sort(reverse=True)
78
     #y.sort(reverse=True)
83
     #y.sort(reverse=True)
79
     
84