Changeset 3873 in Sophya


Ignore:
Timestamp:
Sep 2, 2010, 5:38:01 PM (15 years ago)
Author:
cmv
Message:

Suite a la disparition de frand01, modification pour compilation:

frand01 -> drand01

+ Modifs pour palier une certaine vision poetique de l'informatique !!!

if( double == int) blabla !!!!

cmv, 02/09/2010

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/PMixer/extractRS.cc

    r2615 r3873  
    4343  string msg;
    4444  int rc = 0;
    45   RadSpectra * es = NULL;
    46   SpectralResponse * sr = NULL;
     45  //RadSpectra * es = NULL;
     46  //SpectralResponse * sr = NULL;
    4747  double moy, sig;
    4848 
     
    9191    // Loop over sky frequencies components
    9292    int maxOfSkyComp = nskycomp;
    93     int nbOfPix;
     93    int nbOfPix = 0;
    9494    int sk;
    9595    Vector freq(maxOfSkyComp);
     
    138138        if (printlev > 2) cout << " Reading Input FITS map " << nameOfFile << endl;
    139139        ifstream from(nameOfFile);
    140         char ch;
    141140        string dum;
    142141        from >> nb_source >> dum;
     
    209208    for(i=0;i<OutputMap.NbPixels();i++)
    210209      {
    211         float rndval = frand01();
    212         if(rndval == 1) rndval = frand01();
    213         int rndvalPix = rndval*OutputMap.NbPixels();
    214         int outpix = rndval*nbOfPix;
     210        double rndval = drand01();
     211        //stupid!!!!! if(rndval == 1) rndval = drand01();
     212        //unsused!!!!! int rndvalPix = rndval*OutputMap.NbPixels();
     213        int outpix = int(rndval*nbOfPix);
     214        if(outpix >= nbOfPix) outpix = nbOfPix - 1; // add clean size protection
    215215        OutputMap(i) = outCoeff(outpix);
    216216      }
     
    234234    for(i=0;i<nb_source;i++)
    235235      {
    236         float rndval = frand01();
    237         int outPix = rndval*OutputMap.NbPixels();
     236        double rndval = drand01();
     237        int outPix = int(rndval*OutputMap.NbPixels());
     238        if(outPix >= OutputMap.NbPixels()) outPix = OutputMap.NbPixels() - 1; // add clean size protection
    238239        SourceMap(outPix) = sourceCoeff(i);
    239240        OutputMap(outPix) = OutputMap(i)+ SourceMap(outPix);
Note: See TracChangeset for help on using the changeset viewer.