lv_main.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:epsilon_free_inference 作者: gpapamak 项目源码 文件源码
def test_LotkaVolterra(savefile=None):
    """
    Runs and plots a single simulation of the lotka volterra model.
    """

    params = true_params
    #params = sim_prior_params()

    lv = mjp.LotkaVolterra(init, params)
    states = lv.sim_time(dt, duration)
    times = np.linspace(0.0, duration, int(duration / dt) + 1)

    sum_stats = calc_summary_stats(states)
    print sum_stats

    fontsize = 20
    if savefile is not None:
        matplotlib.rcParams.update({'font.size': fontsize})
        matplotlib.rc('text', usetex=True)
        savepath = '../nips_2016/figs/lv/'

    fig = plt.figure()
    plt.plot(times, states[:, 0], lw=3, label='Predators')
    plt.plot(times, states[:, 1], lw=3, label='Prey')
    plt.xlabel('Time')
    plt.ylabel('Population counts')
    plt.ylim([0, 350])
    #plt.title('params = {0}'.format(params))
    plt.legend(loc='upper right', handletextpad=0.5, labelspacing=0.5, borderaxespad=0.5, handlelength=2.0, fontsize=fontsize)
    plt.show(block=False)
    if savefile is not None: fig.savefig(savepath + savefile + '.pdf')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号