Bug fix by Jason Dossett for existing (SDSS) BAO likelihood in 07(08)/11 version of CosmoMC: Cause: If not using a likelihood that calls get_cls in calclike, inithermo is never run and z_drag is never calculated. This causes the BAO likelihood to blow up: Fix: 1.) In camb/cmbmain.f90: added InitVars to the list of public routines. 2.) In sources/calclike.f90: added the following lines to the declarations in the function GetLogLikePost: use cambmain, only: initvars use Camb, only: CAMBParams_Set type(CAMBParams) P changed the following lines: else if (Use_SN) GetLogLikePost = GetLogLikePost + SN_LnLike(CMB) if (Use_BAO) GetLogLikePost = GetLogLikePost + BAO_LnLike(CMB) if (Use_HST) GetLogLikePost = GetLogLikePost + HST_LnLike(CMB) end if to: else if (Use_SN) GetLogLikePost = GetLogLikePost + SN_LnLike(CMB) if (Use_BAO)then !JD had to change below so new BAO will work without CMB !previous way z_drag was not calculated without calling get_cls. if (RecomputeTransfers(CMB, Info%LastParams)) then call CMBToCAMB(CMB, P) call CAMBParams_Set(P) call InitVars Info%Theory%BAO_loglike = Bao_lnLike(CMB) Info%LastParams = CMB end if GetLogLikePost = GetLogLikePost + Info%Theory%BAO_loglike end if if (Use_HST) GetLogLikePost = GetLogLikePost + HST_LnLike(CMB) end if With these changes in place the existing BAO likelihood will work even when not using CMB or another dataset that requires a call to get_cls. ################################################################################ New BAO likelihood code to use multiple BAO data sets including the new WiggleZ Dark energy survey BAO measurements from Blake et al arXiv:1108.2635, and the SDSS DR7 bao measurements of Percival et al. arXiv:0907.1660 with corrections to rs from Hamann et al., arXiv:1003.3999. By Jason Dossett ################################################################################ Use: Each .dataset file contains settings and filenames for a bao dataset, these inclue: name = ; type_bao = This is given an integer value and specifies the type of bao measurement the data set uses. Currently the only options allowed are: 1-for rs/D_V measurments and 2-for A(z) (acoustic parameter) measurements More options can be added later and modifications to the likelihood code would be necessary; num_bao = The number of data points in the data set bao_measurements_file = The file that contains the bao measurement currently in the form: z measurement If the file is in the your data directory start the file name with %DATASETDIR% per the usual convention in CosmoMC; bao_invcov_file = the inverse covariance matrix file for your bao data, named in same way as bao_measurements file To use select bao data sets use the following format in the params.ini file as is usual in CosmoMC: #filenames for BAO data sets bao_numdatasets = 2 bao_dataset1 = data/wigglez_bao.dataset bao_dataset2 = data/sdss_bao.dataset Changes to cosmoMC to implement new BAO likelihood: 1.) Added bug fix above 2.) New sources/bao.f90 has structure for reading multiple datasets based upon mpk.f90.It takes snippits of code from the existing bao.f90 and adds new lines as well. 3.) Added the following files to data/: #These files are for the existing BAO data sdss_bao_invcov.txt sdss_bao.txt sdss_bao.dataset #These files are for the new WiggleZ data wigglez_BAO_invcov.txt wigglez_BAO.txt wigglez_bao.dataset 4.) In driver.f90: Added the following lines to the declarations: integer numbaosets character(LEN=Ini_max_string_len) bao_filename(100) Below the lines: nummpksets = Ini_Read_Int('mpk_numdatasets',0) if (Use_mpk) then do i= 1, nummpksets mpk_filename(i) = ReadIniFileName(DefIni,numcat('mpk_dataset',i)) call ReadMpkDataset(mpk_filename(i)) end do if (Feedback>1) write(*,*) 'read mpk datasets' end if the following lines were added: !JD copied mpk structure above for new bao likelihood file. numbaosets = Ini_Read_Int('bao_numdatasets',0) if (Use_BAO) then do i= 1, numbaosets bao_filename(i) = ReadIniFileName(DefIni,numcat('bao_dataset',i)) call ReadBaoDataset(bao_filename(i)) end do if (Feedback>1) write(*,*) 'read bao datasets' end if Removed the lines: if(Use_BAO .and. use_dr7lrg) & call MpiStop('DR7 LRG and BAO are based on the same dataset. You cannot use both.') This line is no longer needed because bao.f90 ignores the sdss bao data if if the dr7lrg mpk is used. 5.) In the Makefile, because the new bao.f90 uses mpk.f90 we reordered the OBJFILES: Formerly: bao.o lrggettheory.o mpk.o supernovae.o Now: lrggettheory.o mpk.o bao.o supernovae.o New build rules as well: Formerly: bbn.o: settings.o bao.o: cmbtypes.o mpk.o: cmbtypes.o lrggettheory.o Now: bbn.o: settings.o mpk.o: cmbtypes.o lrggettheory.o bao.o: cmbtypes.o mpk.o 6.)Added the following lines to params.ini #filenames for BAO data sets bao_numdatasets = 2 bao_dataset1 = data/wigglez_bao.dataset bao_dataset2 = data/sdss_bao.dataset