Changeset 204 in Sophya for trunk/SophyaPI/PI/parradapter.cc
- Timestamp:
- Mar 1, 1999, 6:03:26 PM (27 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/parradapter.cc
r140 r204 22 22 23 23 /* --Methode-- */ 24 void P1DArrayAdapter::DefineXCoordinate( float x0, floatdx)24 void P1DArrayAdapter::DefineXCoordinate(double x0, double dx) 25 25 { 26 26 mOx = x0; mDx = dx; … … 28 28 29 29 /* --Methode-- */ 30 floatP1DArrayAdapter::X(int i)30 double P1DArrayAdapter::X(int i) 31 31 { 32 32 return(mOx+mDx*i); … … 60 60 61 61 /* --Methode-- */ 62 void P2DArrayAdapter::DefineXYCoordinates( float x0, float y0, float dx, floatdy)62 void P2DArrayAdapter::DefineXYCoordinates(double x0, double y0, double dx, double dy) 63 63 { 64 64 mOx = x0; mOy = y0; … … 67 67 68 68 /* --Methode-- */ 69 void P2DArrayAdapter::XYfromxy(int ix, int iy, float& x, float& y)69 void P2DArrayAdapter::XYfromxy(int ix, int iy, double& x, double& y) 70 70 { 71 71 x = mOx+ix*mDx; … … 74 74 75 75 /* --Methode-- */ 76 int P2DArrayAdapter::CheckDyn( float& min, float& max, float& moy, float& sig, int& nbnul, int& nbsat, int vit)76 int P2DArrayAdapter::CheckDyn(double& min, double& max, double& moy, double& sig, int& nbnul, int& nbsat, int vit) 77 77 { 78 78 // TIMEF ; … … 85 85 86 86 if (min >= max) { min = -9.e19; max = 9.e19; } 87 floatminpix = max;88 floatmaxpix = min;89 floatpixv;87 double minpix = max; 88 double maxpix = min; 89 double pixv; 90 90 // printf("DEBUG_CHECKDYN-IN %d - %g %g ", vit, min, max); 91 91 … … 130 130 131 131 /* --Methode-- */ 132 void P2DArrayAdapter::ComputeLut_PicHisto( float& min, float& max, int nbsig, floatfracmax)132 void P2DArrayAdapter::ComputeLut_PicHisto(double& min, double& max, int nbsig, double fracmax) 133 133 { 134 134 // TIMEF ; … … 143 143 144 144 // Variable decrivant l'histogramme 145 floatminhis, maxhis, binwidth;145 double minhis, maxhis, binwidth; 146 146 int under,over,tothis; 147 147 int *phis; 148 148 int *q; 149 149 150 float MINDYNAMIC = 1.e-5; /* Gamme dynamique minimale (MaxAff-MinAff)*/ 151 float FRACPIC = 0.6065; /* Valeur de exp(-0.5) */ 152 153 154 int nbnul, nbsat, nok; 155 float moy, sig; 156 if ( min >= (max-MINDYNAMIC) ) nok = CheckDyn(min, max, moy, sig, nbnul, nbsat); 157 if (nok < 1) { min=0.; max = 1.; return; } 150 double MINDYNAMIC = 1.e-8; /* Gamme dynamique minimale (MaxAff-MinAff)*/ 151 double FRACPIC = 0.6065; /* Valeur de exp(-0.5) */ 152 153 154 155 if ( min >= (max-MINDYNAMIC) ) { 156 int nbnul, nbsat, nok; 157 double moy, sig; 158 nok = CheckDyn(min, max, moy, sig, nbnul, nbsat, vitesse); 159 if (nok < 1) { min=0.; max = 1.; return; } 160 } 158 161 if ( min >= (max-MINDYNAMIC) ) max = min+MINDYNAMIC; 159 162 minhis = min; … … 164 167 maxhis = nbin*binwidth + minhis; 165 168 } 169 // printf("DEBUG nbin minhis maxhis binwidth = %d %g %g %g \n", nbin, minhis, maxhis, binwidth); 166 170 167 171 /* allocation dynamique de memoire et mise a zero de l'histogramme */ … … 202 206 203 207 /* On va chercher le sigma du fond SigmaLeft, SigmaRight */ 204 int hmin = (int) ( ( float)(hmax) * FRACPIC ) ;208 int hmin = (int) ( (double)(hmax) * FRACPIC ) ; 205 209 206 210 int sigr = 0; … … 215 219 if (nbsig < 0) { /* On considere le cas ou NbSigmas est negatif */ 216 220 if ( (bin = binmax+nbsig*sigl) < 0 ) bin = 0; 217 min = minhis + ( float)bin*binwidth;221 min = minhis + (double)bin*binwidth; 218 222 if ( (bin = binmax-nbsig*sigr) >= nbin ) bin = nbin-1; 219 max = minhis + ( float)bin*binwidth;223 max = minhis + (double)bin*binwidth; 220 224 if (max < (min+MINDYNAMIC)) max = min+MINDYNAMIC; 221 225 delete[] phis; return; … … 235 239 int nbpix = 0; 236 240 for( q = phis+bin ; q < phis+nbin ; q++) nbpix += (*q); 237 nbpix = (int_4)(( float)nbpix * fracmax);241 nbpix = (int_4)((double)nbpix * fracmax); 238 242 int nbpix2 = 0; q = phis+bin; 239 243 int k = bin; … … 241 245 { nbpix2 += (*q); k++; q++; } 242 246 243 max = minhis + ( float)k*binwidth;247 max = minhis + (double)k*binwidth; 244 248 delete[] phis; 245 249 if (max < (min+MINDYNAMIC)) max = min+MINDYNAMIC; … … 258 262 int npx, npy, nppx, nppy, nszp, oszp; 259 263 int i,j,k,l; 260 floatvpx;264 double vpx; 261 265 262 266 … … 310 314 } 311 315 else if (zm < -1) { // Compression 312 float fv = (float)(zmm*zmm);316 double fv = (double)(zmm*zmm); 313 317 for(j=ofy; j<ofy+npy; j+=zmm) 314 318 for(i=ofx; i<ofx+npx; i+=zmm) { … … 341 345 } 342 346 else if (zm < -1) { // Compression 343 float fv = (float)(zmm*zmm);347 double fv = (double)(zmm*zmm); 344 348 for(j=ofy; j<ofy+npy; j+=zmm) 345 349 for(i=ofx; i<ofx+npx; i+=zmm) {
Note:
See TracChangeset
for help on using the changeset viewer.