Changeset 384 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Aug 12, 1999, 4:34:22 PM (26 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r361 r384 51 51 // >>>>>>>>>>> Fenetre graphique , changement d'attributs graphiques 52 52 else if (kw == "zone") { 53 if (tokens.size() < 2) { cout << "Usage: zone nx ny" << endl; return(0); }53 while (tokens.size() < 2) tokens.push_back("1"); 54 54 int nx, ny; 55 55 nx = ny = 1; … … 596 596 597 597 kw = "zone"; 598 usage = "To Divide the Graphic window \n Usage: zone nx ny";598 usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]"; 599 599 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 600 600 kw = "newwin"; -
trunk/SophyaPI/PIext/dlftypes.h
r333 r384 14 14 #endif 15 15 16 // ------------ Fonctions pour trace de fonctions -------------- 16 17 typedef double (* DlFunctionOfX) (double x); 17 18 typedef double (* DlFunctionOfXY) (double x, double y); 19 // ---- Fonctions pour trace d'expressions d'objets ------------ 18 20 typedef int (* PlotExprFunc) (double* x, double* rx, double* ry, double* rz, double* rt); 19 21 typedef int (* NTLoopExprFunc) (double* x, double* rx, double* ry, double* rz, 20 22 double* rt, int n, int nmax); 23 24 // ---------- Fonctions UserFit ---------------- 25 typedef double (* DlUserFitFunc)(double const*, double const*); 26 typedef double (* DlUserFitFuncDer)(double const*, double const*, double*); 27 28 // ---------- Fonctions User et gestion de modules chargeables ---- 21 29 typedef void (* DlUserProcFunction) (vector<string>& args); 22 30 typedef void (* DlFunction) (); -
trunk/SophyaPI/PIext/piacmd.cc
r374 r384 809 809 810 810 if ( (fip = fopen(file.c_str(),"r")) == NULL ) { 811 if (file.find('.') >= file.length()) { 812 cout << "PIACmd::Exec(): Error opening file " << file << endl; 813 file += ".pic"; 814 cout << " Trying file " << file << endl; 815 fip = fopen(file.c_str(),"r"); 816 } 817 } 818 819 if(fip == NULL) { 811 820 cerr << "PIACmd::Exec() Error opening file " << file << endl; 812 821 hist << "##! PIACmd::Exec() Error opening file " << file << endl; -
trunk/SophyaPI/PIext/piafitting.cc
r381 r384 150 150 , mFit(NULL) 151 151 , mV(NULL), mH(NULL), mM(NULL), mH2(NULL), mIm(NULL), mG(NULL) 152 , mDlUFunc(NULL), mNameFitFunc(""), mFitFunc(NULL), mFitFuncDer(NULL) 153 , mUFNVar(0), mUFNPar(0) 152 154 { 153 155 // Init et Set des options … … 176 178 usage += "\n Usage: fitlin nomobj func [o:... o:...]"; 177 179 piac->RegisterCommand(kw,usage,this,"Fitting"); 180 181 kw = "crfitfun"; 182 usage = "Creation de user function "; 183 usage += "\n Usage: crfitfun file func nvar npar"; 184 piac->RegisterCommand(kw,usage,this,"Fitting"); 178 185 } 179 186 … … 185 192 if(mGData != NULL) {delete mGData; mGData=NULL;} 186 193 if(FWindFit != NULL) {delete FWindFit; FWindFit=NULL;} 194 if (mDlUFunc != NULL) delete mDlUFunc; 187 195 } 188 196 … … 658 666 if(mFunc && (mOpt.okres||mOpt.okfun)) { 659 667 NamedObjMgr omg; 660 string nomres = mNObj + " res";661 string nomfun = mNObj + " fun";668 string nomres = mNObj + "_res"; 669 string nomfun = mNObj + "_fun"; 662 670 if(mV) { 663 671 if(mOpt.okres) {Vector* ob = mV->FitResidus(*mFit); if(ob) omg.AddObj(ob,nomres);} … … 673 681 if(mOpt.okfun) {Histo2D* ob = mH2->FitFunction(*mFit); if(ob) omg.AddObj(ob,nomfun);} 674 682 } else if(mIm) { 675 if(mOpt.okres) {RzImage* ob = mIm->FitResidus(*mFit); if(ob) omg.AddObj(ob,nomres);} 676 if(mOpt.okfun) {RzImage* ob = mIm->FitFunction(*mFit); if(ob) omg.AddObj(ob,nomfun);} 683 if(mOpt.okres) { 684 RzImage* ob = mIm->FitResidus(*mFit); 685 if(ob) {ImageR4* rob = new ImageR4(*ob); omg.AddObj(rob,nomres); delete ob;} 686 } 687 if(mOpt.okfun) { 688 RzImage* ob = mIm->FitFunction(*mFit); 689 if(ob) {ImageR4* rob = new ImageR4(*ob); omg.AddObj(rob,nomfun); delete ob;} 690 } 677 691 } else if(mG) { 678 692 if(mOpt.okres) {GeneralFitData* ob = mG->FitResidus(*mFit); if(ob) omg.AddObj(ob,nomres);} … … 713 727 714 728 return; 729 } 730 731 /* --Methode-- */ 732 void PIAFitter::LinkFitFunc(string const & fname, string const & funcname, int nvar, int npar) 733 { 734 735 if ((nvar < 1) || (npar < 1)) return; 736 737 if (mDlUFunc != NULL) delete mDlUFunc; // Nous en avons deja un, on nettoie 738 739 mDlUFunc = NULL; 740 mFitFunc = NULL; 741 mFitFuncDer = NULL; 742 mUFNVar= mUFNPar = 0; 743 mNameFitFunc = ""; 744 745 // On compile le fichier C, on fabrique un .so et on l'ouvre 746 mDlUFunc = PDynLinkMgr::BuildFromCFile(fname); 747 if (mDlUFunc == NULL) { 748 cerr << "PIAFitter::LinkFitFunc() Erreur building .so " << endl; 749 return; 750 } 751 752 // On recupere la fonction de fit 753 mFitFunc = (DlUserFitFunc) mDlUFunc->GetFunction(funcname); 754 if (mFitFunc == NULL) { // Probleme, on n'a pas trouve etc ... 755 cerr << "PIAFitter::LinkFitFunc() Erreur linking function " << funcname << endl; 756 delete mDlUFunc; 757 mDlUFunc = NULL; 758 return; 759 } 760 761 // On recupere la fonction de derives 762 string fnameder = funcname+"_der"; 763 mFitFuncDer = (DlUserFitFuncDer) mDlUFunc->GetFunction(fnameder); 764 if (mFitFunc == NULL) { 765 cout << "PIAFitter::LinkFitFunc() No derive for " << fnameder << endl; 766 } 767 768 mNameFitFunc = funcname; 769 mUFNVar = nvar; 770 mUFNPar = npar; 771 772 cout << "PIAFitter::LinkFitFunc() UserFitFunc" << funcname 773 << " NVar=" << nvar << " NPar=" << npar << endl; 774 775 } 776 /* --Methode-- */ 777 void PIAFitter::PrepareFitFuncCFile(string const & fname, string const & funcname, int nvar, int npar) 778 { 779 // A Faire 715 780 } 716 781 … … 760 825 FWindFit = new PIAFitterWind(mApp,this); 761 826 FWindFit->Show(); 762 } 827 } else if (kw == "crfitfun") { 828 if (tokens.size() < 4) { 829 cout <<"Usage:crfitfun ... " << endl; return(0); } 830 LinkFitFunc(tokens[0], tokens[1], 1, 7); 831 double par[7]={1000,0.,0.,1.,1.,0.1,100.}; 832 double x[2]={1.,1.}; 833 cout<<"Salut:"<<mFitFunc(x,par)<<endl; 834 } 835 763 836 764 837 return(0); -
trunk/SophyaPI/PIext/piafitting.h
r379 r384 35 35 virtual ~PIAFitter(); 36 36 virtual int Execute(string& keyw, vector<string>& args); 37 virtual void LinkFitFunc(string const & fname, string const & funcname, int nvar, int npar); 38 virtual void PrepareFitFuncCFile(string const & fname, string const & funcname, int nvar, int npar); 37 39 38 40 friend class PIAFitterWind; … … 82 84 GeneralFitData* mG; // Do not delete 83 85 86 // Gestion de fonction de fit user 87 PDynLinkMgr* mDlUFunc; 88 string mNameFitFunc; 89 DlUserFitFunc mFitFunc; 90 DlUserFitFuncDer mFitFuncDer; 91 int mUFNVar, mUFNPar; 84 92 }; 85 93 -
trunk/SophyaPI/PIext/pistdimgapp.cc
r374 r384 1181 1181 sprintf(strg,"Image: %s - Pave %d %d \n", curpimg->Nom().c_str(), 1182 1182 curpimg->XPave(), curpimg->YPave()); 1183 mps->DrawString(10., 25., strg, PI_Black, PI_ BoldFont, 20);1183 mps->DrawString(10., 25., strg, PI_Black, PI_DefaultFont, PI_BoldFont, 20); 1184 1184 mps->EndBloc(); 1185 1185
Note:
See TracChangeset
for help on using the changeset viewer.