Skip to content

Commit

Permalink
min/max dof values are calculated only from visualized lineages/gener…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
s-themis committed Jul 27, 2019
1 parent 72c673f commit 7d872a5
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions Code/Output/visualization.m
Expand Up @@ -44,12 +44,13 @@
clf (fig)
hold on

plot_case = set_visualization_lineages(evolution_data, plot_case, n_input_case);
plot_case = add_min_max_values_for_continuous_dofs(plot_case, evolution_data, n_input_case);
set_visualization_appearance(plot_case)

if strcmp(get_plot_case_type(plot_case), "3d")

lineages = get_visualization_lineages(evolution_data, plot_case, n_input_case);
lineages = get_visualization_lineages(plot_case);

for n_lineage = lineages

Expand All @@ -72,7 +73,7 @@

elseif strcmp(get_plot_case_type(plot_case), "2d")

lineages = get_visualization_lineages(evolution_data, plot_case, n_input_case);
lineages = get_visualization_lineages(plot_case);
for n_lineage = lineages
lineage = get_lineage(evolution_data, n_input_case, n_lineage);
num_gens = numel(lineage);
Expand Down Expand Up @@ -509,9 +510,11 @@
end
end

function lineages = get_visualization_lineages(plot_case)
lineages = plot_case.visualization_lineages;
end


function lineages = get_visualization_lineages(evolution_data, plot_case, n_input_case)
function plot_case = set_visualization_lineages(evolution_data, plot_case, n_input_case)
dof = get_sorting_dof(plot_case);
dof_values = get_all_dof_values(evolution_data, n_input_case, dof);

Expand All @@ -527,7 +530,8 @@
sorted_indexes_values = sortrows([lineages_indexes', lineages_values'], sorting_column);

sorted_indexes = sorted_indexes_values(:,1)';
lineages = eval(sprintf("sorted_indexes(%s)", get_lineages_indexes(plot_case)));
lineages = eval(sprintf("sorted_indexes(%s)", get_lineages_indexes(plot_case)));
plot_case.visualization_lineages = lineages;
end

function sorting_dof = get_sorting_dof(plot_case)
Expand Down Expand Up @@ -555,7 +559,7 @@
if is_plot_dof_continuous(plot_case, potentially_continuous_plot_dof)
continuous_plot_dof = potentially_continuous_plot_dof;
dof = plot_case.(continuous_plot_dof).dof;
[min_value, max_value] = get_min_max_dof_value(evolution_data, n_input_case, dof);
[min_value, max_value] = get_visualization_min_max_dof_value(plot_case, evolution_data, n_input_case, dof);
plot_case.(potentially_continuous_plot_dof).min_value = min_value;
plot_case.(potentially_continuous_plot_dof).max_value = max_value;
end
Expand Down Expand Up @@ -587,10 +591,26 @@
bool = plot_case.(plot_dof).active;
end

function [min_value, max_value] = get_min_max_dof_value(evolution_data, n_input_case, dof)
dof_values = get_all_dof_values(evolution_data, n_input_case, dof);
min_value = min(min(dof_values));
max_value = max(max(dof_values));
function [min_value, max_value] = get_visualization_min_max_dof_value(plot_case, evolution_data, n_input_case, dof)
lineages = get_visualization_lineages(plot_case);
lineage_idx = 0;
for n_lineage = lineages
lineage = get_lineage(evolution_data, n_input_case, n_lineage);
lineage_idx = lineage_idx + 1;
num_gens = numel(lineage);
gen_idx = 0;
dof_values = [];
for n_gen = 1:num_gens
if is_mutation_successful(lineage, n_gen) || are_failed_mutations_active(plot_case)
gen_idx = gen_idx + 1;
dof_values(gen_idx) = get_dof_value(lineage, n_gen, dof);
end
end
min_values(lineage_idx) = min(dof_values);
max_values(lineage_idx) = max(dof_values);
end
min_value = min(min_values);
max_value = max(max_values);
end

function dof_values = get_all_dof_values(evolution_data, n_input_case, dof)
Expand Down

0 comments on commit 7d872a5

Please sign in to comment.