Changeset 3318 in Sophya for trunk/Cosmo/SimLSS/cmvtransf.cc


Ignore:
Timestamp:
Aug 28, 2007, 11:41:49 AM (18 years ago)
Author:
cmv
Message:

TransfertTabulate pour avoir les fct de transfert de CMBFast cmv 28/08/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/SimLSS/cmvtransf.cc

    r3115 r3318  
    1414
    1515void usage(void);
    16 void usage(void) {cout<<"cmvtuniv [k1,k2,npt] [h100,Om0,Ob0,tcmb]"<<endl;}
     16void usage(void) {
     17cout
     18<<"cmvtransf [options]"<<endl
     19<<"  -k k1,k2,npt : k range in Mpc^-1"<<endl
     20<<"  -U h100,Om0,Ob0,tcmb : cosmology"<<endl
     21<<"  -F filename : read also CMBFast file"<<endl
     22<<endl;
     23}
    1724
    1825int main(int narg,char *arg[])
     
    2027 double k1 = 1e-6, k2 = 10.; int_4 npt = 100;
    2128 double h100 = 0.71, Om0 = 0.267804, Ob0 = 0.0444356, tcmb = T_CMB_Par;
     29 string fcmbfast = "";
    2230
    23  if(narg>1) sscanf(arg[1],"%lf,%lf,%d",&k1,&k2,&npt);
     31 char c;
     32  while((c = getopt(narg,arg,"hk:U:F:")) != -1) {
     33  switch (c) {
     34  case 'k' :
     35    sscanf(optarg,"%d,%lf,%lf",&npt,&k1,&k2);
     36    break;
     37  case 'U' :
     38    sscanf(optarg,"%lf,%lf,%lf,%lf",&h100,&Om0,&Ob0,&tcmb);
     39    break;
     40  case 'F' :
     41    fcmbfast = optarg;
     42    break;
     43  case 'h' :
     44  default :
     45    usage(); return -1;
     46  }
     47 }
     48
    2449 if(k1<=0.) {cout<<"k1 must be >0"<<endl; return -1;}
    25  if(npt<=0) npt = 100;
     50 if(npt<=0) npt = 1000;
     51 if(k2<=k1) {k1=1.e-4; k2=1.e+2;}
    2652 cout<<"k1="<<k1<<"  k2="<<k2<<" npt="<<npt<<endl;
    27  if(narg>2) sscanf(arg[2],"%lf,%lf,%lf,%lf",&h100,&Om0,&Ob0,&tcmb);
    2853 cout<<"h100="<<h100<<" Om0="<<Om0<<" Ob0="<<Ob0<<" Tcmb="<<tcmb<<endl;
     54 cout<<"fcmbfast="<<fcmbfast<<endl;
    2955
    3056 cout<<"TransfertEisenstein with baryon"<<endl;
     
    4369 TransfertEisenstein tfnob(h100,Om0-Ob0,Ob0,tcmb,true);  // No baryons
    4470
    45  const int n = 5;
    46  char *vname[n] = {"k","t","tnosc1","tnosc2","tnob"};
     71 TransfertTabulate tfcmbfast(h100,Om0-Ob0,Ob0);
     72 bool cmbfastOK = false;
     73 if(fcmbfast.size()>0) {
     74   cout<<endl<<"TransfertTabulate for CMBfast"<<endl;
     75   tfcmbfast.ReadCMBFast(fcmbfast);
     76   tfcmbfast.SetInterpTyp(1);
     77   if(tfcmbfast.NPoints()>0) cmbfastOK = true;
     78 }
     79
     80 const int n = 6;
     81 char *vname[n] = {"k","t","tnosc1","tnosc2","tnob","tcmbf"};
    4782 NTuple nt(n,vname);
    4883 double xnt[n];
     84 for(int i=0;i<n;i++) xnt[i]=0.;
    4985
    5086 double lnk1 = log10(k1), lnk2=log10(k2), dlnk=(lnk2-lnk1)/npt;
     
    5692   xnt[3]  = tfnosc2(k);
    5793   xnt[4]  = tfnob(k);
     94   if(cmbfastOK) xnt[5]  = tfcmbfast(k);
    5895   nt.Fill(xnt);
    5996 }
     
    73110set k log10(k)
    74111
    75 n/plot nt.t%$k ! ! "nsta crossmarker3"
    76 n/plot nt.tnob%$k ! ! "nsta red crossmarker3 same"
    77 n/plot nt.tnosc1%$k ! ! "nsta blue circlemarker3 same"
    78 n/plot nt.tnosc2%$k ! ! "nsta green trianglemarker3 same"
     112# Eisenstein
     113n/plot nt.t%$k ! ! "nsta connectpoints"
     114n/plot nt.tnob%$k ! ! "nsta red same connectpoints"
     115n/plot nt.tnosc2%$k ! ! "nsta blue same connectpoints"
     116n/plot nt.tnosc1%$k ! ! "nsta green same connectpoints"
    79117
    80 n/plot nt.t/tnosc1%$k ! ! "nsta crossmarker3"
    81 n/plot nt.t/tnosc2%$k ! ! "nsta crossmarker3 red same"
     118n/plot nt.t/tnob%$k   tnob>0   ! "nsta red connectpoints"
     119n/plot nt.t/tnosc2%$k tnosc2>0 ! "nsta blue same connectpoints"
     120n/plot nt.t/tnosc1%$k tnosc1>0 ! "nsta green same connectpoints"
     121
     122# CMBFast
     123n/plot nt.t%$k ! ! "nsta connectpoints"
     124n/plot nt.tcmbf%$k ! ! "nsta red same connectpoints"
     125
     126n/plot nt.(tcmbf-t)%$k tcmbf>0. ! "nsta connectpoints"
     127n/plot nt.(tcmbf-t)/tcmbf%$k tcmbf>0. ! "nsta connectpoints"
    82128*/
Note: See TracChangeset for help on using the changeset viewer.