Changeset 3261 in Sophya for trunk/Cosmo/SimLSS/genefluct3d.cc


Ignore:
Timestamp:
Jun 4, 2007, 7:02:03 PM (18 years ago)
Author:
cmv
Message:

add sigma computation with bad pixel cmv 04/06/2007

File:
1 edited

Legend:

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

    r3255 r3261  
    854854}
    855855
    856 int_8 GeneFluct3D::MeanSigma2(double& rm,double& rs2,double vmin,double vmax)
    857 // mean,sigma^2 pour pixels avec valeurs ]vmin,vmax[ extremites exclues
    858 //   -> mean and sigma^2 are NOT computed with pixels values vmin and vmax
    859 {
     856int_8 GeneFluct3D::MeanSigma2(double& rm,double& rs2,double vmin,double vmax
     857                             ,bool useout,double vout)
     858// Calcul de mean,sigma2 dans le cube reel avec valeurs ]vmin,vmax[ extremites exclues
     859// useout = false: ne pas utiliser les pixels hors limites pour calculer mean,sigma2
     860//          true : utiliser les pixels hors limites pour calculer mean,sigma2
     861//                 en remplacant leurs valeurs par "vout"
     862{
     863 bool tstval = (vmax>vmin)? true: false;
     864 if(lp_>0) {
     865   cout<<"--- MeanSigma2: ";
     866   if(tstval) cout<<"range=]"<<vmin<<","<<vmax<<"[";
     867   if(useout) cout<<", useout="<<useout<<" vout="<<vout;
     868   cout<<endl;
     869 }
    860870 check_array_alloc();
    861871
     
    866876   int_8 ip = IndexR(i,j,l);
    867877   double v = data_[ip];
    868    if(v<=vmin || v>=vmax) continue;
     878   if(tstval) {
     879     if(v<=vmin || v>=vmax) {if(useout) v=vout; else continue;}
     880   }
    869881   rm += v;
    870882   rs2 += v*v;
     
    877889 }
    878890
     891 if(lp_>0) cout<<"  n="<<n<<" m="<<rm<<" s2="<<rs2<<" s="<<sqrt(fabs(rs2))<<endl;
     892
    879893 return n;
    880894}
     
    882896int_8 GeneFluct3D::SetToVal(double vmin, double vmax,double val0)
    883897// set to "val0" if out of range ]vmin,vmax[ extremites exclues
    884 //     ->  vmin and vmax are set to val0
    885 {
     898// cad set to "val0" if in [vmin,vmax] -> vmin and vmax are set to val0
     899{
     900 if(lp_>0) cout<<"--- SetToVal set to="<<val0
     901               <<" when in range=["<<vmin<<","<<vmax<<"]"<<endl;
    886902 check_array_alloc();
    887903
Note: See TracChangeset for help on using the changeset viewer.