33 #include "paramfile.h" 34 #include "healpix_data_io.h" 44 #include "fitshandle.h" 45 #include "levels_facilities.h" 46 #include "lsconstants.h" 53 template<
typename T>
void anafast_cxx (paramfile ¶ms)
55 int nlmax = params.template find<int>(
"nlmax");
56 int nmmax = params.template find<int>(
"nmmax",nlmax);
57 string infile = params.template find<string>(
"infile");
58 string outfile = params.template find<string>(
"outfile",
"");
59 string outfile_alms = params.template find<string>(
"outfile_alms",
"");
60 planck_assert ((outfile!=
"") || (outfile_alms!=
""),
61 "no output specified, nothing done");
62 bool polarisation = params.template find<bool>(
"polarisation");
63 int num_iter = params.template find<int>(
"iter_order",0);
64 bool remove_mono = params.template find<bool>(
"remove_monopole",
false);
65 bool do_pwgt = params.param_present(
"pixelweights");
66 planck_assert(!(params.param_present(
"ringweights")&&do_pwgt),
67 "both pixel and ring weights specified");
68 planck_assert((num_iter==0)||(!do_pwgt),
69 "iterative analysis cannot be done in combination with pixel weights");
78 cout <<
"WARNING: replaced " << nmod <<
79 " undefined map pixels with a value of 0" << endl;
90 auto pwgt = read_fullweights_from_fits(
91 params.template find<string>(
"pixelweights"), map.
Nside());
96 get_ring_weights (params,map.
Nside(),weight);
102 alm(0,0) += T(avg*sqrt(fourpi));
110 if (outfile_alms!=
"")
121 cout <<
"WARNING: replaced " << nmod <<
122 " undefined map pixels with a value of 0" << endl;
133 auto pwgt = read_fullweights_from_fits(
134 params.template find<string>(
"pixelweights"), mapT.
Nside());
141 get_ring_weights (params,mapT.
Nside(),weight);
143 Alm<xcomplex<T> > almT(nlmax,nmmax), almG(nlmax,nmmax), almC(nlmax,nmmax);
148 (mapT,mapQ,mapU,almT,almG,almC,num_iter,weight);
150 almT(0,0) += T(avg*sqrt(fourpi));
156 params.template find<bool>(
"full_powerspectrum",
false) ?
160 if (outfile_alms!=
"")
167 int anafast_cxx_module (
int argc,
const char **argv)
169 module_startup (
"anafast_cxx", argc, argv);
170 paramfile params (getParamsFromCmdline(argc,argv));
172 bool dp = params.find<
bool> (
"double_precision",
false);
173 dp ? anafast_cxx<double>(params) : anafast_cxx<float>(params);
void write_Alm_to_fits(fitshandle &out, const Alm< xcomplex< T > > &alms, int lmax, int mmax, PDT datatype)
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)
tsize replaceUndefWith0()
Healpix_Ordering_Scheme Scheme() const
void extract_powspec(const Alm< xcomplex< T > > &alm, PowSpec &powspec)
void map2alm_iter(const Healpix_Map< T > &map, Alm< xcomplex< T > > &alm, int num_iter, const arr< double > &weight)
void write_powspec_to_fits(fitshandle &out, const PowSpec &powspec, int nspecs)