| 1 | #include "sopnamsp.h"
 | 
|---|
| 2 | #include "pmixer.h"
 | 
|---|
| 3 | 
 | 
|---|
| 4 | /*!
 | 
|---|
| 5 |  * \ingroup PMixer
 | 
|---|
| 6 |  * \file Sph2Sph.cc
 | 
|---|
| 7 |  *\brief   \b PROGRAM    \b Sph2Sphr  <BR>
 | 
|---|
| 8 |  * From a map with a given Nside to another map with
 | 
|---|
| 9 |  * another Nside -> this program performs the translation
 | 
|---|
| 10 |  * from one to the other (and reverse)
 | 
|---|
| 11 |  */
 | 
|---|
| 12 | 
 | 
|---|
| 13 | // -----------------------------------------------------------------
 | 
|---|
| 14 | static POutPersist * so = NULL;  // Debug PPFOut file
 | 
|---|
| 15 | 
 | 
|---|
| 16 | // -------------------------------------------------------------------------
 | 
|---|
| 17 | //                             main program 
 | 
|---|
| 18 | // -------------------------------------------------------------------------
 | 
|---|
| 19 | int main(int narg, char * arg[])
 | 
|---|
| 20 | {
 | 
|---|
| 21 |   if ((narg < 4) || ((narg > 1) && (strcmp(arg[1], "-h") == 0) )) {
 | 
|---|
| 22 |     cout << "  Usage: Sph2Sph FITS_sphIn nside_out FITS_sphOut [PPF_sphOut]" << endl;
 | 
|---|
| 23 |     exit(0);
 | 
|---|
| 24 |   }
 | 
|---|
| 25 |   InitTim();
 | 
|---|
| 26 |   
 | 
|---|
| 27 |   so = NULL;
 | 
|---|
| 28 |   double moy,sig;
 | 
|---|
| 29 |   int hp_nside = 16;
 | 
|---|
| 30 |   SphereHEALPix<float> InSph(hp_nside);
 | 
|---|
| 31 |   FITS_SphereHEALPix<float> fios(&InSph);
 | 
|---|
| 32 |   fios.Read(arg[1],2);
 | 
|---|
| 33 |   
 | 
|---|
| 34 |   MeanSig(InSph.DataBlock(), moy, sig );
 | 
|---|
| 35 |   cout << "Number of Pixels (input)  ->" <<  InSph.NbPixels() << endl;
 | 
|---|
| 36 |   cout << "MeanSig of Input Map      ->" << moy << " " << sig << endl;
 | 
|---|
| 37 | 
 | 
|---|
| 38 |   string nSide = arg[2];
 | 
|---|
| 39 |   int nsideOut = atof(nSide.c_str());
 | 
|---|
| 40 |   SphereHEALPix<float> outgs(nsideOut);
 | 
|---|
| 41 |   Sph2Sph(InSph,outgs);
 | 
|---|
| 42 |   // Saving the output map in FITS format 
 | 
|---|
| 43 |   FITS_SphereHEALPix<float> fios2(&outgs);
 | 
|---|
| 44 |   fios2.Write(arg[3]);
 | 
|---|
| 45 | 
 | 
|---|
| 46 |   MeanSig(outgs.DataBlock(), moy, sig );
 | 
|---|
| 47 |   cout << "Number of Pixels (output) ->" <<  outgs.NbPixels() << endl;
 | 
|---|
| 48 |   cout << "MeanSig of Output Map     ->" << moy << " " << sig << endl;
 | 
|---|
| 49 |   
 | 
|---|
| 50 |   PrtTim("End of WriteFITS ");
 | 
|---|
| 51 |   // Saving the output map in PPF format 
 | 
|---|
| 52 |   if (narg > 4) {
 | 
|---|
| 53 |     POutPersist s(arg[4]); 
 | 
|---|
| 54 |     FIO_SphereHEALPix<float> fiog(&outgs) ;
 | 
|---|
| 55 |     fiog.Write(s);
 | 
|---|
| 56 |     cout << "Output Map (SphereHEALPix<float>) written to POutPersist file "  
 | 
|---|
| 57 |          << (string)(arg[3]) << endl;
 | 
|---|
| 58 |     PrtTim("End of WritePPF ");
 | 
|---|
| 59 |   }
 | 
|---|
| 60 |   if (so) delete so;  //  Closing the debug ppf file 
 | 
|---|
| 61 | }
 | 
|---|