Changeset 487 in Sophya
- Timestamp:
- Oct 21, 1999, 4:02:14 PM (26 years ago)
- Location:
- trunk/SophyaLib/Samba
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/spheregorski.cc
r473 r487 11 11 } 12 12 13 extern "C"14 {15 void anafast_(int&,int&,int&,double&,float*,float*,float*,float*,float*,float*,float*);16 void synfast_(int&,int&,int&,int&,float&,float*,float*,float*,double*,double*,double*,double*,double*,float*);17 }18 13 19 14 //******************************************************************* … … 25 20 PIXELS_XY::PIXELS_XY() 26 21 { 27 cout << " appel du constructeur PIXELS_XY " <<endl;28 22 pix2x_.ReSize(1024); 29 23 pix2x_.Reset(); … … 189 183 //-- 190 184 { 191 cout<<" appel du constructeur SphereGorski ()" <<endl;192 185 InitNul(); 193 186 } … … 202 195 //-- 203 196 { 204 cout<<" appel du constructeur SphereGorski (m)" <<endl;205 197 206 198 if(m <= 0 || m > 8192) … … 233 225 pixels_= s.pixels_; 234 226 235 nlmax_= s.nlmax_;236 nmmax_= s.nmmax_;237 iseed_= s.iseed_;238 fwhm_ = s.fwhm_;239 quadrupole_ = s.quadrupole_;240 sym_cut_deg_= s.sym_cut_deg_;241 strcpy(powFile_,s.powFile_);242 227 } 243 228 … … 322 307 pixels_.Reset(); 323 308 324 nlmax_= 0;325 nmmax_= 0;326 iseed_= 0;327 fwhm_ = 0.;328 quadrupole_ = 0.;329 sym_cut_deg_= 0.;330 for(int k = 0; k < 128; k++) powFile_[k]=' ';331 309 } 332 310 … … 550 528 } 551 529 552 /*553 //++554 template<class T>555 void SphereGorski<T>::anharm(int nlmax, float sym_c,float* powspec)556 //557 // analyse en harmoniques spheriques des valeurs des pixels de la558 // sphere : appel du module anafast (Gorski-Hivon)559 //560 // "nlmax" : multipole maximum, nlmax <= 2*nsmax (cf. Nyquist)561 //562 // "sym c" : coupure symetrique autour de l'equateur (degres)563 //564 // "powspec" : tableau resultat (a reserver avant l'appel) de C(l)565 // (spectre de puissance)566 //567 //--568 //569 // Pb a resoudre : dans cette classe les valeurs de pixel sont "double"570 // dans anafast le tableau correspondant est "float"571 // pour l'instant on duplique les tableaux, il faudra decider quelque chose572 //573 {574 if (nlmax > 2*nSide_) {575 cout << " anharm : nlmax= " << nlmax <<576 " doit etre <= 2*nsmax (cf. Nyquist), soit :" << 2*nSide_ << endl;577 exit(1);578 }579 else {580 nlmax_=nlmax;581 nmmax_=nlmax_;582 }583 sym_cut_deg_=sym_c;584 float* map=new float[nPix_];585 for (int k=0; k<nPix_; k++) map[k]=(float)pixels_(k);586 int nsmax=nSide_;587 int nmmax=nmmax_;588 double sc=(double)sym_cut_deg_;589 float* alm_T=new float[2*(nlmax+1)*(nmmax+1)];590 if (powspec==NULL) {591 592 cout <<593 " anharm : un tableau de C_l doit etre alloue avant appel " << endl;594 exit(1);595 }596 float* phas_n=new float[2*(nmmax+1)];597 float* phas_s=new float[2*(nmmax+1)];598 float* dataw =new float[16*nsmax];599 float* work =new float[16*nsmax];600 601 anafast_(nsmax,nlmax,nmmax,sc,map,alm_T, powspec,phas_n,phas_s,dataw,work);602 quadrupole_=powspec[2];603 delete [] map;604 delete [] alm_T;605 delete [] phas_n;606 delete [] phas_s;607 delete [] dataw;608 delete [] work;609 }610 */611 612 /*613 //++614 template<class T>615 void SphereGorski<T>::synharm(int nlmax, int iseed,float fwhm, float* powspec)616 //617 // synthese des valeurs des pixels de la sphere par l'intermediaire618 // des coefficients en harmoniques spheriques reconstitues apartir d'un619 // spectre en puissance : appel du module synfast (Gorski-Hivon)620 //621 // powspec est un tableau (a fournir) de C(l) (spectre de puissance)622 // Ce tableau doit contenir les valeur de C(l) par ordre623 // SEQUENTIEL de l (de l=0 a l=nlmax). IL SERA MODIFIE PAR L'ALGORITHME624 //625 // nlmax : multipole maximum (nlmax <= 2*nsmax (cf. Nyquist)626 // iseed : initialisation generation aleatoire (negatif, suggere : -1)627 // fwhm : largeur totale a mi-hauteur (minutes d'arc, >=0, ex: 5)628 //--629 // Pb a resoudre : dans cette classe les valeurs de pixel sont "double"630 // dans anafast le tableau correspondant est "float"631 // pour l'instant on duplique les tableaux, il faudra decider quelque chose632 633 {634 if (nlmax > 2*nSide_) {635 cout << " sphereGorski::synharm: nlmax= " << nlmax <<636 " doit etre <= 2*nsmax (cf. Nyquist), soit : " << 2*nSide_ << endl;637 exit(1);638 }639 else {640 nlmax_=nlmax;641 nmmax_=nlmax_;642 quadrupole_=powspec[2];643 }644 if (powspec==NULL) {645 646 cout <<647 "sphereGorski::synharm : un tableau de C_l doit etre alloue avant appel"648 << endl;649 exit(1);650 }651 iseed_=iseed;652 fwhm_ =fwhm;653 float* map=new float[nPix_];654 int nsmax=nSide_;655 int nmmax=nmmax_;656 float* alm_T=new float[2*(nlmax+1)*(nmmax+1)];657 658 // tableaux de travail659 double* b_north=new double[2*(2*nmmax+1)];660 double* b_south=new double[2*(2*nmmax+1)];661 double* bw=new double[2*4*nsmax];662 double* data=new double[2*4*nsmax];663 double* work=new double[2*4*nsmax];664 float* lread=new float[nlmax+1];665 synfast_(nsmax,nlmax,nmmax,iseed,fwhm, map,alm_T, powspec,666 b_north,b_south,bw,data,work,lread);667 for (int k=0; k<nPix_; k++) pixels_(k) = (T)map[k];668 delete [] map;669 delete [] alm_T;670 delete [] b_north;671 delete [] b_south;672 delete [] bw;673 delete [] data;674 delete [] work;675 delete [] lread;676 }677 */678 530 679 531 template<class T> … … 1195 1047 } 1196 1048 1197 // retourne le nom du fichier qui contient le spectre de puissance 1198 template<class T> 1199 void SphereGorski<T>::powfile(char filename[]) const 1200 { 1201 bool status = false; 1202 for (int k=0; k< 128; k++) 1203 { 1204 if( powFile_[k] != ' ' ) 1205 { 1206 status = true; 1207 break; 1208 } 1209 } 1210 if ( status ) 1211 { 1212 strcpy(filename,powFile_); 1213 } 1214 else 1215 { 1216 strcpy(filename,"no file"); 1217 } 1218 } 1219 1220 template<class T> 1221 void SphereGorski<T>::getParafast(int& nlmax,int& nmmax,int& iseed,float& fwhm,float& quadr,float& cut) const 1222 { 1223 nlmax= nlmax_; 1224 nmmax= nmmax_; 1225 iseed= iseed_; 1226 fwhm = fwhm_; 1227 quadr= quadrupole_; 1228 cut = sym_cut_deg_; 1229 } 1230 1231 template<class T> 1232 void SphereGorski<T>::setParafast(int nlmax,int nmmax,int iseed,float fwhm,float quadr,float cut,char* filename) 1233 { 1234 nlmax_= nlmax; 1235 nmmax_= nmmax; 1236 iseed_= iseed; 1237 fwhm_ = fwhm; 1238 quadrupole_ = quadr; 1239 sym_cut_deg_= cut; 1240 strcpy(powFile_,filename); 1241 } 1049 1242 1050 1243 1051 template <class T> … … 1250 1058 os << " omeg_ = " << omeg_ << endl; 1251 1059 1252 os << " conten u depixels : ";1060 os << " content of pixels : "; 1253 1061 for(int i=0; i < nPix_; i++) 1254 1062 { … … 1259 1067 1260 1068 os << endl; 1261 const PIXELS_XY& PXY= PIXELS_XY::instance();1262 1263 os << endl; os << " contenu des tableaux conversions "<<endl;1264 for(int i=0; i < 5; i++)1265 {1266 1267 1069 //const PIXELS_XY& PXY= PIXELS_XY::instance(); 1070 1071 //os << endl; os << " contenu des tableaux conversions "<<endl; 1072 //for(int i=0; i < 5; i++) 1073 // { 1074 // os<<PXY.pix2x_(i)<<", "<<PXY.pix2y_(i)<<", "<<PXY.x2pix_(i)<<", "<<PXY.y2pix_(i)<<endl; 1075 // } 1268 1076 os << endl; 1269 1077 1270 os << " les parametres des modules anafast et synfast " <<endl;1271 os << " nlmax, nmmax & iseed= " <<nlmax_<<", "<<nmmax_<<", "<<iseed_<<endl;1272 os << " fwhm, quadr & cut = "<<fwhm_<<", "<<quadrupole_<<", "<<sym_cut_deg_<<endl;1273 os << " powfile= " << powFile_<<endl;1274 1078 } 1275 1079 … … 1357 1161 delete [] pixels; 1358 1162 1359 int nlmax,nmmax,iseed;1360 is.GetI4(nlmax);1361 is.GetI4(nmmax);1362 is.GetI4(iseed);1363 1364 float fwhm,quadr,cut;1365 is.GetR4(fwhm);1366 is.GetR4(quadr);1367 is.GetR4(cut);1368 1369 char powfl[128];1370 is.GetLine(powfl, 127);1371 1372 dobj->setParafast(nlmax,nmmax,iseed,fwhm,quadr,cut,powfl);1373 1163 } 1374 1164 … … 1406 1196 PIOSWriteArray(os,(dobj->getDataBlock())->Data(), nPix); 1407 1197 1408 int nlmax,nmmax,iseed; 1409 float fwhm,quadr,cut; 1410 dobj->getParafast(nlmax,nmmax,iseed,fwhm,quadr,cut); 1411 os.PutI4(nlmax); 1412 os.PutI4(nmmax); 1413 os.PutI4(iseed); 1414 os.PutR4(fwhm); 1415 os.PutR4(quadr); 1416 os.PutR4(cut); 1417 1418 char powfl[128]; 1419 dobj->powfile(powfl); 1420 os.PutLine(powfl); 1198 1421 1199 } 1422 1200 -
trunk/SophyaLib/Samba/spheregorski.h
r473 r487 9 9 #include "ppersist.h" 10 10 11 // les attributs de classe pix2x_ et pix2y_ sont relatifs a la traduction des12 // indices RING en indices NESTED (ou l inverse). Ce sont des tableaux13 // d'entiers initialises et remplis par le constructeur. Dans la version14 // FORTRAN de healpix, il s'agissait de tableaux mis en COMMON. Ils etaient15 // initialises au premier appel d'une conversion d indice. Je ne peux pas16 // garder cette procedure car, par exemple, la fonction PixValNest() const17 // n'autorisera pas la constitution de ces tableaux (a cause du const). Ainsi,18 // des la creation d un objet SphereGorski ces tableaux sont calcules, ce qui19 // est, certes, inutile si on ne se sert pas des indices NESTED. Ca ne me20 // rejouit pas, mais c est le seul moyen que j ai trouve pour temir compte de21 // toutes les demandes et des options prises.22 //23 // G. Le Meur24 11 25 12 // ***************** CLASSE SphereGorski ***************************** … … 87 74 int RingToNest(int) const; 88 75 89 /* analyse en harmoniques spheriques des valeurs des pixels de la90 sphere : appel du module anafast (Gorski-Hivon) */91 //void anharm(int, float, float*);92 93 /*synthese des valeurs des pixels de la sphere par l'intermediaire94 des coefficients en harmoniques spheriques reconstitues apartir d'un95 spectre en puissance : appel du module synfast (Gorski-Hivon) */96 //void synharm(int, int, float, float*);97 76 98 77 /* retourne/fixe la valeur du parametre Gorski */ … … 104 83 inline void setDataBlock(T* data,int m) { pixels_.FillFrom(m,data); } 105 84 106 /* retourne/fixe les parametres des modules anafast et synfast */107 void getParafast(int& nlmax,int& nmmax,int& iseed,float& fwhm,float& quadr,float& cut) const;108 void setParafast(int nlmax,int nmmax,int iseed,float fwhm,float quadr,float cut,char* filename);109 85 110 /* retourne/fixe le nom du fichier qui contient le spectre de puissance */111 void powfile(char filename[]) const;112 86 113 87 /* impression */ … … 134 108 NDataBlock<T> pixels_; 135 109 136 int nlmax_;137 int nmmax_;138 int iseed_;139 float fwhm_;140 float quadrupole_;141 float sym_cut_deg_;142 char powFile_[128];143 110 }; 144 111 -
trunk/SophyaLib/Samba/spherethetaphi.cc
r473 r487 69 69 } 70 70 71 /* --Methode-- */72 //++73 template <class T>74 SphereThetaPhi<T>::SphereThetaPhi(char* flnm)75 76 // Constructeur : charge une image à partir d'un fichier77 //--78 {79 InitNul();80 cout << " ShereThetaPhi:: constructeur lecture sur fichier A FAIRE " << endl;81 //PInPersist s(flnm);82 //Read(s);83 }84 71 85 72 /* --Methode-- */ -
trunk/SophyaLib/Samba/spherethetaphi.h
r473 r487 19 19 SphereThetaPhi(); 20 20 SphereThetaPhi(int m); 21 SphereThetaPhi(char* flnm);22 21 SphereThetaPhi(const SphereThetaPhi<T>& s); 23 22 virtual ~SphereThetaPhi();
Note:
See TracChangeset
for help on using the changeset viewer.