Esempio n. 1
0
        #plt.plot(pipe.timeslices, pipe.pressure_drop, "o-")
        if i in [1, 9, 11, 19, 25, 41]:
            plt.plot(pipe_tmp.mesh,
                     pipe_tmp.lambda_avg,
                     linestyle=linestyles[counter % len(linestyles)],
                     label="$N=" + str(i / 2) + "$")
            counter += 1

    plt.legend(loc="best", prop={'size': 16}, frameon=False)
    plt.yticks(fontsize=20)
    plt.xticks(fontsize=20)
    plt.xlabel("$x$", fontsize=24)
    plt.ylabel("$\lambda^N(x)$", fontsize=24)
    plt.tight_layout()
    plt.savefig("results/figure_fric_bump.pgf")
    plt.show()

    # clean memory
    collect()

    pipe.info()
    ### instantiate an MCMC sampler
    mcmc = MCMC(density, proposal_density, draw_from_proposal,
                initial_point_mcmc)

    # run the MCMC sample
    mcmc.run(max_iter=200000, burning=5000)
    # write the samples into a file
    mcmc.write(filename, write_prob=True)
Esempio n. 2
0
    # pipe.get_presure_drop(inplace=True)
    # plt.plot(pipe.timeslices, pipe.pressure_drop, "-x")
    # #plt.plot(pipe_true.timeslices, pipe_true.pressure_drop, "-o")
    # #plt.plot(y_obs_times, y_obs, "-o")
    # plt.plot(pipe.timeslices, EvalY_obs(pipe.timeslices), "-*")
    # plt.show(block=False)

    for i in range(0, 11):
        if i % 10 == 1:
            pipe = SemiLinSystem(c_sound, t_final, x_l, x_r, dx, expan_coef,
                                 boundary_eps)
            pipe.info()
            mcmc = MCMC(density, proposal_density, draw_from_proposal,
                        initial_point_mcmc)
            mcmc.run(2000, burning=500)
            mcmc.write("samples" + str(i))
            samples[dx] = mcmc.density_samples
        dx += 0.0001

        gc.collect()  # collect un-used objects

    # plt.legend(loc=2, borderaxespad=0.0)
    # plt.show(block=False)

    # Samples = {}
    # for idx in samples:
    #     Samples[idx] = []
    #     for point in samples[idx]:
    #         Samples[idx].append(point[0])

    # for idx in Samples: