Changeset 3062 in Sophya for trunk/SophyaLib/NTools/generaldata.h
- Timestamp:
- Aug 14, 2006, 8:24:21 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/generaldata.h
r2683 r3062 13 13 namespace SOPHYA { 14 14 15 // Forward class declaration for Fits handler 16 template <class T> class FitsHandler; 17 15 18 class GeneralFit; 16 19 … … 23 26 friend class GeneralFit; 24 27 friend class ObjFileIO<GeneralFitData>; 28 friend class FitsHandler<GeneralFitData>; 25 29 public: 26 30 //! Valeurs par defaut pour l'utilisation des erreurs … … 30 34 }; 31 35 32 GeneralFitData(u nsigned int nVar, unsigned intnDataAlloc, uint_2 errx=0);36 GeneralFitData(uint_4 nVar, uint_4 nDataAlloc, uint_2 errx=0); 33 37 GeneralFitData(const GeneralFitData& data, bool clean=false); 34 38 GeneralFitData(); 35 39 virtual ~GeneralFitData(); 36 40 37 void Alloc(unsigned int nVar, unsigned int nDataAlloc, int_2 errx=-1); 38 void SetDataPtr(int ptr = 0); 39 40 void KillData(int i); 41 void KillData(int i1,int i2); 42 43 void ValidData(int i); 44 void ValidData(int i1,int i2); 41 void SetDataPtr(int_4 ptr = 0); 42 43 void KillData(int_4 i); 44 void KillData(int_4 i1,int_4 i2); 45 46 void ValidData(int_4 i); 47 void ValidData(int_4 i1,int_4 i2); 45 48 void ValidData(); 46 49 47 void RedefineData1(int i,double x,double f,double err=Def_ErrF,double errx=Def_ErrX);48 void RedefineData2(int i,double x,double y,double f,double err=Def_ErrF50 void RedefineData1(int_4 i,double x,double f,double err=Def_ErrF,double errx=Def_ErrX); 51 void RedefineData2(int_4 i,double x,double y,double f,double err=Def_ErrF 49 52 ,double errx=Def_ErrX,double erry=Def_ErrX); 50 void RedefineData(int i,double* xp,double f,double err=Def_ErrF,double* errxp=NULL);53 void RedefineData(int_4 i,double* xp,double f,double err=Def_ErrF,double* errxp=NULL); 51 54 52 55 void AddData1(double x, double f, double err=Def_ErrF,double errx=Def_ErrX); … … 56 59 void AddData(float* xp, float f, float err=Def_ErrF,float* errxp=NULL); 57 60 58 void SetData1(int nData,double* x,double* f,double *err=NULL,double *errx=NULL);59 void SetData1(int nData,float* x,float* f,float* err=NULL,float *errx=NULL);60 void SetData2(int nData,double* x,double* y,double* f,double *err=NULL61 void SetData1(int_4 nData,double* x,double* f,double *err=NULL,double *errx=NULL); 62 void SetData1(int_4 nData,float* x,float* f,float* err=NULL,float *errx=NULL); 63 void SetData2(int_4 nData,double* x,double* y,double* f,double *err=NULL 61 64 ,double *errx=NULL,double *erry=NULL); 62 void SetData2(int nData,float* x,float* y,float* f,float* err=NULL65 void SetData2(int_4 nData,float* x,float* y,float* f,float* err=NULL 63 66 ,float *errx=NULL,float *erry=NULL); 64 void SetData(int nData,double** xp,double *f,double *err=NULL,double** errxp=NULL);65 void SetData(int nData,float** xp,float* f,float* err=NULL,float** errxp=NULL);67 void SetData(int_4 nData,double** xp,double *f,double *err=NULL,double** errxp=NULL); 68 void SetData(int_4 nData,float** xp,float* f,float* err=NULL,float** errxp=NULL); 66 69 67 70 void PrintStatus() const; 68 void PrintData(int i) const;69 void PrintData(int i1,inti2) const;71 void PrintData(int_4 i) const; 72 void PrintData(int_4 i1,int_4 i2) const; 70 73 void PrintData() const; 71 74 void Show(ostream& os) const; 72 75 inline void Show() const {Show(cout);} 73 76 77 //! Operator equal 78 GeneralFitData& operator = (const GeneralFitData& g); 79 74 80 //! Retourne la place restante dans la structure (nombre de donnees que l'on peut encore stoquer). 75 inline int GetSpaceFree() const { return mNDataAlloc - mNData; }81 inline int_4 GetSpaceFree() const { return mNDataAlloc - mNData; } 76 82 //! Retourne le nombre de variables Xi 77 inline int NVar() const {return mNVar;}83 inline int_4 NVar() const {return mNVar;} 78 84 //! Retourne le nombre de donnees 79 inline int NData() const {return mNData;}85 inline int_4 NData() const {return mNData;} 80 86 //! Retourne le nombre de bonnes donnees (utilisees pour le fit) 81 inline int NDataGood() const {return mNDataGood;}87 inline int_4 NDataGood() const {return mNDataGood;} 82 88 //! Retourne la place maximale allouee pour les donnees 83 inline int NDataAlloc() const {return mNDataAlloc;}89 inline int_4 NDataAlloc() const {return mNDataAlloc;} 84 90 85 91 //! Retourne 1 si point valide, sinon 0 86 inline unsigned short int IsValid(inti) const92 inline unsigned short IsValid(int_4 i) const 87 93 {if(i>=0 && i<mNData) return mOK[i]; else return 0;} 88 94 //! Retourne ``true'' si il y a des erreurs sur les variables d'abscisse, ``false'' sinon. … … 90 96 91 97 //! Retourne l'abscisse pour 1 dimension (y=f(x)) donnee I 92 inline double X1(int i) const98 inline double X1(int_4 i) const 93 99 {if(i>=0 && i<mNData) return mXP[i]; else return 0.;} 94 100 //! Retourne la 1er abscisse (X) pour (v=f(x,y,z,...)) donnee I 95 inline double X(int i) const101 inline double X(int_4 i) const 96 102 {if(i>=0 && i<mNData) return mXP[i*mNVar]; else return 0.;} 97 103 //! Retourne la 2sd abscisse (Y) pour (v=f(x,y,z,...)) donnee I 98 inline double Y(int i) const104 inline double Y(int_4 i) const 99 105 {if(i>=0 && i<mNData && 1<mNVar) return mXP[i*mNVar+1]; else return 0.;} 100 106 //! etourne la 3ieme abscisse (Z) pour (v=f(x,y,z,...)) donnee I 101 inline double Z(int i) const107 inline double Z(int_4 i) const 102 108 {if(i>=0 && i<mNData && 2<mNVar) return mXP[i*mNVar+2]; else return 0.;} 103 109 //! Retourne la Jieme abscisse (Xj) pour (v=f(x0,x1,x2,...)) donnee I 104 inline double Absc(int j,inti) const110 inline double Absc(int_4 j,int_4 i) const 105 111 {if(i>=0 && i<mNData && j<mNVar)return mXP[i*mNVar+j]; else return 0.;} 106 112 //! Retourne la valeur de la Ieme donnee 107 inline double Val(int i) const113 inline double Val(int_4 i) const 108 114 {if(i>=0 && i<mNData) return mF[i]; else return 0.;} 109 115 110 116 //! Retourne l'erreur (dx) sur l'abscisse pour 1 dimension (y=f(x)) donnee I 111 inline double EX1(int i) const117 inline double EX1(int_4 i) const 112 118 {if(mErrXP && i>=0 && i<mNData) return mErrXP[i]; else return 0.;} 113 119 //! Retourne l'erreur (dx) sur la 1er abscisse (X) pour (v=f(x,y,z,...)) donnee I 114 inline double EX(int i) const120 inline double EX(int_4 i) const 115 121 {if(mErrXP && i>=0 && i<mNData) return mErrXP[i*mNVar]; else return 0.;} 116 122 //! Retourne l'erreur (dy) sur la 2sd abscisse (Y) pour (v=f(x,y,z,...)) donnee I 117 inline double EY(int i) const123 inline double EY(int_4 i) const 118 124 {if(mErrXP && i>=0 && i<mNData && 1<mNVar) return mErrXP[i*mNVar+1]; 119 125 else return 0.;} 120 126 //! Retourne l'erreur (dz) sur la 3ieme abscisse (Z) pour (v=f(x,y,z,...)) donnee I 121 inline double EZ(int i) const127 inline double EZ(int_4 i) const 122 128 {if(mErrXP && i>=0 && i<mNData && 2<mNVar) return mErrXP[i*mNVar+2]; 123 129 else return 0.;} 124 130 //! Retourne l'erreur (dxj) sur la Jieme abscisse (Xj) pour (v=f(x0,x1,x2,...)) donnee I 125 inline double EAbsc(int j,inti) const131 inline double EAbsc(int_4 j,int_4 i) const 126 132 {if(mErrXP && i>=0 && i<mNData && j<mNVar) return mErrXP[i*mNVar+j]; 127 133 else return 0.;} 128 134 //! Retourne l'erreur de la Ieme donnee 129 inline double EVal(int i) const135 inline double EVal(int_4 i) const 130 136 {if(i>=0 && i<mNData) return mErr[i]; else return 0.;} 131 137 132 r_8* GetVec(int n, r_8* ret=NULL) const;133 r_4* GetVecR4(int n, r_4* ret=NULL) const;134 int GetMnMx(int var,int& imin,int& imax) const;135 int GetMnMx(intvar,double& min,double& max) const;136 int GetMeanSigma(intvar,double& mean,double& sigma,double min=1.,double max=-1.) const;137 int GetMoMeMed(intvar,double& mode,double& mean,double& median,138 r_8* GetVec(int_4 n, r_8* ret=NULL) const; 139 r_4* GetVecR4(int_4 n, r_4* ret=NULL) const; 140 int_4 GetMnMx(int_4 var,int_4& imin,int_4& imax) const; 141 int_4 GetMnMx(int_4 var,double& min,double& max) const; 142 int_4 GetMeanSigma(int_4 var,double& mean,double& sigma,double min=1.,double max=-1.) const; 143 int_4 GetMoMeMed(int_4 var,double& mode,double& mean,double& median, 138 144 double min=1.,double max=-1.,double coeff=0.8) const; 139 int GetMode(intvar,double& mode,double min=1.,double max=-1.,double coeff=0.8) const;140 double PolFit(int varx,Poly& pol,intdegre,bool ey=true,double xc=0.) const;141 double PolFit(int varx,int vary,Poly2& pol,int degre1,intdegre2=-1,bool ez=true145 int_4 GetMode(int_4 var,double& mode,double min=1.,double max=-1.,double coeff=0.8) const; 146 double PolFit(int_4 varx,Poly& pol,int_4 degre,bool ey=true,double xc=0.) const; 147 double PolFit(int_4 varx,int_4 vary,Poly2& pol,int_4 degre1,int_4 degre2=-1,bool ez=true 142 148 ,double xc=0.,double yc=0.) const; 143 149 GeneralFitData FitResidus(GeneralFit& gfit) const; … … 161 167 162 168 protected: 169 void Alloc(uint_4 nVar, uint_4 nDataAlloc, uint_2 errx=0); 163 170 void Delete(); 164 171
Note:
See TracChangeset
for help on using the changeset viewer.