Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alexander R. Hankin
EE194_Manduca_Simulator_Demo
Commits
b2879e9a
Commit
b2879e9a
authored
May 07, 2018
by
David A.. Werner
Browse files
Added survival rates
parent
d44d9bab
Changes
1
Hide whitespace changes
Inline
Side-by-side
assignment_plots.py
View file @
b2879e9a
...
...
@@ -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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment