def bomze_figures(N=60, beta=1, process="incentive", directory=None): """ Makes plots of the stationary distribution and expected divergence for each of the plots in Bomze's classification. """ if not directory: directory = "bomze_paper_figures_%s" % process ensure_directory(directory) for i, m in enumerate(bomze_matrices()): mu = 3. / 2 * 1. / N fitness_landscape = linear_fitness_landscape(m) incentive = fermi(fitness_landscape, beta=beta) edges = incentive_process.multivariate_transitions(N, incentive, num_types=3, mu=mu) d1 = stationary_distribution(edges) filename = os.path.join(directory, "%s_%s_stationary.eps" % (i, N)) figure, tax = ternary.figure(scale=N) tax.heatmap(d1) tax.savefig(filename=filename) pyplot.close(figure) for q_d in [0., 1.]: d2 = expected_divergence(edges, q_d=q_d) filename = os.path.join(directory, "%s_%s_%s.eps" % (i, N, q_d)) figure, tax = ternary.figure(scale=N) tax.heatmap(d2) tax.savefig(filename=filename) pyplot.close(figure)
def bomze_figures(N=60, beta=1, process="incentive", directory=None): """ Makes plots of the stationary distribution and expected divergence for each of the plots in Bomze's classification. """ if not directory: directory = "bomze_paper_figures_%s" % process ensure_directory(directory) for i, m in enumerate(bomze_matrices()): mu = 3./2 * 1./N fitness_landscape = linear_fitness_landscape(m) incentive = fermi(fitness_landscape, beta=beta) edges = incentive_process.multivariate_transitions(N, incentive, num_types=3, mu=mu) d1 = stationary_distribution(edges) filename = os.path.join(directory, "%s_%s_stationary.eps" % (i, N)) figure, tax = ternary.figure(scale = N) tax.heatmap(d1) tax.savefig(filename=filename) pyplot.close(figure) for q_d in [0., 1.]: d2 = expected_divergence(edges, q_d=q_d) filename = os.path.join(directory, "%s_%s_%s.eps" % (i, N, q_d)) figure, tax = ternary.figure(scale = N) tax.heatmap(d2) tax.savefig(filename=filename) pyplot.close(figure)
def test_bomze_matrices(): """ Check that the data file with the Bomze classification matrices is present and loads the correct number of matrices. """ matrices = list(bomze_matrices()) assert_equal(len(matrices), 49)