32 #include "paramfile.h" 35 #include "healpix_data_io.h" 40 #include "levels_facilities.h" 42 #include "lsconstants.h" 48 template<
typename T>
void udgrade_harmonic_cxx (paramfile ¶ms)
50 string infile = params.template find<string>(
"infile");
51 string outfile = params.template find<string>(
"outfile");
52 int nlmax = params.template find<int>(
"nlmax");
53 int nside = params.template find<int>(
"nside");
54 string pixwin_in = params.template find<string>(
"pixwin_in",
"");
55 string pixwin_out = params.template find<string>(
"pixwin_out",
"");
56 int num_iter = params.template find<int>(
"iter_order",0);
57 bool polarisation = params.template find<bool>(
"polarisation",
false);
58 bool do_pwgt = params.param_present(
"pixelweights");
59 planck_assert(!(params.param_present(
"ringweights")&&do_pwgt),
60 "both pixel and ring weights specified");
61 planck_assert((num_iter==0)||(!do_pwgt),
62 "iterative analysis cannot be done in combination with pixel weights");
74 auto pwgt = read_fullweights_from_fits(
75 params.template find<string>(
"pixelweights"), map.
Nside());
80 get_ring_weights (params,map.
Nside(),weight);
86 arr<double> temp(nlmax+1);
89 read_pixwin(pixwin_in,temp);
90 for (
int l=0; l<=nlmax; ++l)
96 read_pixwin(pixwin_out,temp);
100 alm(0,0) += T(avg*sqrt(fourpi));
116 auto pwgt = read_fullweights_from_fits(
117 params.template find<string>(
"pixelweights"), mapT.
Nside());
124 get_ring_weights (params,mapT.
Nside(),weight);
126 Alm<xcomplex<T> > almT(nlmax,nlmax), almG(nlmax,nlmax), almC(nlmax,nlmax);
131 (mapT,mapQ,mapU,almT,almG,almC,num_iter,weight);
133 arr<double> temp(nlmax+1), pol(nlmax+1);
136 read_pixwin(pixwin_in,temp,pol);
137 for (
int l=0; l<=nlmax; ++l)
138 { temp[l] = 1/temp[l];
if (pol[l]!=0.) pol[l] = 1/pol[l]; }
139 almT.ScaleL(temp); almG.ScaleL(pol); almC.ScaleL(pol);
143 read_pixwin(pixwin_out,temp,pol);
144 almT.ScaleL(temp); almG.ScaleL(pol); almC.ScaleL(pol);
147 almT(0,0) += T(avg*sqrt(fourpi));
159 int udgrade_harmonic_cxx_module (
int argc,
const char **argv)
161 module_startup (
"udgrade_harmonic_cxx", argc, argv);
162 paramfile params (getParamsFromCmdline(argc,argv));
164 bool dp = params.find<
bool> (
"double_precision",
false);
165 dp ? udgrade_harmonic_cxx<double>(params)
166 : udgrade_harmonic_cxx<float> (params);
void SetNside(int nside, Healpix_Ordering_Scheme scheme)
void map2alm_pol_iter(const Healpix_Map< T > &mapT, const Healpix_Map< T > &mapQ, const Healpix_Map< T > &mapU, Alm< xcomplex< T > > &almT, Alm< xcomplex< T > > &almG, Alm< xcomplex< T > > &almC, int num_iter, const arr< double > &weight)
void apply_fullweights(Healpix_Map< T > &map, const std::vector< double > &wgt)
void read_Healpix_map_from_fits(fitshandle &inp, Healpix_Map< T > &map, int colnum)
void alm2map_pol(const Alm< xcomplex< T > > &almT, const Alm< xcomplex< T > > &almG, const Alm< xcomplex< T > > &almC, Healpix_Map< T > &mapT, Healpix_Map< T > &mapQ, Healpix_Map< T > &mapU, bool add_map)
Healpix_Ordering_Scheme Scheme() const
void write_Healpix_map_to_fits(fitshandle &out, const Healpix_Map< T > &map, PDT datatype)
void map2alm_iter(const Healpix_Map< T > &map, Alm< xcomplex< T > > &alm, int num_iter, const arr< double > &weight)
void alm2map(const Alm< xcomplex< T > > &alm, Healpix_Map< T > &map, bool add_map)