Changeset 594 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Nov 17, 1999, 7:49:32 PM (26 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/nobjmgr.cc
r584 r594 955 955 obja = GetObjAdapter(nom); 956 956 if (obja == NULL) return; 957 958 string ctyp = typeid(*obja->GetDataObj()).name(); 957 AnyDataObj* ob = obja->GetDataObj(); 958 if (ob == NULL) { 959 cerr << "NamedObjMgr::PrintObj() / Error - NULL object ! in " << nom << endl; 960 return; 961 } 962 string ctyp = typeid(*ob).name(); 959 963 cout << "NamedObjMgr::PrintObj(" << nom << ") Type: " << ctyp << endl; 960 964 obja->Print(cout); … … 969 973 obja = GetObjAdapter(nom); 970 974 if (obja == NULL) { 971 cout << "NamedObjMgr::DisplayObj() Error , Pas d'objet de nom" << nom << endl;975 cout << "NamedObjMgr::DisplayObj() Error , No object with name " << nom << endl; 972 976 return; 973 977 } 978 if (obja->GetDataObj() == NULL) { 979 cerr << "NamedObjMgr::DisplayObj() / Error - NULL object ! in " << nom << endl; 980 return; 981 } 974 982 if (!myImgApp) return; 975 983 … … 981 989 if (!dr && !arr) { 982 990 string ctyp = typeid(*(obja->GetDataObj())).name(); 983 cout << "NamedObjMgr::DisplayObj() Error , Pas de display pour " << ctyp << endl;991 cout << "NamedObjMgr::DisplayObj() Error , No display for " << ctyp << endl; 984 992 return; 985 993 } … … 1017 1025 return; 1018 1026 } 1027 if (obja->GetDataObj() == NULL) { 1028 cerr << "NamedObjMgr::DisplayImage() / Error - NULL object ! in " << nom << endl; 1029 return; 1030 } 1019 1031 if (!myImgApp) return; 1020 1032 … … 1052 1064 return; 1053 1065 } 1066 if (obja->GetDataObj() == NULL) { 1067 cerr << "NamedObjMgr::DisplaySurf3D() / Error - NULL object ! in " << nom << endl; 1068 return; 1069 } 1054 1070 if (!myImgApp) return; 1055 1071 -
trunk/SophyaPI/PIext/nomskymapadapter.cc
r585 r594 1 1 #include "machdefs.h" 2 2 #include <stdlib.h> 3 #include <math.h> 3 4 #include <typeinfo> 4 5 #include <iostream.h> … … 10 11 #include "spheregorski.h" 11 12 #include "localmap.h" 12 13 #include "pitvmaad.h" 14 #include "complexios.h" 15 16 // Classe array adapter pour localMap 17 template <class T> 18 class LocalMapArrAdapter : public P2DArrayAdapter { 19 public: 20 LocalMapArrAdapter(LocalMap<T>* lm, bool d=false) : 21 P2DArrayAdapter(lm->XSize(), lm->YSize()) 22 { ad = d; map = lm; } 23 24 virtual ~LocalMapArrAdapter() { if (ad) delete map; } 25 virtual double Value(int ix, int iy) { return((*map)(ix, iy)); } 26 27 protected : 28 bool ad; 29 LocalMap<T>* map; 30 }; 31 32 /* --Methode-- */ 33 double LocalMapArrAdapter< complex<float> >::Value(int ix, int iy) 34 { 35 double re,im; 36 re = (*map)(iy, ix).real(); 37 im = (*map)(iy, ix).imag(); 38 return(sqrt(re*re+im*im)); 39 } 40 /* --Methode-- */ 41 double LocalMapArrAdapter< complex<double> >::Value(int ix, int iy) 42 { 43 double re,im; 44 re = (*map)(iy, ix).real(); 45 im = (*map)(iy, ix).imag(); 46 return(sqrt(re*re+im*im)); 47 } 13 48 14 49 //---------------------------------------------------------------- … … 20 55 template <class T> 21 56 NOMAdapter_PixelMap<T>::NOMAdapter_PixelMap(PixelMap<T> * o) 22 : NObjMgrAdapter( (AnyDataObj *)o)57 : NObjMgrAdapter(o) 23 58 { 24 59 mMap = o; … … 84 119 { 85 120 string s = typeid(*mMap).name(); 121 T moy, sig; 122 MeanSig(moy, sig); 86 123 cout << "SkyMap Type: " << s << " NbPixels= " << mMap->NbPixels() << endl; 124 cout << " Mean= " << moy << " Sig2= " << sig << endl; 87 125 } 88 126 … … 92 130 P2DArrayAdapter* NOMAdapter_PixelMap<T>::Get2DArray(string &) 93 131 { 94 return(NULL); 132 LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap); 133 if (lm != NULL) return(new LocalMapArrAdapter<T>(lm, false)); 134 int nr = 250; 135 int nc = 500; 136 SphericalMap<T>* sm = dynamic_cast< SphericalMap<T> *>(mMap); 137 if (sm != NULL) { nr = sqrt(0.75*mMap->NbPixels()); nc = 2*nr; } 138 TMatrix<T> * mtx = new TMatrix<T>(nr, nc); 139 Project_Mol(*mtx); 140 return (new POTMatrixAdapter<T>(mtx, true) ); 95 141 } 96 142 … … 103 149 } 104 150 105 151 /* --Methode-- */ 152 template <class T> 153 void NOMAdapter_PixelMap<T>::MeanSig(T& gmoy, T& gsig) 154 { 155 gmoy=0.; 156 gsig = 0.; 157 T valok; 158 for(int k=0; k<mMap->NbPixels(); k++) { 159 valok = (*mMap)(k); 160 gmoy += valok; gsig += valok*valok; 161 } 162 gmoy /= (T)mMap->NbPixels(); 163 gsig = gsig/(T)mMap->NbPixels() - gmoy*gmoy; 164 165 } 166 167 /* --Methode-- */ 168 template <class T> 169 void NOMAdapter_PixelMap<T>::Project_Mol(TMatrix<T> & mtx, T defval) 170 { 171 r_8 xa, yd, teta,phi, facteur; 172 int_4 l,c,k; 173 int_4 nl = mtx.NRows(); 174 int_4 nc = mtx.NCols(); 175 mtx.Reset(defval); // On met tout a defval 176 // cout << " NRows= " << nl << " NCols= " << nc << endl; 177 for(l=0; l<nl; l++) { 178 yd = (r_8)(l+0.5)/(r_8)nl-0.5; 179 facteur=2.*M_PI/sin(acos((double)yd*2)); 180 teta = (yd+0.5)*Pi; 181 // teta = (0.5-yd)*M_PI; 182 for(c=0; c<nc; c++) { 183 xa = (r_8)(c+0.5)/(r_8)nc-0.5; 184 phi = xa*facteur+M_PI; 185 if ( (phi <= 2*M_PI) && (phi >= 0.) ) { 186 k = mMap->PixIndexSph(teta, phi); 187 mtx(l,c) = (*mMap)(k); 188 } 189 } 190 } 191 } 106 192 107 193 // ------------------------------------------------------------- -
trunk/SophyaPI/PIext/nomskymapadapter.h
r585 r594 9 9 10 10 #include "nomgadapter.h" 11 #include "tmatrix.h" 11 12 #include "pixelmap.h" 12 13 … … 34 35 virtual NTupleInterface* GetNTupleInterface(bool& adel); 35 36 37 virtual void MeanSig(T& gmoy, T& gsig); 38 virtual void Project_Mol(TMatrix<T> & mtx, T defval=0.); 39 36 40 protected: 37 41 PixelMap<T>* mMap; -
trunk/SophyaPI/PIext/pitvmaad.h
r585 r594 8 8 9 9 #include "machdefs.h" 10 #include <math.h>11 10 #include "parradapter.h" 12 11 … … 19 18 class POTVectorAdapter : public P1DArrayAdapter { 20 19 public : 21 POTVectorAdapter(TVector<T>* v, bool ad=false) 22 : P1DArrayAdapter(v->NElts()) 23 { aDel = ad; mVec = v; } 24 virtual ~POTVectorAdapter() 25 { if (aDel) delete mVec; } 26 virtual double Value(int i) 27 { return((*mVec)(i)); } 20 POTVectorAdapter(TVector<T>* v, bool ad=false); 21 virtual ~POTVectorAdapter(); 22 virtual double Value(int i); 28 23 29 24 protected: … … 34 29 typedef POTVectorAdapter<r_8> POVectorAdapter; 35 30 36 double POTVectorAdapter< complex<float> >::Value(int i)37 {38 double re,im;39 re = (*mVec)(i).real();40 im = (*mVec)(i).imag();41 return(sqrt(re*re+im*im));42 }43 44 double POTVectorAdapter< complex<double> >::Value(int i)45 {46 double re,im;47 re = (*mVec)(i).real();48 im = (*mVec)(i).imag();49 return(sqrt(re*re+im*im));50 }51 31 52 32 // Adaptateur de matrice SOPHYA a P2DArrayAdapter … … 55 35 class POTMatrixAdapter : public P2DArrayAdapter { 56 36 public : 57 POTMatrixAdapter(TMatrix<T>* mtx, bool ad=false) 58 : P2DArrayAdapter(mtx->NCols(), mtx->NRows()) 59 { aDel = ad; mMtx = mtx; } 60 virtual ~POTMatrixAdapter() 61 { if (aDel) delete mMtx; } 62 virtual double Value(int ix, int iy) 63 { return((double)(*mMtx)(iy, ix)); } 37 POTMatrixAdapter(TMatrix<T>* mtx, bool ad=false); 38 virtual ~POTMatrixAdapter(); 39 virtual double Value(int ix, int iy); 64 40 65 41 protected: … … 70 46 typedef POTMatrixAdapter<r_8> POMatrixAdapter; 71 47 72 double POTMatrixAdapter< complex<float> >::Value(int ix, int iy)73 {74 double re,im;75 re = (*mMtx)(iy, ix).real();76 im = (*mMtx)(iy, ix).imag();77 return(sqrt(re*re+im*im));78 }79 80 double POTMatrixAdapter< complex<double> >::Value(int ix, int iy)81 {82 double re,im;83 re = (*mMtx)(iy, ix).real();84 im = (*mMtx)(iy, ix).imag();85 return(sqrt(re*re+im*im));86 }87 48 #endif
Note:
See TracChangeset
for help on using the changeset viewer.