NASA - Jet Propulsion Laboratory
    + View the NASA Portal
Search JPL
Jet Propulsion Laboratory Home Earth Solar System Stars & Galaxies Technology
Introduction Background Software Links

calc_powspec.cc

00001 /*
00002  *  This file is part of Healpix_cxx.
00003  *
00004  *  Healpix_cxx is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  Healpix_cxx is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with Healpix_cxx; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017  *
00018  *  For more information about HEALPix, see http://healpix.jpl.nasa.gov
00019  */
00020 
00021 /*
00022  *  Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
00023  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
00024  *  (DLR).
00025  */
00026 
00027 /*
00028  *  Copyright (C) 2004 Max-Planck-Society
00029  *  Author: Martin Reinecke
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   }

Generated on Fri Jun 18 16:12:30 2010 for Healpix C++
Privacy / Copyright
FIRST GOV Contact: NASA Home Page Site Manager:
Webmaster:

CL 03-2650