Browse Source

swp2 plotting improve

tforest 5 months 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,17 +27,19 @@ def return_x_y_from_stwp_theta_file(stwp_theta_file, breaks, mu, tgen):
27 27
     #### END of parsing
28 28
     # quit this file if the number of dimensions is incorrect
29 29
     if dim < breaks+1:
30
-        return 0,0,0 
30
+        return 0,0,0
31 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 36
     # initiate the dict of times
34 37
     t = {}
35 38
     # list of thetas 
36 39
     theta_L = []
37 40
     sum_t = 0
38
-    #groups.sort(reverse=True)
39 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 43
         # store all the thetas one by one, with one theta per group
42 44
         theta_L.append(float(theta_site[group_nb]))
43 45
         # if the group is of size 1
@@ -69,11 +71,14 @@ def return_x_y_from_stwp_theta_file(stwp_theta_file, breaks, mu, tgen):
69 71
     
70 72
     # build the time x axis
71 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 75
     for time in range(0, len(t.values())-1):
73 76
         x.append(list(t.values())[time])
74 77
         x.append(list(t.values())[time])
75 78
     x.append(list(t.values())[len(t.values())-1])
76 79
 
80
+    #x = x[::-1]
81
+    #y = y[::-1]
77 82
     #x.sort(reverse=True)
78 83
     #y.sort(reverse=True)
79 84