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