Commit dd187c0f authored by Carlos GO's avatar Carlos GO
Browse files

parse average over runs

parent 57e94a06
...@@ -324,4 +324,4 @@ def start(generations=20, size=10, length=50, fit='energy', gc=0.5,\ ...@@ -324,4 +324,4 @@ def start(generations=20, size=10, length=50, fit='energy', gc=0.5,\
if __name__ == "__main__": if __name__ == "__main__":
start(mutation_rate=-1,verbose=True, generations=1000, size=1000, runs=20,\ start(mutation_rate=-1,verbose=True, generations=1000, size=1000, runs=20,\
dest="maternal_50_a10.csv") dest="maternal_50_a10.csv", procs=10)
...@@ -12,13 +12,16 @@ def structure_info(df, sse='multi'): ...@@ -12,13 +12,16 @@ def structure_info(df, sse='multi'):
""" """
df[sse] = df['structure'].apply(lambda x: loop_counter(x)[sse]) df[sse] = df['structure'].apply(lambda x: loop_counter(x)[sse])
return df return df
def mean_stats(dfs):
return pd.concat(list(dfs)).groupby('mutations').mean()
def struc_plot(df, sse='multi'): def struc_plot(dfs, sse='multi'):
df = structure_info(df, sse=sse) dfs = (structure_info(df) for df in dfs)
print(df) strucs = pd.concat(dfs).groupby('mutations').mean()
strucs = df.groupby('mutations').mean() print(strucs)
sse_mean = strucs[sse] sse_mean = strucs[sse]
sns.tsplot(sse_mean) sns.tsplot(sse_mean)
plt.savefig("multis_adapt.pdf", format="pdf")
plt.show() plt.show()
# print(sse_mean) # print(sse_mean)
...@@ -29,7 +32,7 @@ def mut_plot(): ...@@ -29,7 +32,7 @@ def mut_plot():
plt.show() plt.show()
if __name__ == "__main__": if __name__ == "__main__":
path = "maternal_50_adaptive_0.csv" path = "maternal_50_adaptive_0.csv"
df = pd.read_csv(path) dfs = (pd.read_csv(f"maternal_50_a10_{i}.csv") for i in range(20))
struc_plot(df, sse='multi') struc_plot(dfs, sse='multi')
# mut_plot() # mut_plot()
pass pass
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment