Changeset 3805 in Sophya for trunk/Cosmo/SimLSS/cmvtstpk.cc


Ignore:
Timestamp:
Jul 24, 2010, 12:01:34 AM (15 years ago)
Author:
cmv
Message:

Refonte totale de la structure des classes InitialSpectrum, TransfertFunction, GrowthFactor, PkSpectrum et classes tabulate pour lecture des fichiers CAMB, cmv 24/07/2010

File:
1 edited

Legend:

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

    r3679 r3805  
    1919void usage(void);
    2020void usage(void) {
    21  cout<<"cmvtstpk [options] z_redshift"<<endl
    22      <<" -H h100 -B Ob0 -M Om0 -L Ol0,w0"<<endl
    23      <<" -k npt,lkmin,lkmax : les valeurs sont en log10"<<endl
    24      <<" -s scale : on normalise le spectre avec scale"<<endl
    25      <<" -w : write spectra on ASCII file"<<endl;
     21cout
     22<<"cmvtstpk [options] z_redshift"<<endl
     23<<" -H h100 -B Ob0 -M Om0 -L Ol0,w0"<<endl
     24<<" -k npt,lkmin,lkmax : les valeurs sont en log10"<<endl
     25<<" -s scale : on normalise le spectre avec scale"<<endl
     26<<" -w : write spectra on ASCII file"<<endl
     27<<"  -F filename : read also CAMB file"<<endl;
    2628}
    2729
     
    3638 double scale = 2.54499e+07;  // normalisation du spectre a z=0 selon SDSS
    3739 bool wrascii = false;
     40 string fcmbfile = "";
    3841
    3942 char c;
    40   while((c = getopt(narg,arg,"hwk:s:H:M:B:L:")) != -1) {
     43  while((c = getopt(narg,arg,"hwk:s:H:M:B:L:F:")) != -1) {
    4144  switch (c) {
    4245  case 'H' :
     
    6366    wrascii = true;
    6467    break;
     68  case 'F' :
     69    fcmbfile = optarg;
     70    break;
    6571  case 'h' :
    6672  default :
     
    7884 cout<<"scale="<<scale<<endl;
    7985 cout<<"zval="<<zval<<endl;
    80 
    81  //--------------------------
    82  InitialSpectrum pkini(ns,as);
     86 cout<<"fcmbfile="<<fcmbfile<<endl;
     87
     88 //--------------------------
     89 InitialPowerLaw pkini(ns,as);
    8390 pkini.SetNorm(scale);
    8491
     
    8996 TransfertEisenstein tfnob(h100,Om0,0.,T_CMB_Par,true);
    9097
    91  GrowthFactor d1(Om0,Ol0);
     98 GrowthEisenstein d1(Om0,Ol0);
    9299 cout<<"GrowthFactor: "<<d1(zval)<<endl;
    93100
    94  PkSpectrum0 pk0(pkini,tf);
    95  PkSpectrum0 pk0nosc2(pkini,tfnosc2);
    96  PkSpectrum0 pk0nosc1(pkini,tfnosc1);
    97  PkSpectrum0 pk0nob(pkini,tfnob);
    98 
    99  PkSpectrumZ pkz(pk0,d1,zval);
    100  PkSpectrumZ pkznosc2(pk0nosc2,d1,zval);
    101  PkSpectrumZ pkznosc1(pk0nosc1,d1,zval);
    102  PkSpectrumZ pkznob(pk0nob,d1,zval);
     101 PkSpecCalc pk0(pkini,tf,d1,0.);
     102 PkSpecCalc pk0nosc2(pkini,tfnosc2,d1,0.);
     103 PkSpecCalc pk0nosc1(pkini,tfnosc1,d1,0.);
     104 PkSpecCalc pk0nob(pkini,tfnob,d1,0.);
     105
     106 PkSpecCalc pkz(pkini,tf,d1,zval);
     107 PkSpecCalc pkznosc2(pkini,tfnosc2,d1,zval);
     108 PkSpecCalc pkznosc1(pkini,tfnosc1,d1,zval);
     109 PkSpecCalc pkznob(pkini,tfnob,d1,zval);
     110
     111 PkTabulate* pkcamb = NULL;
     112 if(fcmbfile.size()>0) {
     113   cout<<endl<<"PkTabulate for CAMB"<<endl;
     114   pkcamb = new PkTabulate;
     115   pkcamb->ReadCAMB(fcmbfile,h100,0.);
     116   pkcamb->SetInterpTyp(1);
     117   if(pkcamb->NPoints()==0) {delete pkcamb; pkcamb = NULL;}
     118 }
    103119
    104120 //--------------------------
     
    118134
    119135 //--------------------------
    120  const int n = 14;
     136 const int n = 15;
    121137 const char *vname[n] = {
    122138   "k","pkini",
     
    124140   "tfnosc2","pk0nosc2","pknosc2",
    125141   "tfnosc1","pk0nosc1","pknosc1",
    126    "tfnob","pk0nob","pknob"
     142   "tfnob","pk0nob","pknob","pktab"
    127143 };
    128144 NTuple nt(n,vname);
     
    145161   xnt[12] = pk0nob(k);
    146162   xnt[13] = pkznob(k,zval);
     163   if(pkcamb != NULL) xnt[14] = (*pkcamb)(k); else xnt[14] = 0;
    147164   nt.Fill(xnt);
    148165 }
     166
     167   if(pkcamb != NULL) {delete pkcamb; pkcamb = NULL;}
    149168
    150169 //--------------------------
     
    190209n/plot nt.log10(pkini)%log10(k) pkini>0.&&k>0. ! "nsta connectpoints"
    191210
    192 #### Gestion des abscisses
    193 set xk log10(k)
    194 set xk k
    195 
    196211#### fct de transfert
    197212zone
    198 n/plot nt.tf%$xk ! ! "nsta connectpoints"
    199 n/plot nt.tfnosc2%$xk ! ! "nsta connectpoints same red"
    200 n/plot nt.tfnosc1%$xk ! ! "nsta connectpoints same blue"
    201 n/plot nt.tfnob%$xk ! ! "nsta connectpoints same green"
    202 
    203 n/plot nt.tf/tfnosc2%$xk ! ! "nsta connectpoints red"
    204 n/plot nt.tf/tfnosc1%$xk ! ! "nsta connectpoints same blue"
    205 n/plot nt.tf/tfnob%$xk ! ! "nsta connectpoints same green"
     213n/plot nt.tf%k k>0&&tf>0 ! "nsta connectpoints logx logy"
     214n/plot nt.tfnosc2%k k>0&&tfnosc2>0 ! "nsta connectpoints same red logx logy"
     215n/plot nt.tfnosc1%k k>0&&tfnosc1>0 ! "nsta connectpoints same blue logx logy"
     216n/plot nt.tfnob%k k>0&&tfnob>0 ! "nsta connectpoints same green logx logy"
     217
     218n/plot nt.tf/tfnosc2%k k>0&&tfnosc2>0 ! "nsta connectpoints red logx"
     219n/plot nt.tf/tfnosc1%k k>0&&tfnosc1>0 ! "nsta connectpoints same blue logx"
     220n/plot nt.tf/tfnob%k k>0&&tfnob>0 ! "nsta connectpoints same green logx"
    206221addline -10 1 10 1
    207222
    208223#### Spectre a z=0
    209224zone
    210 n/plot nt.pk0%$xk ! ! "nsta connectpoints"
    211 n/plot nt.pk0nosc2%$xk ! ! "nsta connectpoints same red"
    212 n/plot nt.pk0nosc1%$xk ! ! "nsta connectpoints same blue"
    213 n/plot nt.pk0nob%$xk ! ! "nsta connectpoints same green"
     225n/plot nt.pk0%k k>0&&pk0>0 ! "nsta connectpoints logx logy"
     226n/plot nt.pk0nosc2%k k>0&&pk0nosc2>0 ! "nsta connectpoints same red logx logy"
     227n/plot nt.pk0nosc1%k k>0&&pk0nosc1>0 ! "nsta connectpoints same blue logx logy"
     228n/plot nt.pk0nob%k k>0&&pk0nob>0 ! "nsta connectpoints same green logx logy"
    214229
    215230# Check
    216231zone 2 2
    217 n/plot nt.pk0/pkini-tf*tf%$xk pkini>0 ! "nsta crossmarker3"
    218 n/plot nt.pk0nosc2/pkini-tfnosc2*tfnosc2%$xk pkini>0 ! "nsta crossmarker3"
    219 n/plot nt.pk0nosc1/pkini-tfnosc1*tfnosc1%$xk pkini>0 ! "nsta crossmarker3"
    220 n/plot nt.pk0nob/pkini-tfnob*tfnob%$xk pkini>0 ! "nsta crossmarker3"
     232n/plot nt.pk0/pkini-tf*tf%k k>0&&pkini>0 ! "nsta crossmarker3 logx"
     233n/plot nt.pk0nosc2/pkini-tfnosc2*tfnosc2%k k>0&&pkini>0 ! "nsta crossmarker3 logx"
     234n/plot nt.pk0nosc1/pkini-tfnosc1*tfnosc1%k k>0&&pkini>0 ! "nsta crossmarker3 logx"
     235n/plot nt.pk0nob/pkini-tfnob*tfnob%k k>0&&pkini>0 ! "nsta crossmarker3 logx"
    221236
    222237#### Spectre a z
    223238zone
    224 n/plot nt.pk%$xk ! ! "nsta connectpoints"
    225 n/plot nt.pknosc2%$xk ! ! "nsta connectpoints same red"
    226 n/plot nt.pknosc1%$xk ! ! "nsta connectpoints same blue"
    227 n/plot nt.pknob%$xk ! ! "nsta connectpoints same green"
    228 
    229 n/plot nt.pk/pknosc2%$xk ! ! "nsta connectpoints red"
    230 n/plot nt.pk/pknosc1%$xk ! ! "nsta connectpoints same blue"
    231 n/plot nt.pk/pknob%$xk ! ! "nsta connectpoints same green"
     239n/plot nt.pk%k k>0&&pk>0 ! "nsta connectpoints logx logy"
     240n/plot nt.pknosc2%k k>0&&pknosc2>0 ! "nsta connectpoints same red logx logy"
     241n/plot nt.pknosc1%k k>0&&pknosc1>0 ! "nsta connectpoints same blue logx logy"
     242n/plot nt.pknob%k k>0&&pknob>0 ! "nsta connectpoints same green logx logy"
     243
     244n/plot nt.pk/pknosc2%k k>0&&pknosc2>0 ! "nsta connectpoints red logx"
     245n/plot nt.pk/pknosc1%k k>0&&pknosc1>0 ! "nsta connectpoints same blue logx"
     246n/plot nt.pk/pknob%k k>0&&pknob>0 ! "nsta connectpoints same green logx"
    232247addline -10 1 10 1
    233248
    234249#### Le spectre version Delta^2
    235250set D2 k*k*k*pk/(2*M_PI*M_PI)
    236 n/plot nt.$D2%$xk  !  ! "nsta crossmarker3 connectpoints"
     251n/plot nt.$D2%k  k>0  ! "nsta crossmarker3 connectpoints logx"
    237252
    238253#### Test des transferts dans Histo et TVector
     
    248263disp halea "same red"
    249264
     265#### Le spectre tabule
     266n/plot nt.pk%k pk>0&&k>0 ! "nsta connectpoints logx logy"
     267n/plot nt.pktab%k pktab>0&&k>0 ! "nsta connectpoints same red logx logy"
     268
     269n/plot nt.(pktab-pk)%k k>0&&pk>0 ! "nsta connectpoints"
     270n/plot nt.(pktab-pk)/pk%k k>0&&pk>0 ! "nsta connectpoints"
     271
     272n/plot nt.pk/pknosc2%k k>0&&pknosc2>0 ! "nsta connectpoints logx"
     273n/plot nt.pktab/pknosc2%k k>0&&pknosc2>0 ! "nsta connectpoints same red logx"
     274
    250275*/
Note: See TracChangeset for help on using the changeset viewer.