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