source: Sophya/trunk/SophyaProg/Tests/testfitsio.cc@ 2743

Last change on this file since 2743 was 2615, checked in by cmv, 21 years ago

using namespace sophya enleve de machdefs.h, nouveau sopnamsp.h cmv 10/09/2004

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