Exemple #1
0
    def test_prob_coal2(self):

        outdir = 'test/tmp/test_coal/Coal_test_prob_coal2/'
        make_clean_dir(outdir)

        k = 2
        n = 1000
        p = Gnuplot()
        p.enableOutput(False)
        p.plotfunc(lambda t: coal.prob_coal(t, k, n), 0, 4000, 10,
                   ymin=0)

        # draw single coal samples
        x = [coal.sample_coal(k, n) for i in xrange(200)]
        plotdistrib(x, 40, plot=p)
        p.enableOutput(True)
        p.save(outdir + 'plot.png')

        eq_sample_pdf(x, lambda t: coal.prob_coal(t, k, n), 40)
Exemple #2
0
    def test_sample_bounded_coal(self):
        n = 1000
        k = 5
        T = 500

        d = [coal.sample_bounded_coal(k, n, T) for i in xrange(2000)]

        p = plotdistrib(d, 40)
        p.plotfunc(lambda t: coal.prob_bounded_coal(t, k, n, T), 0, T, T/200)

        eq_sample_pdf(d, lambda t: coal.prob_bounded_coal(t, k, n, T), 40)