Ejemplo n.º 1
0
                           "--input",
                           type=str,
                           help="Input root",
                           required=True)
required_args.add_argument("-o",
                           "--output",
                           type=str,
                           help="Output root",
                           required=True)
args = parser.parse_args()

out_name = pyfisher.prepare_output(
    args, "save_cmb_fisher.py Planck CMB Fishers run")

param_file = f'./params.txt'
_, fids = pyfisher.get_param_info(param_file, exclude=None)

param_list = list(fids.keys())
F1 = pyfisher.get_planck_cmb_fisher(param_list,
                                    np.arange(2, 31), ['TT'],
                                    args.input,
                                    fsky=1)
F2 = pyfisher.get_planck_cmb_fisher(param_list,
                                    np.arange(30, 2501), ['TT', 'EE', 'TE'],
                                    args.input,
                                    fsky=1)

pyfisher.write_fisher(f'{out_name}_planck_low_ell_TT_fullsky.txt',
                      F1,
                      delim=',')
pyfisher.write_fisher(f'{out_name}_planck_high_ell_TTEETE_fullsky.txt',
Ejemplo n.º 2
0
import os,sys
import cobaya
import pyfisher

import argparse
# Parse command line
parser = argparse.ArgumentParser(description='Makes a mock BAO likelihood.')
parser.add_argument("exp_name", type=str,help='Positional arg. Options include boss,boss_data,desi.')
parser.add_argument("--boss-include",     type=str,  default='6df,mgs,lowz,cmass',help="A description.")
parser.add_argument("--input-path",     type=str,  default='input',help="Relative path to directory with experiment info.")
required_args = parser.add_argument_group('Required arguments')
required_args.add_argument("-o","--output",type=str,help="Output root",required=True)
required_args.add_argument("-p","--param-file",type=str,help="Parameter file",required=True)
args = parser.parse_args()

_,fids = pyfisher.get_param_info(args.param_file)

if args.exp_name!='boss_data':
    zs,sig_pers = pyfisher.load_bao_experiment_rs_dV_diagonal(args.exp_name,args.input_path,boss_include=args.boss_include.split(','))
    rs_dv = pyfisher.get_bao_rs_dV(zs,params=fids,engine='camb',de='ppf')
    err = sig_pers * rs_dv / 100.
    cov = np.diag(err**2.)
    np.savetxt(f'{args.output}_{args.exp_name}_mock_bao_covtot.txt',cov,delimiter=' ')
    print(rs_dv,cov)
    with open(f'{args.output}_{args.exp_name}_mock_bao.txt','w') as f:
        for i,z in enumerate(zs):
            f.write(f'{z:.2f} {rs_dv[i]}  rs_over_DV\n')
else:
    zs,ret = pyfisher.get_bao_dr12(params=fids,engine='camb',de='ppf')
    with open(f'{args.output}_{args.exp_name}_mock_bao.txt','w') as f:
        for i,z in enumerate(zs):
Ejemplo n.º 3
0
                           help="Output root",
                           required=True)
required_args.add_argument("-p",
                           "--param-file",
                           type=str,
                           help="Parameter file",
                           required=True)
parser.add_argument("--exclude",
                    type=str,
                    default='tau,r',
                    help="Relative path to directory with experiment info.")
args = parser.parse_args()

output_root = pyfisher.prepare_output(args, "save_s8_derivs.py s8 deriv run")
exclude = args.exclude.split(',')
jobs, fids = pyfisher.get_param_info(args.param_file, exclude, get_range=True)
shutil.copyfile(args.param_file, args.output + "/params.txt")
njobs = len(jobs)
comm, rank, my_tasks = mpi.distribute(njobs)

for task in my_tasks:
    param, pmin, pmax = jobs[task]
    print(param, pmin, pmax)

    vals = np.linspace(pmin, pmax, args.nsteps)
    s8s = []
    pl = io.Plotter(xyscale='linlin',
                    xlabel=pyfisher.latex_mapping[param],
                    ylabel=pyfisher.latex_mapping['s8'])
    for val in vals:
        pparams = dict(fids)
Ejemplo n.º 4
0
                           "--output",
                           type=str,
                           help="Output root",
                           required=True)
required_args.add_argument("-p",
                           "--param-file",
                           type=str,
                           help="Parameter file",
                           required=True)
args = parser.parse_args()

out_name = pyfisher.prepare_output(args, "save_cmb.py CMB derivatives run")

lens_exclude = args.exclude_in_lensing.split(',')
shutil.copyfile(args.param_file, args.output + "/params.txt")
jobs, fids = pyfisher.get_param_info(args.param_file, exclude=None)
njobs = len(jobs)
comm, rank, my_tasks = mpi.distribute(njobs)

for task in my_tasks:
    param, val, ptype = jobs[task]
    print(param, val, ptype)
    pparams = dict(fids)
    if param is None:
        assert val is None
        assert ptype == 'f'
    else:
        pparams[param] = val

    theory = pyfisher.get_cls(params=pparams,
                              lmax=args.lmax,