Exemplo n.º 1
0
def test_parents_and_ratios():
    xs = [x for x in np.arange(1, 10, 2)]

    ys = np.arange(1, 5, 1)

    gi.set_parameters({
        'a': 0,
        'p': 0,
        't': 1,
        'generations': generations,
        'tests': 200
    })

    patches = []
    colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k', 'w']

    # for 2d graph with multiple lines
    counter = 0
    for y in ys:
        zs = [gi.S_value(x, y) for x in xs]
        plt.plot(xs, zs, color=colors[counter])
        patches.append(mpatches.Patch(color=colors[counter], label=str(y)))
        counter += 1

    plt.legend(title='trait ratio', handles=patches, loc='lower right')

    plt.savefig("S_values(tests=200)")

    sys.exit()
Exemplo n.º 2
0
def test_ratio(parents, ratio, tests):
    gi.set_parameters({
        'a': 0,
        'p': 0,
        't': 1,
        'generations': generations,
        'generations_sizes': generations_sizes
    })

    gi.plot_percents(parents, ratio, tests)
Exemplo n.º 3
0
def test_ratios(parents_range, ratio_range, tests):
    gi.set_parameters({
        'a': 0,
        'p': 0,
        't': 1,
        'generations': generations,
        'generations_sizes': generations_sizes
    })

    for p in parents_range:
        for r in ratio_range:
            test_ratio(p, r, tests)

    gi.savefig("outputs/ratios/traittakeover.png")
Exemplo n.º 4
0
def test_ratios_rising(parents, ratio_range, tests):
    gi.set_parameters({
        'a': 0,
        'p': 0,
        't': 1,
        'balanced': False,
        'initial_counts': [1, 19],
        'generations': generations,
        'generations_sizes': generations_sizes
    })

    for r in ratio_range:
        test_ratio(parents, r, tests)

    # gi.plot_log_regressions(parents,ratio_range)
    gi.plot_exp_regressions(parents, ratio_range)

    gi.legend()

    gi.savefig('outputs/ratios/trait_takeover_rising(parents=' + str(parents) +
               ').png')
Exemplo n.º 5
0
tests = 500
generations = 2
generations_sizes = 10
a = 0
p = 0
t = 1

parents_range = [1, 2, 3, 4, 5, 6, 7, 8, 9]
ratio = 2

ratio_range = range(ratio, ratio + 1)

gi.set_parameters({
    'a': a,
    'p': p,
    't': t,
    'generations': generations,
    'generations_sizes': generations_sizes,
    'balanced': True
})

gi.calc_smoothed_percents_range(parents_range, ratio_range, tests)
# # gi.calc_exp_regressions(parents_range,ratio_range)
gi.calc_first_slopes(parents_range, ratio_range)

gi.initfig()

# gi.plot_d0s_parents(parents_range,ratio,"linear")
gi.plot_first_slopes_parents(parents_range, ratio, "quadratic")

gi.savefig(
    "outputs/parents/evolutionrate/evolutionrate_parents_singletrait.png")