Ok likelihood swp2

master
tforest 2023-11-29 15:29:12 +01:00
parent 2253ce5f67
commit 23fef174f2
1 changed files with 13 additions and 15 deletions

28
swp2.py
View File

@ -288,7 +288,6 @@ def plot_all_epochs_thetafolder(folder_path, mu, tgen, title = "Title", theta_sc
plt.title(title) plt.title(title)
plt.savefig(title+'_b'+str(breaks)+'.pdf') plt.savefig(title+'_b'+str(breaks)+'.pdf')
# plot likelihood against nb of breakpoints # plot likelihood against nb of breakpoints
# best possible likelihood from SFS # best possible likelihood from SFS
# Segregating sites # Segregating sites
S = sum(SFS_stored) S = sum(SFS_stored)
@ -390,20 +389,19 @@ def plot_test_theta(folder_path, mu, tgen, title = "Title", theta_scale = True,
for i in range(0, len(x)): for i in range(0, len(x)):
T += y[i] / (x[i]*(x[i]-1)) T += y[i] / (x[i]*(x[i]-1))
x_2.append(T) x_2.append(T)
# Plotting (fig 2) # Plotting (fig 2)
plt.plot(x_2, y, 'o', linestyle="dotted", alpha=0.75, lw=2, label = str(epoch)+' brks') plt.plot(x_2, y, 'o', linestyle="dotted", alpha=0.75, lw=2, label = str(epoch)+' brks')
plt.xlabel("# breaks") plt.xlabel("# breaks")
plt.ylabel("theta") plt.ylabel("theta")
plt.legend(loc='upper right') plt.legend(loc='upper right')
plt.savefig(title+'_test'+str(k)+'.pdf') plt.savefig(title+'_test'+str(k)+'.pdf')
# Plotting (fig 3) which is the same but log scale for x
# Plotting (fig 3) which is the same but log scale for x plt.plot(x_2, y, 'o', linestyle="dotted", alpha=0.75, lw=2, label = str(epoch)+' brks')
plt.plot(x_2, y, 'o', linestyle="dotted", alpha=0.75, lw=2, label = str(epoch)+' brks') plt.xscale('log')
plt.xscale('log') plt.xlabel("# breaks")
plt.xlabel("# breaks") plt.ylabel("theta")
plt.ylabel("theta") plt.legend(loc='upper right')
plt.legend(loc='upper right') plt.savefig(title+'_test'+str(k)+'_log.pdf')
plt.savefig(title+'_test'+str(k)+'_log.pdf')
def save_multi_image(filename): def save_multi_image(filename):
pp = PdfPages(filename) pp = PdfPages(filename)