calc_powspec.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "fitshandle.h"
00033 #include "alm.h"
00034 #include "alm_fitsio.h"
00035 #include "powspec.h"
00036 #include "powspec_fitsio.h"
00037 #include "alm_powspec_tools.h"
00038
00039 using namespace std;
00040
00041 int main (int argc, const char **argv)
00042 {
00043 PLANCK_DIAGNOSIS_BEGIN
00044 announce ("calc_powspec");
00045 planck_assert (argc==3||argc==4,
00046 "usage: calc_powspec <almfile1> [<almfile2>] <powspec_file>");
00047
00048 if (argc==3)
00049 {
00050 fitshandle inp;
00051 inp.open(argv[1]);
00052 inp.goto_hdu(2);
00053 int lmax,mmax;
00054 get_almsize(inp,lmax,mmax);
00055 Alm<xcomplex<float> > alm;
00056 read_Alm_from_fits (inp,alm,lmax,mmax);
00057 PowSpec powspec;
00058 extract_powspec (alm,powspec);
00059 fitshandle out;
00060 out.create (argv[2]);
00061 write_powspec_to_fits (out,powspec,1);
00062 }
00063 else
00064 {
00065 fitshandle inp;
00066 inp.open(argv[1]);
00067 inp.goto_hdu(2);
00068 int lmax,mmax;
00069 get_almsize(inp,lmax,mmax);
00070 Alm<xcomplex<float> > alm1;
00071 read_Alm_from_fits (inp,alm1,lmax,mmax);
00072 inp.close();
00073 inp.open(argv[2]);
00074 inp.goto_hdu(2);
00075 get_almsize(inp,lmax,mmax);
00076 Alm<xcomplex<float> > alm2;
00077 read_Alm_from_fits (inp,alm2,lmax,mmax);
00078 inp.close();
00079 PowSpec powspec;
00080 extract_crosspowspec (alm1,alm2,powspec);
00081 fitshandle out;
00082 out.create (argv[3]);
00083 write_powspec_to_fits (out,powspec,1);
00084 }
00085 PLANCK_DIAGNOSIS_END
00086 }