Changeset 3799 in Sophya for trunk/Cosmo/SimLSS/cmvrvloscor.cc


Ignore:
Timestamp:
Jun 30, 2010, 6:23:54 PM (15 years ago)
Author:
cmv
Message:

Vlos * by (1+z), Dlos(com) do not * by (1+z), cmv 30/06/2010

File:
1 edited

Legend:

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

    r3794 r3799  
    1919#include "genefluct3d.h"
    2020// set simul = 6_0p0_780
    21 // cmvrvloscorf -K 75 -S ginit3d_${simul}_r.fits ginit3d_${simul}_rv.fits
    22 // cmvrvloscorf -n 1,30 -K 75 -S -2 ginit3d_${simul}_r.fits ginit3d_${simul}_rv.fits
    23 // cmvrvloscorf -n 1,30 -2 ginit3d_${simul}_r.fits ginit3d_${simul}_rv.fits
     21// cmvrvloscorf -o rvlos_${simul}.ppf -K 75 -S ginit3d_${simul}_r.fits ginit3d_${simul}_rv.fits
     22// cmvrvloscorf -o rvlos_${simul}.ppf -n 1,30 -K 75 -S -2 ginit3d_${simul}_r.fits ginit3d_${simul}_rv.fits
     23// cmvrvloscorf -o rvlos_${simul}.ppf -n 1,30 -2 ginit3d_${simul}_r.fits ginit3d_${simul}_rv.fits
    2424
    2525void usage(void);
     
    3434<<"-S: compute cross-power spectrum of V*conj(R) (def: no)"<<endl
    3535<<"-N: do not create 3D cube and recompute 1D and 2D spectra (def: no do-it !)"<<endl
     36<<"-p: do not distribute dRho/Rho in pixel, just take the nearest (def: no, distribute rho)"<<endl
    3637<<"-2: compute 2D projection fpr dRho and dRho(corrected) (def=no)"<<endl
     38<<"-o: output ppf file name (def=\"cmvrvloscor.ppf\")"<<endl
    3739<<endl;
    3840}
     
    4143{
    4244 int nthread = 1, nplany=1, nhfilllos = 25, npixcor = 0;
    43  bool docube=true, dopk = false, do2d = false;
     45 bool docube=true, dopk = false, do2d = false, dodistrib=true;
     46 string fnppf = "cmvrvloscor.ppf";
    4447 
    4548 // --- Decodage des arguments
    4649 char c;
    47  while((c = getopt(narg,arg,"hn:K:SN2")) != -1) {
     50 while((c = getopt(narg,arg,"hn:K:SNp2o:")) != -1) {
    4851  switch (c) {
    4952  case 'n' :
     
    6366  case '2' :
    6467    do2d = true;
     68    break;
     69  case 'p' :
     70    dodistrib = false;
     71    break;
     72  case 'o' :
     73    fnppf = optarg;
    6574    break;
    6675  case 'h' :
     
    100109 Histo hmpc(-dmin*nmax,dmin*nmax,4*nmax);
    101110
    102  POutPersist pos("cmvrvloscor.ppf");
     111 POutPersist pos(fnppf.c_str());
    103112 DVList dvlcor;
    104113
     
    173182   // Calcul du champ R redshift distordu
    174183   for(int l=0;l<Nz;l++) {
    175      double d = (1.+Zref) / Href * V(l);
     184     double d = V(l) / Href;
    176185     if(fhis) hmpc.Add(d);
    177186     double lpd = (double)l + d/Dz; // valeur du deplacee
    178      // on repartit proportionellement au recouvrement sur 2 pixels
    179      long l1 = long(lpd); // pixel de gauche
    180      long l2 = l1 + 1;  // pixel de droite
    181      lpd -= (double)l1;  // recouvrement du pixel du dessus
    182      if(l1>=0 && l1<Nz) Rdis(l1) += R(l) * (1.-lpd);
    183      if(l2>=0 && l2<Nz) Rdis(l2) += R(l) * lpd;
     187     if(dodistrib) {
     188       // on repartit proportionellement au recouvrement sur 2 pixels
     189       long l1 = long(lpd); // pixel de gauche
     190       long l2 = l1 + 1;  // pixel de droite
     191       lpd -= (double)l1;  // recouvrement du pixel du dessus
     192       if(l1>=0 && l1<Nz) Rdis(l1) += R(l) * (1.-lpd);
     193       if(l2>=0 && l2<Nz) Rdis(l2) += R(l) * lpd;
     194     } else { // take nearest pixel
     195       long l1 = long(lpd + 0.5);
     196       if(l1>=0 && l1<Nz) Rdis(l1) += R(l);
     197     }
    184198   }
    185199   // On remplit eventuellement les matrices 2D
     
    351365n/plot hpkrec2.val%sqrt(x*x+y*y) ! ! "nsta crossmarker3 logx"
    352366
     367defscript tom
     368del m2
     369c++exec TMatrix<r_8> m2(hpkrec2.NBinX(),hpkrec2.NBinY()); \
     370for(int i=0;i<hpkrec2.NBinX();i++) \
     371for(int j=0;j<hpkrec2.NBinY();j++) m2(i,j) = hpkrec2(i,j); \
     372KeepObj(m2); cout<<"OK"<<endl;
     373endscript
     374
    353375# les matrices 2D
    354376set n 0
Note: See TracChangeset for help on using the changeset viewer.