| [476] | 1 | //++ | 
|---|
|  | 2 | // Verbatim | 
|---|
|  | 3 | // | 
|---|
|  | 4 |  | 
|---|
|  | 5 | #include <iostream.h> | 
|---|
|  | 6 | #include "fitsioserver.h" | 
|---|
|  | 7 | #include "tvector.h" | 
|---|
|  | 8 | //#include "spheregorski.h" | 
|---|
|  | 9 | #include "spherethetaphi.h" | 
|---|
|  | 10 | #include "localmap.h" | 
|---|
|  | 11 |  | 
|---|
|  | 12 |  | 
|---|
|  | 13 | int main() | 
|---|
|  | 14 | { | 
|---|
|  | 15 |  | 
|---|
|  | 16 | //PeidaImagesInitiator imgini; | 
|---|
|  | 17 | //  PeidaInit(); | 
|---|
|  | 18 | FitsIoServer fserv; | 
|---|
|  | 19 | int nsmax=32; | 
|---|
|  | 20 | // test pour les vecteurs | 
|---|
|  | 21 | /* | 
|---|
|  | 22 | double tab[12]={1,2,3,4,5,6,7,8,9,10,11,12}; | 
|---|
|  | 23 | TVector<double> V(12,tab); | 
|---|
|  | 24 | delete [] tab; | 
|---|
|  | 25 | cout << " impression du vecteur V" << endl; | 
|---|
|  | 26 | cout << V << endl; | 
|---|
|  | 27 | fserv.save(V, "vecteur.fits"); | 
|---|
|  | 28 | TVector<double> W(5); | 
|---|
|  | 29 | fserv.load(W,"vecteur.fits"); | 
|---|
|  | 30 | cout << " impression du vecteur W" << endl; | 
|---|
|  | 31 | cout << W << endl; | 
|---|
|  | 32 | */ | 
|---|
|  | 33 | // test pour les matrices | 
|---|
|  | 34 | /* | 
|---|
|  | 35 | double tab[12]={1,2,3,4,5,6,7,8,9,10,11,12}; | 
|---|
|  | 36 | //TMatrix<double> m(3,4,tab); | 
|---|
|  | 37 | TVector<double> m(12,tab); | 
|---|
|  | 38 | cout << " impression de la matrice m" << endl; | 
|---|
|  | 39 | cout << m << endl; | 
|---|
|  | 40 | fserv.save(m, "matrice.fits"); | 
|---|
|  | 41 | TMatrix<double> mm(2,3); | 
|---|
|  | 42 | //TVector<double> mm(12); | 
|---|
|  | 43 | fserv.load(mm,  "matrice.fits"); | 
|---|
|  | 44 | cout << " impression de la matrice mm" << endl; | 
|---|
|  | 45 | cout << mm << endl; | 
|---|
|  | 46 | */ | 
|---|
|  | 47 | // test pour spheres | 
|---|
|  | 48 | /* | 
|---|
|  | 49 | // nsmax est parameter chez Gorski (anafast) | 
|---|
|  | 50 | int bid=0; | 
|---|
|  | 51 |  | 
|---|
|  | 52 | //int npixtot=12*32*32; | 
|---|
|  | 53 | //float map[12*32*32]; | 
|---|
|  | 54 | // test pour les spheres | 
|---|
|  | 55 | // Définition de la sphère | 
|---|
|  | 56 | int  m=nsmax; | 
|---|
|  | 57 | float teta,phi; | 
|---|
|  | 58 | SphereGorski<float> sph1(nsmax); | 
|---|
|  | 59 | //SphereThetaPhi sph1(nsmax); | 
|---|
|  | 60 | for (int j=0;j<sph1.NbPixels();j++) | 
|---|
|  | 61 | { | 
|---|
|  | 62 | sph1.PixThetaPhi(j,teta,phi); | 
|---|
|  | 63 | int bid= sph1.PixIndexSphNest(teta,phi); | 
|---|
|  | 64 | int bid2= sph1. NestToRing(bid); | 
|---|
|  | 65 | sph1(bid2)= 200* cos(3.*teta)*sin(8*phi); | 
|---|
|  | 66 | } | 
|---|
|  | 67 | // test projection sur une image fits | 
|---|
|  | 68 | cout << " je  projette  la sphere 1 " <<endl; | 
|---|
|  | 69 | char fileimg[]="img1.fits"; | 
|---|
|  | 70 | fserv.sinus_picture_projection(sph1,fileimg); | 
|---|
|  | 71 |  | 
|---|
|  | 72 | */ | 
|---|
|  | 73 |  | 
|---|
|  | 74 |  | 
|---|
|  | 75 | /* | 
|---|
|  | 76 | // test ecriture sur une image | 
|---|
|  | 77 | char fileout[]="out.fits"; | 
|---|
|  | 78 | cout << " ecriture dans " << fileout << endl; | 
|---|
|  | 79 | fserv.save(sph1,fileout); | 
|---|
|  | 80 | cout << "relecture du fichier " << fileout << " qu'on verse dans une autre sphere" << endl; | 
|---|
|  | 81 | m=8; | 
|---|
|  | 82 | //SphereThetaPhi sph2(m); | 
|---|
|  | 83 | SphereGorski<float> sph2(m); | 
|---|
|  | 84 | fserv.load(sph2,fileout); | 
|---|
|  | 85 |  | 
|---|
|  | 86 | for (int j=0;j<10;j++) | 
|---|
|  | 87 | { | 
|---|
|  | 88 | sph2.PixThetaPhi(j,teta,phi); | 
|---|
|  | 89 | int bid= sph2.PixIndexSphNest(teta,phi); | 
|---|
|  | 90 | int bid2= sph2.NestToRing(bid); | 
|---|
|  | 91 | cout << " ring= " << j << " nest= " << bid << " ring= " << bid2 << endl; | 
|---|
|  | 92 | } | 
|---|
|  | 93 |  | 
|---|
|  | 94 | // reprojection sur image | 
|---|
|  | 95 | cout << " je  projette  la sphere 2 " <<endl; | 
|---|
|  | 96 | char fileimg2[]="img2.fits"; | 
|---|
|  | 97 | fserv.sinus_picture_projection(sph2,fileimg2); | 
|---|
|  | 98 |  | 
|---|
|  | 99 | */ | 
|---|
|  | 100 | // test pour localmap | 
|---|
|  | 101 | int  m=nsmax; | 
|---|
|  | 102 | //SphereGorski<double> sph1(nsmax); | 
|---|
|  | 103 | SphereThetaPhi<double> sph1(nsmax); | 
|---|
|  | 104 | for (int j=0;j<sph1.NbPixels();j++) | 
|---|
|  | 105 | { | 
|---|
|  | 106 | float teta,phi; | 
|---|
|  | 107 | sph1.PixThetaPhi(j,teta,phi); | 
|---|
|  | 108 | //int bid= sph1.PixIndexSphNest(teta,phi); | 
|---|
|  | 109 | //int bid2= sph1. NestToRing(bid); | 
|---|
|  | 110 | sph1(j)= 200* cos(3.*teta)*sin(8*phi); | 
|---|
|  | 111 | } | 
|---|
|  | 112 | LocalMap<double> lcl(600,300); | 
|---|
|  | 113 | lcl.SetOrigin(90.,180.); | 
|---|
|  | 114 | lcl.SetSize(60.,60.); | 
|---|
|  | 115 | for (int k=0; k< lcl.NbPixels(); k++) | 
|---|
|  | 116 | { | 
|---|
|  | 117 | float theta, phi; | 
|---|
|  | 118 | lcl.PixThetaPhi(k, theta, phi); | 
|---|
|  | 119 | lcl(k)=sph1(sph1.PixIndexSph( theta, phi)); | 
|---|
|  | 120 | } | 
|---|
|  | 121 | cout << " dessin sur img5" << endl; | 
|---|
|  | 122 | fserv.picture(lcl,"img5.fits"); | 
|---|
|  | 123 | cout << " sauvegarde sur out5" << endl; | 
|---|
|  | 124 | fserv.save(lcl,"out5.fits"); | 
|---|
|  | 125 | /* | 
|---|
|  | 126 | SphereGorski<double> sph3(nsmax); | 
|---|
|  | 127 | lcl.Project(sph3); | 
|---|
|  | 128 | cout << " je  projette  la sphere 3 " <<endl; | 
|---|
|  | 129 | char fileimg3[]="img3.fits"; | 
|---|
|  | 130 | fserv.sinus_picture_projection(sph3,fileimg3); | 
|---|
|  | 131 | char fileout3[]="out3.fits"; | 
|---|
|  | 132 | fserv.save(lcl,fileout3); | 
|---|
|  | 133 | LocalMap<double> lcl2(3,4); | 
|---|
|  | 134 | fserv.load(lcl2,fileout3); | 
|---|
|  | 135 | SphereGorski<double> sph4(nsmax); | 
|---|
|  | 136 | lcl2.Project(sph4); | 
|---|
|  | 137 | cout << " je  projette  la sphere 4 " <<endl; | 
|---|
|  | 138 | char fileimg4[]="img4.fits"; | 
|---|
|  | 139 | fserv.sinus_picture_projection(sph4,fileimg4); | 
|---|
|  | 140 | */ | 
|---|
|  | 141 | cout <<  " ===== Fin de testfits ======== " << endl; | 
|---|
|  | 142 | exit( 0 ); | 
|---|
|  | 143 | } | 
|---|