Changeset 204 in Sophya for trunk/SophyaPI/PI/parradapter.cc


Ignore:
Timestamp:
Mar 1, 1999, 6:03:26 PM (27 years ago)
Author:
ercodmgr
Message:

1/ Correction d'erreur liee a la gestion de la destruction des Widgets Xt
en particulier pour les PIWindowX
2/ Passage en double de trace en coordonnees graphiques User (UC)
(float -> double)
3/ Passage en double pour les ArrayAdapter

Reza 1/03/99

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/parradapter.cc

    r140 r204  
    2222
    2323/* --Methode-- */
    24 void P1DArrayAdapter::DefineXCoordinate(float x0, float dx)
     24void P1DArrayAdapter::DefineXCoordinate(double x0, double dx)
    2525{
    2626mOx = x0;  mDx = dx;
     
    2828
    2929/* --Methode-- */
    30 float P1DArrayAdapter::X(int i)
     30double P1DArrayAdapter::X(int i)
    3131{
    3232return(mOx+mDx*i);
     
    6060
    6161/* --Methode-- */
    62 void P2DArrayAdapter::DefineXYCoordinates(float x0, float y0, float dx, float dy)
     62void P2DArrayAdapter::DefineXYCoordinates(double x0, double y0, double dx, double dy)
    6363{
    6464mOx = x0;   mOy = y0;
     
    6767
    6868/* --Methode-- */
    69 void P2DArrayAdapter::XYfromxy(int ix, int iy, float& x, float& y)
     69void P2DArrayAdapter::XYfromxy(int ix, int iy, double& x, double& y)
    7070{
    7171x = mOx+ix*mDx;
     
    7474
    7575/* --Methode-- */
    76 int P2DArrayAdapter::CheckDyn(float& min, float& max, float& moy, float& sig, int& nbnul, int& nbsat, int vit)
     76int P2DArrayAdapter::CheckDyn(double& min, double& max, double& moy, double& sig, int& nbnul, int& nbsat, int vit)
    7777{
    7878// TIMEF ;
     
    8585
    8686if (min >= max) { min = -9.e19; max = 9.e19; }
    87 float minpix = max;
    88 float maxpix = min;
    89 float pixv;
     87double minpix = max;
     88double maxpix = min;
     89double pixv;
    9090// printf("DEBUG_CHECKDYN-IN %d - %g %g ", vit, min, max);
    9191
     
    130130
    131131/* --Methode-- */
    132 void P2DArrayAdapter::ComputeLut_PicHisto(float& min, float& max, int nbsig, float fracmax)
     132void P2DArrayAdapter::ComputeLut_PicHisto(double& min, double& max, int nbsig, double fracmax)
    133133{
    134134// TIMEF ;
     
    143143
    144144//  Variable decrivant l'histogramme
    145 float minhis, maxhis, binwidth;
     145double minhis, maxhis, binwidth;
    146146int under,over,tothis;
    147147int *phis;
    148148int *q;
    149149
    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; }
     150double MINDYNAMIC = 1.e-8;          /* Gamme dynamique minimale (MaxAff-MinAff)*/
     151double FRACPIC = 0.6065;            /*  Valeur de exp(-0.5)   */
     152
     153
     154
     155if ( 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  }
    158161if ( min >= (max-MINDYNAMIC) )  max = min+MINDYNAMIC;
    159162minhis = min;
     
    164167  maxhis = nbin*binwidth + minhis;
    165168  }
     169// printf("DEBUG nbin minhis maxhis binwidth = %d %g %g %g \n", nbin, minhis, maxhis, binwidth);
    166170
    167171/* allocation dynamique de memoire et mise a zero de l'histogramme */
     
    202206
    203207/*   On va chercher le sigma du fond  SigmaLeft, SigmaRight */
    204 int hmin = (int) ( (float)(hmax) * FRACPIC ) ;
     208int hmin = (int) ( (double)(hmax) * FRACPIC ) ;
    205209
    206210int sigr = 0;
     
    215219if (nbsig < 0)  {  /*   On considere le cas ou NbSigmas est negatif   */
    216220  if ( (bin = binmax+nbsig*sigl) < 0 )  bin = 0;
    217   min = minhis + (float)bin*binwidth;
     221  min = minhis + (double)bin*binwidth;
    218222  if ( (bin = binmax-nbsig*sigr) >= nbin ) bin = nbin-1;
    219   max = minhis + (float)bin*binwidth;
     223  max = minhis + (double)bin*binwidth;
    220224  if (max < (min+MINDYNAMIC))  max = min+MINDYNAMIC;
    221225  delete[] phis;  return;
     
    235239int nbpix = 0;
    236240for( q = phis+bin ; q < phis+nbin ; q++)  nbpix += (*q);
    237 nbpix = (int_4)((float)nbpix * fracmax);
     241nbpix = (int_4)((double)nbpix * fracmax);
    238242int nbpix2 = 0; q = phis+bin;
    239243int k = bin;
     
    241245  { nbpix2 += (*q); k++; q++; }
    242246
    243 max = minhis + (float)k*binwidth;
     247max = minhis + (double)k*binwidth;
    244248delete[] phis;
    245249if (max < (min+MINDYNAMIC))  max = min+MINDYNAMIC;
     
    258262int npx, npy, nppx, nppy, nszp, oszp;
    259263int i,j,k,l;
    260 float vpx;
     264double vpx;
    261265
    262266
     
    310314    }
    311315  else if (zm < -1) {       // Compression
    312     float fv = (float)(zmm*zmm);
     316    double fv = (double)(zmm*zmm);
    313317    for(j=ofy; j<ofy+npy; j+=zmm)
    314318      for(i=ofx; i<ofx+npx; i+=zmm) {
     
    341345    }
    342346  else if (zm < -1) {       // Compression
    343     float fv = (float)(zmm*zmm);
     347    double fv = (double)(zmm*zmm);
    344348    for(j=ofy; j<ofy+npy; j+=zmm)
    345349      for(i=ofx; i<ofx+npx; i+=zmm) {
Note: See TracChangeset for help on using the changeset viewer.