Esempio n. 1
0
pyapemost.set_function(myloglike, myprior)

if len(sys.argv) < 2:
	#print "SYNAPSIS: %s [calibrate|run|analyse]" % sys.argv[0]
	cmd = ["calibrate", "run", "analyse"]
else:
	cmd = sys.argv[1:]

if "calibrate" in cmd:
	pyapemost.calibrate()
# run APEMoST
if "run" in cmd:
	w = pyapemost.watch.ProgressWatcher()
	w.start()
	pyapemost.run(max_iterations = 10000, append = False)
	w.stop()

# lets analyse the results
if "analyse" in cmd:
	plotter = pyapemost.analyse.VisitedAllPlotter()
	plotter.plot()
	show("chain0.pdf")
	histograms = pyapemost.create_histograms()
	i = 1
	plt.clf()
	plt.figure(figsize=(7, 4 * len(histograms)))
	for k,(v,stats) in histograms.iteritems():
		plt.subplot(len(histograms), 1, i)
		plt.plot(v[:,0], v[:,2], ls='steps--', label=k)
		plt.legend()
Esempio n. 2
0
pyapemost.set_function(myloglike, myprior)

if len(sys.argv) < 2:
    #print "SYNAPSIS: %s [calibrate|run|analyse]" % sys.argv[0]
    cmd = ["calibrate", "run", "analyse"]
else:
    cmd = sys.argv[1:]

if "calibrate" in cmd:
    pyapemost.calibrate()
# run APEMoST
if "run" in cmd:
    w = pyapemost.watch.ProgressWatcher()
    w.start()
    pyapemost.run(max_iterations=10000, append=False)
    w.stop()

# lets analyse the results
if "analyse" in cmd:
    plotter = pyapemost.analyse.VisitedAllPlotter()
    plotter.plot()
    show("chain0.pdf")
    histograms = pyapemost.create_histograms()
    i = 1
    plt.clf()
    plt.figure(figsize=(7, 4 * len(histograms)))
    for k, (v, stats) in histograms.items():
        plt.subplot(len(histograms), 1, i)
        plt.plot(v[:, 0], v[:, 2], ls='steps--', label=k)
        plt.legend()
Esempio n. 3
0
    return prob


pyapemost.set_function(myloglike, myprior)

if len(sys.argv) < 2:
    # print "SYNAPSIS: %s [calibrate|run|analyse]" % sys.argv[0]
    cmd = ["calibrate", "run", "analyse"]
else:
    cmd = sys.argv[1:]

if "calibrate" in cmd:
    pyapemost.calibrate()
# run APEMoST
if "run" in cmd:
    pyapemost.run(max_iterations=100000)


# lets analyse the results
if "analyse" in cmd:
    import matplotlib.pyplot as plt

    histograms = pyapemost.create_histograms()
    i = 1
    for k, (v, stats) in histograms.iteritems():
        plt.subplot(len(histograms), 1, i)
        plt.plot(v[:, 0], v[:, 2], ls="steps--", label=k)
        plt.legend()
        print k, stats
        i = i + 1
    plt.show()