diff --git a/swp2.py b/swp2.py index cc29051..2ef7acd 100644 --- a/swp2.py +++ b/swp2.py @@ -27,17 +27,19 @@ def return_x_y_from_stwp_theta_file(stwp_theta_file, breaks, mu, tgen): #### END of parsing # quit this file if the number of dimensions is incorrect if dim < breaks+1: - return 0,0,0 + return 0,0,0 # 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 t = {} # list of thetas theta_L = [] sum_t = 0 - #groups.sort(reverse=True) 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 theta_L.append(float(theta_site[group_nb])) # 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 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): x.append(list(t.values())[time]) x.append(list(t.values())[time]) x.append(list(t.values())[len(t.values())-1]) + #x = x[::-1] + #y = y[::-1] #x.sort(reverse=True) #y.sort(reverse=True)