Beispiel #1
0
def plot_chain(folder, name_tag):
    files = glob.glob(folder + "*__*.txt")
    params = glob.glob(folder + "*_.paramnames")

    datalist = []
    for f in files:
        datalist.append(loadMCMC(f, params[0]))

    data = astropy.table.vstack(datalist)
    data_sim = data[:]
    weights_act = data['acceptance'][:]
    for col in [
            'likelihood', 'acceptance', 'omega_b', 'omega_cdm', '100theta_s',
            'tau_reio'
    ]:
        data.remove_column(col)
    if 'A_planck' in data.colnames:
        data.remove_column('A_planck')
    nparr_act = np.array(data.as_array().tolist()[:])
    return MCSamples(samples=nparr_act,
                     names=data.colnames,
                     labels=data.colnames,
                     name_tag=name_tag)
import numpy as np
import matplotlib.pyplot as plt
import astropy
from loadMontePython import load as loadMCMC
import glob

basedir = '../chains/nonzero_model/'
#"/home/zequnl/Projects/isocurvature_2017/analysis/plot_triangle/nonzero/"

## F
folder = basedir + 'fF/'
files = glob.glob(folder + "*__*.txt")
params = glob.glob(folder + "*_.paramnames")
datalist = []
for f in files:
    datalist.append(loadMCMC(f, params[0]))
data = astropy.table.vstack(datalist)
data_sim = data[:]
weights_act = data['acceptance'][:]
for col in [
        'likelihood', 'acceptance', 'omega_b', 'omega_cdm', '100theta_s',
        'tau_reio'
]:
    data.remove_column(col)
nparr_act = np.array(data.as_array().tolist()[:])
pixie_s4 = MCSamples(samples=nparr_act,
                     names=data.colnames,
                     labels=data.colnames,
                     name_tag='PIXIE low_l + S4')

## G
import matplotlib
from getdist import plots, MCSamples

import getdist

import numpy as np
import matplotlib.pyplot as plt
import astropy
from loadMontePython import load as loadMCMC
import glob

basedir = '../chains/nonzero_model/'
#"/home/zequnl/Projects/isocurvature_2017/analysis/plot_triangle/nonzero/"

burnin = 1000
data1 = loadMCMC('../chains/planckdata/r1.txt', '../chains/planckdata/param')
data2 = loadMCMC('../chains/planckdata/r2.txt', '../chains/planckdata/param')
data = astropy.table.vstack([data1[burnin:], data2[burnin:]])
data_planck = data[:]
weights_planck = data['acceptance'][:]
for col in [
        'likelihood', 'acceptance', 'omega_b', 'omega_cdm', '100theta_s',
        'tau_reio'
]:
    data.remove_column(col)

nparr_planck = np.array(data.as_array().tolist()[:])
planck = MCSamples(samples=nparr_planck,
                   names=data.colnames,
                   labels=data.colnames,
                   name_tag='Planck')