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 "healpix_data_io.h"
00033 #include "arr.h"
00034 #include "fitshandle.h"
00035 #include "paramfile.h"
00036 #include "simparams.h"
00037
00038 using namespace std;
00039
00040 void read_weight_ring (const string &dir, int nside, arr<double> &weight)
00041 {
00042 fitshandle inp;
00043 inp.open(dir+"/weight_ring_n"+intToString(nside,5)+".fits");
00044 inp.goto_hdu(2);
00045 weight.alloc (2*nside);
00046 inp.read_column(1,weight);
00047 }
00048
00049 void get_ring_weights (paramfile ¶ms, simparams &par, int nside,
00050 arr<double> &weight)
00051 {
00052 bool weighted = params.find<bool>("weighted",false);
00053 par.add ("weighted","WEIGHTED",weighted,"ring weights used?");
00054 weight.alloc (2*nside);
00055 if (weighted)
00056 {
00057 string datadir = params.find<string>("healpix_data");
00058 read_weight_ring (datadir, nside, weight);
00059 for (int m=0; m<weight.size(); ++m) weight[m]+=1;
00060 }
00061 else
00062 weight.fill(1);
00063 }
00064
00065 void read_pixwin (const string &dir, int nside, arr<double> &temp)
00066 {
00067 fitshandle inp;
00068 inp.open(dir+"/pixel_window_n"+intToString(nside,4)+".fits");
00069 inp.goto_hdu(2);
00070 if (temp.size()==0)
00071 inp.read_entire_column(1,temp);
00072 else
00073 inp.read_column(1,temp);
00074 }
00075 void read_pixwin (const string &dir, int nside, arr<double> &temp,
00076 arr<double> &pol)
00077 {
00078 fitshandle inp;
00079 inp.open(dir+"/pixel_window_n"+intToString(nside,4)+".fits");
00080 inp.goto_hdu(2);
00081 if (temp.size()==0)
00082 inp.read_entire_column(1,temp);
00083 else
00084 inp.read_column(1,temp);
00085 if (pol.size()==0)
00086 inp.read_entire_column(2,pol);
00087 else
00088 inp.read_column(2,pol);
00089 }
00090
00091 void get_pixwin (paramfile ¶ms, simparams &par, int lmax,
00092 int nside, arr<double> &pixwin)
00093 {
00094 bool do_pixwin = params.find<bool>("pixel_window",false);
00095 par.add("pixel_window","PIXWIN",do_pixwin,"pixel window used?");
00096 pixwin.alloc(lmax+1);
00097 pixwin.fill(1);
00098 if (do_pixwin)
00099 {
00100 string datadir = params.find<string>("healpix_data");
00101 read_pixwin (datadir,nside,pixwin);
00102 }
00103 }
00104 void get_pixwin (paramfile ¶ms, simparams &par, int lmax,
00105 int nside, arr<double> &pixwin, arr<double> &pixwin_pol)
00106 {
00107 bool do_pixwin = params.find<bool>("pixel_window",false);
00108 par.add("pixel_window","PIXWIN",do_pixwin,"pixel window used?");
00109 pixwin.alloc(lmax+1);
00110 pixwin.fill(1);
00111 pixwin_pol.alloc(lmax+1);
00112 pixwin_pol.fill(1);
00113 if (do_pixwin)
00114 {
00115 string datadir = params.find<string>("healpix_data");
00116 read_pixwin (datadir,nside,pixwin,pixwin_pol);
00117 }
00118 }