swp2 plotting improve

master
tforest 2023-11-10 10:28:43 +01:00
parent ecc6fd23fc
commit bbc06411e9
1 changed files with 9 additions and 4 deletions

11
swp2.py
View File

@ -29,15 +29,17 @@ def return_x_y_from_stwp_theta_file(stwp_theta_file, breaks, mu, tgen):
if dim < breaks+1: if dim < breaks+1:
return 0,0,0 return 0,0,0
# get n, the last bin of the last group # get n, the last bin of the last group
n = int(groups[-1].split(",")[-1]) #n = int(groups[-1].split(",")[-1])
# revert the list of groups as the most recent times correspond
# to the closest and last leafs of the coal. tree.
groups = groups[::-1]
# initiate the dict of times # initiate the dict of times
t = {} t = {}
# list of thetas # list of thetas
theta_L = [] theta_L = []
sum_t = 0 sum_t = 0
#groups.sort(reverse=True)
for group_nb, group in enumerate(groups): for group_nb, group in enumerate(groups):
print(group_nb, group) print(group_nb, group, theta_site[group_nb], len(theta_site))
# store all the thetas one by one, with one theta per group # store all the thetas one by one, with one theta per group
theta_L.append(float(theta_site[group_nb])) theta_L.append(float(theta_site[group_nb]))
# if the group is of size 1 # 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):
# build the time x axis # build the time x axis
x = [0] x = [0]
# need to fix: t.values are sorted? and in reverse order because the groups and the times are sorted in opposite order
for time in range(0, len(t.values())-1): for time in range(0, len(t.values())-1):
x.append(list(t.values())[time]) x.append(list(t.values())[time])
x.append(list(t.values())[time]) x.append(list(t.values())[time])
x.append(list(t.values())[len(t.values())-1]) x.append(list(t.values())[len(t.values())-1])
#x = x[::-1]
#y = y[::-1]
#x.sort(reverse=True) #x.sort(reverse=True)
#y.sort(reverse=True) #y.sort(reverse=True)