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