Commit b2879e9a authored by David A.. Werner's avatar David A.. Werner
Browse files

Added survival rates

parent d44d9bab
......@@ -18,8 +18,8 @@ plt.close()
fig, ax = plt.subplots()
styles = {'surviving_ancestors': 'b-',
'surviving_children': 'r--',
'surviving_mutants': 'k-.'}
'surviving_children': 'r-',
'surviving_mutants': 'k-'}
labels = {'surviving_ancestors': 'previous generation',
'surviving_children': 'new children',
......@@ -42,8 +42,8 @@ plt.close()
fig, ax = plt.subplots()
styles = {'duplicate_population': 'b-',
'duplicate_children': 'r--',
'duplicate_mutants': 'k-.'}
'duplicate_children': 'r-',
'duplicate_mutants': 'k-'}
labels = {'duplicate_population': 'previous generation',
'duplicate_children': 'new children',
......@@ -63,3 +63,27 @@ ax.yaxis.grid(True)
fig.legend()
plt.savefig('assignment_dups_vs_gen.png')
plt.close()
fig, ax = plt.subplots()
styles = {'parent_survival_rate': 'b-',
'child_survival_rate': 'r-',
'mutant_survival_rate': 'k-'}
labels = {'parent_survival_rate': 'previous generation',
'child_survival_rate': 'children',
'mutant_survival_rate': 'mutants'}
for attr in ['parent_survival_rate', 'child_survival_rate', 'mutant_survival_rate']:
style = styles[attr]
ys = []
for idx, history in enumerate(histories):
history = filter(lambda gen: getattr(gen, attr) is not None, history)
ys.append([getattr(gen, attr) for gen in history])
x = [gen.generation_number for gen in history]
y = np.mean(ys, axis=0)
ax.plot(x, y, style, label = labels[attr])
ax.set(xlabel='Generation #', ylabel='Number per Group', title='Survival Rate for Types of Manducas')
ax.yaxis.grid(True)
fig.legend()
plt.savefig('assignment_survival_rates_vs_gen.png')
plt.close()
Markdown is supported
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