#include #include "sopnamsp.h" #include "skymapinit.h" #include "skymap.h" #include "tod.h" #include "timing.h" template void MeanSig(PixelMap const & map, double& gmoy, double& gsig) { gmoy=0.; gsig = 0.; double valok; for(int k=0; k= 0.) gsig = sqrt(gsig); } int main(int narg, char* arg[]) { double teta,phi; double gmoy, gsig; SophyaInit(); InitTim(); // Initializing the CPU timer if ((narg > 1) && (strcmp(arg[1],"-h") == 0) ) { cout << " tspm [HEALPix_M=32] [M_TetaPhi=64] : Spherical Map Test " << endl; exit(0); } int m=32; if (narg >1) m = atoi(arg[1]); cout << " ===== HEALPix Spherical Map Test M= " << m << endl; SphereHEALPix sph(m); cout << "Filling spherical map NPixels= " << sph.NbPixels() << endl; int j; for (j=0;j Mean= " << gmoy << " Sigma = " << gsig << endl; PrtTim("End of Mean-Sig "); // Writing to a PPF file { POutPersist s("sphg.ppf"); FIO_SphereHEALPix fiog(&sph) ; fiog.Write(s); cout << "SphereHEALPix written to sphg.ppf " << endl; } // Reading from the file { FIO_SphereHEALPix fiog(string("sphg.ppf")); SphereHEALPix sph2 = fiog; PrtTim("End of Write/Read "); cout << " Spherical map from file sphg.ppf NPixels= " << sph2.NbPixels() << endl; int ndiff = 0; for(int k=0; k 1.e-49) { if ( sph2(k) != sph(k) ) { ndiff++; if (ndiff < 20) cout << "!!!Diff: K= " << k << " SPH2= " << sph2(k) << " SPH= " << sph(k) << endl; } } MeanSig(sph, gmoy, gsig); cout << "SphMapFromFile Mean= " << gmoy << " Sigma = " << gsig << endl; cout << " NDiff = " << ndiff << " (should be zero = 0) " << endl; PrtTim("End of Mean-Sig "); } int mt=64; if (narg > 2) mt = atoi(arg[2]); cout << "\n ===== ThetaPhi Spherical Map Test MT= " << mt << endl; SphereThetaPhi spht(m); cout << "Filling spherical map NPixels= " << spht.NbPixels() << endl; for (j=0;j Mean= " << gmoy << " Sigma = " << gsig << endl; PrtTim("End of Mean-Sig "); // Writing to a PPF file { POutPersist s("spht.ppf"); FIO_SphereThetaPhi fiog(spht) ; fiog.Write(s); cout << "SphereThetaPhi written to spht.ppf " << endl; } // Reading from the file { FIO_SphereThetaPhi fiog("spht.ppf"); SphereThetaPhi sph2 = fiog; PrtTim("End of Write/Read "); cout << " Spherical map from file sph.ppf NPixels= " << sph2.NbPixels() << endl; int ndiff = 0; for(int k=0; k 1.e-49) { if ( sph2(k) != spht(k) ) { ndiff++; if (ndiff < 20) cout << "!!!Diff: K= " << k << " SPH2= " << sph2(k) << " SPH= " << sph(k) << endl; } } MeanSig(sph, gmoy, gsig); cout << "SphMapFromFile Mean= " << gmoy << " Sigma = " << gsig << endl; cout << " NDiff = " << ndiff << " (should be zero = 0) " << endl; PrtTim("End of Mean-Sig "); } cout << " ===== Fin de TSPM_Test ======== " << endl; return 0; }