1 | // Check cmv / Wayne Hu coding of the transfert functions
|
---|
2 | #include "sopnamsp.h"
|
---|
3 | #include "machdefs.h"
|
---|
4 | #include <iostream>
|
---|
5 | #include <stdlib.h>
|
---|
6 | #include <stdio.h>
|
---|
7 | #include <string.h>
|
---|
8 | #include <math.h>
|
---|
9 | #include <unistd.h>
|
---|
10 | #include "ntuple.h"
|
---|
11 |
|
---|
12 | #include "constcosmo.h"
|
---|
13 | #include "pkspectrum.h"
|
---|
14 | #include "hu_tf_fit.h"
|
---|
15 | #include "hu_power.h"
|
---|
16 |
|
---|
17 | int main(int narg,char *arg[])
|
---|
18 | {
|
---|
19 | double k1 = 1e-6, k2 = 10.; int_4 npt = 10000;
|
---|
20 | double h100 = 0.71, Om0 = 0.267804, Ob0 = 0.0444356, tcmb = T_CMB_Par;
|
---|
21 | // Modele MDM (hu_power.c) Eisenstein & Hu Apj 511 p5-15, 1999 (ou astro-ph/9710252)
|
---|
22 | double Ohdm = 0.0, Ol0 = 0.7, redshift=0.;
|
---|
23 | int degen_hdm = 0;
|
---|
24 |
|
---|
25 | cout<<"k1="<<k1<<" k2="<<k2<<" npt="<<npt<<endl;
|
---|
26 | cout<<"h100="<<h100<<" Om0="<<Om0<<" Ob0="<<Ob0<<" Tcmb="<<tcmb<<endl;
|
---|
27 | cout<<"Om0*h^2="<<Om0*h100*h100<<" Ob0*h^2="<<Ob0*h100*h100<<endl;
|
---|
28 | double fbaryon = Ob0/Om0;
|
---|
29 | cout<<"fbaryon="<<fbaryon<<endl;
|
---|
30 |
|
---|
31 | cout<<endl<<"TFset_parameters"<<endl;
|
---|
32 | TFset_parameters(Om0*h100*h100,fbaryon,tcmb);
|
---|
33 | TFprint_parameters();
|
---|
34 | double soundfithu = TFsound_horizon_fit(Om0,fbaryon,h100)/h100;
|
---|
35 | cout<<"TFsound_horizon_fit = "<<soundfithu<<" Mpc"<<endl;
|
---|
36 |
|
---|
37 | cout<<endl<<"TransfertEisenstein with baryon"<<endl;
|
---|
38 | TransfertEisenstein Tfull(h100,Om0-Ob0,Ob0,tcmb,false,1);
|
---|
39 |
|
---|
40 | cout<<endl<<"TransfertEisenstein with baryon without oscillation approx.2"<<endl;
|
---|
41 | TransfertEisenstein Tnowig(h100,Om0-Ob0,Ob0,tcmb,false,1);
|
---|
42 | Tnowig.SetNoOscEnv(2);
|
---|
43 |
|
---|
44 | cout<<endl<<"TransfertEisenstein without baryon"<<endl;
|
---|
45 | TransfertEisenstein Tnob(h100,Om0,0.,tcmb,true,1);
|
---|
46 |
|
---|
47 | cout<<endl<<"TFmdm_set_cosm"<<endl;
|
---|
48 | int rcmdm = TFmdm_set_cosm(Om0,Ob0,Ohdm,degen_hdm,Ol0,h100,redshift);
|
---|
49 | cout<<" rc="<<rcmdm<<endl;
|
---|
50 |
|
---|
51 | cout<<endl<<"Compare kpeak"<<endl;
|
---|
52 | double kpeak = Tfull.KPeak();
|
---|
53 | double kpeakhu = TFk_peak(Om0,fbaryon,h100)*h100;
|
---|
54 | cout<<"kpeak = "<<kpeak<<" "<<kpeakhu<<" Mpc^-1 -> diff "<<kpeak-kpeakhu<<endl;
|
---|
55 |
|
---|
56 | const int n = 12;
|
---|
57 | char *vname[n] = {"k","tf","tfnw","tfnb","tfc","tfb"
|
---|
58 | ,"hutf","hutfnw","hutfnb","hutfc","hutfb"
|
---|
59 | ,"hutfmdm"};
|
---|
60 | NTuple nt(n,vname);
|
---|
61 | double xnt[n];
|
---|
62 |
|
---|
63 | double kmax[5]={0,0,0,0,0};
|
---|
64 | double tmax[5]={0.,0.,0.,0.,0.};
|
---|
65 | double lnk1 = log10(k1), lnk2=log10(k2), dlnk=(lnk2-lnk1)/npt;
|
---|
66 | for(double lnk=lnk1;lnk<lnk2+dlnk/2.;lnk+=dlnk) {
|
---|
67 | double k = pow(10.,lnk);
|
---|
68 | //if(fabs(lnk-log10(0.0186209))>1e-5) continue;
|
---|
69 | Tfull.SetReturnPart(0); double tf = Tfull(k);
|
---|
70 | double tfnw = Tnowig(k);
|
---|
71 | double tfnb = Tnob(k);
|
---|
72 | Tfull.SetReturnPart(1); double tfc = Tfull(k);
|
---|
73 | Tfull.SetReturnPart(2); double tfb = Tfull(k);
|
---|
74 | double hutfc, hutfb;
|
---|
75 | double hutf = TFfit_onek(k,&hutfb,&hutfc);
|
---|
76 | double hutfnw = TFnowiggles(Om0,fbaryon,h100,tcmb,k/h100);
|
---|
77 | double hutfnb = TFzerobaryon(Om0,h100,tcmb,k/h100);
|
---|
78 | double hutfmdm = TFmdm_onek_mpc(k);
|
---|
79 |
|
---|
80 |
|
---|
81 | if(fabs(tf-hutf)>tmax[0]) {kmax[0]=k; tmax[0]=fabs(tf-hutf);}
|
---|
82 | if(fabs(tfnw-hutfnw)>tmax[1]) {kmax[1]=k; tmax[1]=fabs(tfnw-hutfnw);}
|
---|
83 | if(fabs(tfnb-hutfnb)>tmax[2]) {kmax[2]=k; tmax[2]=fabs(tfnb-hutfnb);}
|
---|
84 | if(fabs(tfc-hutfc)>tmax[3]) {kmax[3]=k; tmax[3]=fabs(tfc-hutfc);}
|
---|
85 | if(fabs(tfb-hutfb)>tmax[4]) {kmax[4]=k; tmax[4]=fabs(tfb-hutfb);}
|
---|
86 |
|
---|
87 | xnt[0]=k;
|
---|
88 | xnt[1]=tf; xnt[2]=tfnw; xnt[3]=tfnb; xnt[4]=tfc; xnt[5]=tfb;
|
---|
89 | xnt[6]=hutf; xnt[7]=hutfnw; xnt[8]=hutfnb; xnt[9]=hutfc; xnt[10]=hutfb;
|
---|
90 | xnt[11] = hutfmdm;
|
---|
91 | nt.Fill(xnt);
|
---|
92 | }
|
---|
93 |
|
---|
94 | cout<<"Maximum difference for:"<<endl;
|
---|
95 | cout<<"tf: "<<tmax[0]<<" for k="<<kmax[0]<<endl;
|
---|
96 | cout<<"tfnw: "<<tmax[1]<<" for k="<<kmax[1]<<endl;
|
---|
97 | cout<<"tfnb: "<<tmax[2]<<" for k="<<kmax[2]<<endl;
|
---|
98 | cout<<"tfc: "<<tmax[3]<<" for k="<<kmax[3]<<endl;
|
---|
99 | cout<<"tfb: "<<tmax[4]<<" for k="<<kmax[4]<<endl;
|
---|
100 |
|
---|
101 | cout<<">>>> Ecriture"<<endl;
|
---|
102 | string tag = "cmvchkwhu.ppf";
|
---|
103 | POutPersist pos(tag);
|
---|
104 | tag = "nt"; pos.PutObject(nt,tag);
|
---|
105 |
|
---|
106 | return 0;
|
---|
107 | }
|
---|
108 |
|
---|
109 | /*
|
---|
110 | openppf cmvchkwhu.ppf
|
---|
111 |
|
---|
112 | set k k
|
---|
113 | set k log10(k)
|
---|
114 |
|
---|
115 | ######################
|
---|
116 | zone 3 1
|
---|
117 | n/plot nt.tf%$k ! ! "nsta connectpoints"
|
---|
118 | n/plot nt.hutf%$k ! ! "nsta connectpoints red same"
|
---|
119 | n/plot nt.tfc%$k ! ! "nsta connectpoints"
|
---|
120 | n/plot nt.hutfc%$k ! ! "nsta connectpoints red same"
|
---|
121 | n/plot nt.tfb%$k ! ! "nsta connectpoints"
|
---|
122 | n/plot nt.hutfb%$k ! ! "nsta connectpoints red same"
|
---|
123 | zone 2 1
|
---|
124 | n/plot nt.tfnw%$k ! ! "nsta connectpoints"
|
---|
125 | n/plot nt.hutfnw%$k ! ! "nsta connectpoints red same"
|
---|
126 | n/plot nt.tfnb%$k ! ! "nsta connectpoints"
|
---|
127 | n/plot nt.hutfnb%$k ! ! "nsta connectpoints red same"
|
---|
128 |
|
---|
129 | ######################
|
---|
130 | zone 3 1
|
---|
131 | n/plot nt.tf-hutf%$k ! ! "nsta connectpoints"
|
---|
132 | n/plot nt.tfc-hutfc%$k ! ! "nsta connectpoints"
|
---|
133 | n/plot nt.tfb-hutfb%$k ! ! "nsta connectpoints"
|
---|
134 | zone 2 1
|
---|
135 | n/plot nt.tfnw-hutfnw%$k ! ! "nsta connectpoints"
|
---|
136 | n/plot nt.tfnb-hutfnb%$k ! ! "nsta connectpoints"
|
---|
137 |
|
---|
138 | zone 3 1
|
---|
139 | n/plot nt.(tf-hutf)/hutf%$k ! ! "nsta connectpoints"
|
---|
140 | n/plot nt.(tfc-hutfc)/hutfc%$k ! ! "nsta connectpoints"
|
---|
141 | n/plot nt.(tfb-hutfb)/hutfb%$k ! ! "nsta connectpoints"
|
---|
142 | zone 2 1
|
---|
143 | n/plot nt.(tfnw-hutfnw)/hutfnw%$k ! ! "nsta connectpoints"
|
---|
144 | n/plot nt.(tfnb-hutfnb)/hutfnb%$k ! ! "nsta connectpoints"
|
---|
145 |
|
---|
146 | ######################
|
---|
147 | zone
|
---|
148 | n/plot nt.tf%$k ! ! "nsta connectpoints"
|
---|
149 | n/plot nt.tfnw%$k ! ! "nsta connectpoints red same"
|
---|
150 | n/plot nt.tfnb%$k ! ! "nsta connectpoints blue same"
|
---|
151 | n/plot nt.hutfmdm%$k ! ! "nsta connectpoints green same"
|
---|
152 |
|
---|
153 | zone
|
---|
154 | n/plot nt.tf/tfnw%$k tfnw>0. ! "nsta connectpoints"
|
---|
155 | n/plot nt.hutf/hutfnw%$k hutfnw>0. ! "nsta connectpoints same blue"
|
---|
156 | addline -1000 1 1000 1 "red"
|
---|
157 | */
|
---|