def saveLikelihoodToText(rlist, logLike, field, exp='bicep1'):

    if exp == 'bicep1':
        print "### Saving Likelihood to file: B1_logLike.txt..."
        f = open("B1_logLike.txt", "w")
        f.write('# BICEP1 likelihood for r \n')
        f.write('# Based on data from:  Barkats et al, Degree Scale CMB Polarization Measurements from Three Years of BICEP1 Data \n')
        f.write('# Available at http://bicep.rc.fas.harvard.edu/bicep1_3yr/ \n')
        f.write('# This text file contains the tabulated likelihood for the tensor-to-scalar ratio, r, derived from the BICEP1 %s spectrum. \n'%field)
        f.write('# Calculated via the "Hamimeche-Lewis likelihood" method described in Section 9.1 of Barkats et al. \n')
        f.write('# This file is generated from a standalone python module: b1_r_wrapper.py \n')
        f.write('# This likelihood curve corresponds to the blue curve from the left-hand panel of Figure 10 from Barkats et al. \n')
        f.write('# \n')
        f.write('# Columns:  r, logLiklelihood(r) \n')
    elif exp == 'bicep2':
        print "### Saving Likelihood to file: B2_logLike.txt..."
        f = open("B2_logLike.txt", "w")
        f.write('# BICEP2 likelihood\n')
        f.write('# Based on data from: DETECTION OF B-mode POLARIZATION AT DEGREE SCALES USING BICEP2 \n')
        f.write('# Available at  http://www.bicepkeck.org/bicep2_2014_release/ \n')
        f.write('# This text file contains the tabulated likelihood derived from the BICEP2 %s spectrum. \n'%field)
        f.write('# Calculated via the "Hamimeche-Lewis likelihood" method described in Sectiox [specify seciotn and paper title/author here.] \n')
        f.write('# This file is generated from a standalone python module: bicep_r_wrapper.py \n')
        f.write('# \n')
        f.write('# Columns:  r, logLiklelihood(r) \n')

    for i in range(0,len(rlist)):
        f.write('%6.3f %6.4e \n'%(rlist[i],logLike[i]))
    f.close()


#####################################################################
#  This function loads:
#   - the bandpower data products (C_fl, C_l_hat, N_l),
#   - the covariance matrix and processes it to output the inverse
#   - the bandpower window functions
#
dataset/ETHPy150Open baudren/montepython_public/montepython/likelihoods/bicep2/bicep_util.py/saveLikelihoodToText/original