mc_lognormal_traces = save_traces(
        mc_lognormal,
        trace_data_path +
        "mc_lognormal_withmach_traces%s_opr%s.fits" % (abundance, opr),
        clobber=True)
    print "\nlognormal (freemach) sampling 1 million"
    mc_lognormal_freemach.sample(1e6)
    mc_lognormal_freemach_traces = save_traces(
        mc_lognormal_freemach,
        trace_data_path +
        "mc_lognormal_freemach_traces%s_opr%s.fits" % (abundance, opr),
        clobber=True)

    docontours_all(mc_lognormal, mc_simple, mc_lognormal_freemach)

lognormal_statstable = pymc_tools.stats_table(mc_lognormal)
lognormal_statstable.write(
    trace_data_path +
    'lognormal_statstable_abundance%s_opr%s.fits' % (abundance, opr),
    overwrite=True)
lognormal_simple_statstable = pymc_tools.stats_table(mc_simple)
lognormal_simple_statstable.write(
    trace_data_path +
    'lognormal_simple_statstable_abundance%s_opr%s.fits' % (abundance, opr),
    overwrite=True)
lognormal_freemach_statstable = pymc_tools.stats_table(mc_lognormal_freemach)
lognormal_freemach_statstable.write(
    trace_data_path +
    'lognormal_freemach_statstable_abundance%s_opr%s.fits' % (abundance, opr),
    overwrite=True)
#    pymc_plotting.hist2d(mc_hopkins_simple, p1, p2, bins=30, clear=True, fignum=fignum+fignum2+1, varslice=varslice, colorbar=True)
#    pl.title("Hopkins - just $\\tau$ fits")
#    pl.savefig(savepath+"HopkinsJustTau_%s_v_%s_mcmc.png" % (p1,p2))

print "Some statistics used in the paper: "
print "mc_hopkins_simple   sigma: ", mc_hopkins_simple.stats()["sigma"]["quantiles"]
print "mc_hopkins          sigma: ", mc_hopkins.stats()["sigma"]["quantiles"]
print "mc_hopkins          Tval: ", mc_hopkins.stats()["Tval"]["quantiles"]
print "mc_hopkins          b: ", mc_hopkins.stats(quantiles=(0.1, 1, 2.5, 5, 50))["b"]["quantiles"]
print "mc_hopkins          m: ", mc_hopkins.stats()["mach_mu"]["quantiles"]
print "mc_hopkins_freemach sigma: ", mc_hopkins_freemach.stats()["sigma"]["quantiles"]
print "mc_hopkins_freemach Tval: ", mc_hopkins_freemach.stats()["Tval"]["quantiles"]
print "mc_hopkins_freemach b: ", mc_hopkins_freemach.stats(quantiles=(0.1, 1, 2.5, 5, 50))["b"]["quantiles"]
print "mc_hopkins_freemach m: ", mc_hopkins_freemach.stats()["mach"]["quantiles"]

hopkins_statstable = pymc_tools.stats_table(mc_hopkins)
hopkins_statstable.write(
    trace_data_path + "hopkins_statstable_abundance%s_opr%s.fits" % (abundance, opr), overwrite=True
)
hopkins_simple_statstable = pymc_tools.stats_table(mc_hopkins_simple)
hopkins_simple_statstable.write(
    trace_data_path + "hopkins_simple_statstable_abundance%s_opr%s.fits" % (abundance, opr), overwrite=True
)
hopkins_freemach_statstable = pymc_tools.stats_table(mc_hopkins_freemach)
hopkins_freemach_statstable.write(
    trace_data_path + "hopkins_freemach_statstable_abundance%s_opr%s.fits" % (abundance, opr), overwrite=True
)


pl.figure(32)
pl.clf()