Changeset 4071 in Sophya
- Timestamp:
- May 9, 2012, 11:36:04 PM (12 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/graphexecut.cc
r3720 r4071 467 467 usage += ">> cdreal,cdimag,cdphase,cdmod,cdmod2 (default=cdmod): Displayed value\n"; 468 468 usage += " for complex arrays (real/imaginary part, phase, module, module^2)\n"; 469 usage += ">> polarplot polarangle=ConvFactorToRadian,AngOffsetinRadian polarangledeg\n"; 470 usage += " for 2D plots in polar coordinates (PINTuple)\n"; 469 471 usage += "--- General purpose options:\n"; 470 472 usage += ">> stat,stats / nsta,nstat,nostat,nostats : Toggle statistic display\n"; … … 489 491 usage += " nbticks=X_NTicks,Y_NTicks \n"; 490 492 usage += " tickslen=MajTickLenFrac,MinTickLenFrac \n"; 493 usage += " polaraxes or polaraxes=NbCircles,NbCteTheta,ThetaOffdeg"; 491 494 usage += ">> Axe labels font size: fixedfontsize/autofontsize=fszf \n"; 492 495 usage += " autofontsize=fsizef: Font size computed automatically \n"; … … 755 758 usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple "; 756 759 usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]"; 760 usage += "\n For plots in polar coordinates, specify polarplot graphic_att"; 757 761 usage += "\n Related commands: disp surf nt2dcn nt2dci nt3d gfd2d vecplot"; 758 762 mpiac->RegisterCommand(kw, usage, this, grp); -
trunk/SophyaPI/PIext/pintuple.cc
r3559 r4071 60 60 SelectColorByName(NULL); 61 61 SelectColorByIndex(NULL); 62 SelectPolar(NULL,NULL); 62 63 SetName("NTupleDrw"); 63 NptDraw =0;64 64 NptDraw=0; 65 polarPlot=false; 65 66 } 66 67 … … 85 86 // void SelectLabel(const char* plabel=NULL) 86 87 // Choix du nom de colonne correspondant à l'étiquette. 88 // void SelectPolar(const char* pradius, const char* pangle, double angconv=1., double angoffser=0.) 89 // Choix des noms de colonnes rayon/angle pour un trace en coordonnees polaires 87 90 //-- 88 91 … … 96 99 if (py == NULL) yK = -1; 97 100 else { name = py; yK = mNT->ColumnIndex(name); } 101 polarPlot=false; 98 102 } 99 103 … … 143 147 } 144 148 149 /* --Methode-- */ 150 void PINTuple::SelectPolar(const char* pangle, const char* pradius, double angconv, double angoff) 151 { 152 string name; 153 if (mNT == NULL) xK = yK = -1; 154 if (pangle == NULL) xK = -1; 155 else { name = pangle; xK = mNT->ColumnIndex(name); } 156 if (pradius == NULL) yK = -1; 157 else { name = pradius; yK = mNT->ColumnIndex(name); } 158 polarPlot=true; 159 angConvFactor=angconv; 160 angOffset=angoff; 161 } 145 162 146 163 /* --Methode-- */ … … 153 170 // Commencer par trouver nos limites 154 171 double xmin, xmax, ymin, ymax; 155 xmin = ymin = 9.e19; 156 xmax = ymax = -9.e19; 157 mNT->GetMinMax(xK, xmin, xmax); 158 mNT->GetMinMax(yK, ymin, ymax); 159 PIAxes::ReSizeMinMax(isLogScaleX(),xmin,xmax); 160 PIAxes::ReSizeMinMax(isLogScaleY(),ymin,ymax); 172 if (polarPlot) { 173 double rmin,rmax; 174 mNT->GetMinMax(yK, rmin, rmax); 175 if (rmax<=0.) rmax=1.; 176 xmin=ymin=-rmax; 177 xmax=ymax=rmax; 178 } 179 else { 180 xmin = ymin = 9.e19; 181 xmax = ymax = -9.e19; 182 mNT->GetMinMax(xK, xmin, xmax); 183 mNT->GetMinMax(yK, ymin, ymax); 184 PIAxes::ReSizeMinMax(isLogScaleX(),xmin,xmax); 185 PIAxes::ReSizeMinMax(isLogScaleY(),ymin,ymax); 186 } 161 187 SetLimits(xmin,xmax,ymin,ymax); 162 188 // SetAxesFlags(kBoxAxes | kExtTicks | kLabels); Ne pas faire - Reza 11/99 … … 169 195 { 170 196 double xp,yp,xer,yer,wp; 197 double ray,ang; 171 198 double xl,yl; 172 199 long nok; … … 228 255 for (long i=0; i<(long)mNT->NbLines(); i++) { 229 256 xl = xp; yl = yp; fgoklastpt = fgokcurpt; 230 231 xp = mNT->GetCell(i, xK); 232 yp = mNT->GetCell(i, yK); 233 257 if (polarPlot) { 258 ang = mNT->GetCell(i, xK)*angConvFactor+angOffset; 259 ray = mNT->GetCell(i, yK); 260 xp=cos(ang)*ray; 261 yp=sin(ang)*ray; 262 } 263 else { 264 xp = mNT->GetCell(i, xK); 265 yp = mNT->GetCell(i, yK); 266 } 234 267 // Comptage du nombre de pts dans la zone graphique du widget 235 268 if ( !((xp < xmin2) || (xp > xmax2) || (yp < ymin2) || (yp > ymax2)) ) nok++; … … 287 320 if (xebK >= 0) { 288 321 xer = mNT->GetCell(i, xebK); 289 if(xer>0.) g->DrawLine(xp-xer, yp, xp+xer, yp); 322 if(xer>0.) { 323 if (polarPlot) { 324 g->DrawLine(xp,yp,ray*cos(ang-yer*angConvFactor),ray*sin(ang-yer*angConvFactor)); 325 g->DrawLine(xp,yp,ray*cos(ang+yer*angConvFactor),ray*sin(ang+yer*angConvFactor)); 326 } 327 else g->DrawLine(xp-xer, yp, xp+xer, yp); 328 } 290 329 } 291 330 if (yebK >= 0) { 292 331 yer = mNT->GetCell(i, yebK); 293 if(yer>0.) g->DrawLine(xp, yp-yer, xp, yp+yer); 332 if(yer>0.) { 333 if (polarPlot) { 334 double ray1=ray-xer; if (ray1<0.) ray1=0.; 335 double ray2=ray+xer; if (ray2<0.) ray2=0.; 336 g->DrawLine(ray1*cos(ang), ray1*sin(ang), ray2*cos(ang), ray2*sin(ang)); 337 } 338 else g->DrawLine(xp, yp-yer, xp, yp+yer); 339 } 294 340 } 295 341 … … 418 464 UseSizeScale(true, nbn); 419 465 } 420 466 // gestion trace en coordonnees polaires 467 else if (opts == "polarplot") { polarPlot=true; } 468 else if (opts == "polarangledeg") { angConvFactor=M_PI/180.; } 469 else if (opts.substr(0,11) == "polarangle=") { 470 double aconv=1., aoff=0.; 471 sscanf(opts.substr(11).c_str(),"%lf,%lf",&aconv, &aoff); 472 angConvFactor=aconv; angOffset=aoff; 473 } 421 474 else { 422 475 // Si option non decode … … 453 506 } else opt.push_back("nosizescale"); 454 507 508 if (polarPlot) { 509 sprintf(str,"polarplot polarangle==%g,%g",angConvFactor,angOffset); opt.push_back(str); 510 } 511 455 512 return 1; 456 513 } … … 474 531 info += " colorscale/nocolorscale (Use color scale for weight) \n"; 475 532 info += " sizescale/sizescale=nbins/nosizescale (Use marker size for weight) \n"; 533 info += " polarplot: select plot in polar coordinates \n"; 534 info += " polarangle=ConvFactorToRadian,AngOffsetinRadian Polar angle conversion \n"; 535 info += " polarangledeg: set ConvFactorToRadian for input angles in degree \n"; 476 536 info += " (and usual color/line/marker/... attribute decoding) \n"; 477 537 // On recupere ensuite la chaine info de la classe de base -
trunk/SophyaPI/PIext/pintuple.h
r3269 r4071 24 24 virtual void SelectColorByName(const char* pcolnm=NULL); 25 25 virtual void SelectColorByIndex(const char* pcolidx=NULL); 26 virtual void SelectPolar(const char* pangle, const char* pradius, double angconv=1., double angoff=0.); 26 27 27 28 inline void ConnectPoints(bool fg=false) { connectPts = fg; } … … 54 55 NTupleInterface* mNT; 55 56 bool mAdDO; 56 int xK, yK; // Index du nom de variable en X/Y ds le ntuple57 int xK, yK; // Index du nom de variable en X/Y (ou rayon/angle) ds le ntuple 57 58 int xebK, yebK; // Index du nom de variable en ErrBarX/Y ds le ntuple 58 59 int wK; // Index du nom de variable poids … … 64 65 int nWbins; // Nombre de bins taille de marker variable 65 66 bool colorScale; // true -> Couleur de marker variable suivant poids 67 bool polarPlot; // true -> polar plot 68 double angConvFactor; // Facteur de conversion de l'angle en radian 69 double angOffset; // Offset de l'angle (en radian) apres conversion 66 70 bool stats; // true -> indication du nb de points 67 71 bool connectPts; // true -> les points sont relies par une ligne -
trunk/SophyaPI/PIext/pistdimgapp.cc
r3572 r4071 1794 1794 { 1795 1795 DispWinEnum rc = Disp_Next; 1796 // DBGcerr << " DBG-Parse-A sop=" << sop << " sop.length()= " << sop.length() << endl;1796 // cerr << " DBG-Parse-A sop=" << sop << " sop.length()= " << sop.length() << endl; 1797 1797 if (opts.size() > 0) opts.erase(opts.begin(), opts.end()); 1798 1798 if (sop.length() < 1) return(rc); … … 1833 1833 wname=token.substr(6); 1834 1834 } 1835 // Option a etre decode par les drawers, etc ... 1835 // Gestion specifique des options concernant les traces en coord. polaires 1836 else if (token == "polarplot") { 1837 opts.push_back("polaraxes"); 1838 opts.push_back(token); 1839 } 1840 else if ((token == "polaraxes")||(token.substr(0,10) == "polaraxes=")) { 1841 opts.push_back("polarplot"); 1842 opts.push_back(token); 1843 } 1844 //--- Option a etre decode par les drawers, etc ... 1836 1845 else opts.push_back(token); 1837 1846 } 1838 1847 1839 // DBGcerr << " DBG-Parse-B opts.size()=" << opts.size() << endl;1848 // cerr << " DBG-Parse-B opts.size()=" << opts.size() << endl; 1840 1849 if (rc == Disp_Same) nb_disp_same++; 1841 1850 else nb_disp_same = 0;
Note: See TracChangeset
for help on using the changeset viewer.