33 #include "paramfile.h" 34 #include "healpix_data_io.h" 41 #include "fitshandle.h" 42 #include "levels_facilities.h" 43 #include "lsconstants.h" 45 #include "planck_rng.h" 51 template<
typename T>
void alm2map_cxx (paramfile ¶ms)
53 int nlmax = params.template find<int>(
"nlmax");
54 int nmmax = params.template find<int>(
"nmmax",nlmax);
55 planck_assert(nmmax<=nlmax,
"nmmax must not be larger than nlmax");
56 string infile = params.template find<string>(
"infile");
57 string outfile = params.template find<string>(
"outfile");
58 int nside = params.template find<int>(
"nside");
59 double fwhm = arcmin2rad*params.template find<double>(
"fwhm_arcmin",0);
60 int cw_lmin=-1, cw_lmax=-1;
61 if (params.param_present(
"cw_lmin"))
63 cw_lmin = params.template find<int>(
"cw_lmin");
64 cw_lmax = params.template find<int>(
"cw_lmax");
67 arr<double> temp, pol;
68 get_pixwin (params,nlmax,temp,pol);
70 bool deriv = params.template find<bool>(
"derivatives",
false);
75 if (fwhm>0) smoothWithGauss (alm, fwhm);
76 if (cw_lmin>=0) applyCosineWindow(alm, cw_lmin, cw_lmax);
78 mapdth(nside,
RING,SET_NSIDE),
79 mapdph(nside,
RING,SET_NSIDE);
82 double offset = alm(0,0).real()/sqrt(fourpi);
90 bool polarisation = params.template find<bool>(
"polarisation");
91 bool do_regnoise = params.param_present(
"regnoiseT");
96 if (fwhm>0) smoothWithGauss (alm, fwhm);
97 if (cw_lmin>=0) applyCosineWindow(alm, cw_lmin, cw_lmax);
101 double offset = alm(0,0).real()/sqrt(fourpi);
107 planck_rng rng(params.template find<int>(
"rand_seed",42));
108 double rms = params.template find<double>(
"regnoiseT");
109 for (
int i=0; i<map.Npix(); ++i)
110 map[i] += rms*rng.rand_gauss();
118 if (fwhm>0) smoothWithGauss (almT, almG, almC, fwhm);
119 if (cw_lmin>=0) applyCosineWindow(almT, almG, almC, cw_lmin, cw_lmax);
121 mapU(nside,
RING,SET_NSIDE);
125 double offset = almT(0,0).real()/sqrt(fourpi);
131 planck_rng rng(params.template find<int>(
"rand_seed",42));
132 double rmsT = params.template find<double>(
"regnoiseT"),
133 rmsQU = params.template find<double>(
"regnoiseQU");
134 for (
int i=0; i<mapT.Npix(); ++i)
136 mapT[i] += rmsT *rng.rand_gauss();
137 mapQ[i] += rmsQU*rng.rand_gauss();
138 mapU[i] += rmsQU*rng.rand_gauss();
147 int alm2map_cxx_module (
int argc,
const char **argv)
149 module_startup (
"alm2map_cxx", argc, argv);
150 paramfile params (getParamsFromCmdline(argc,argv));
152 bool dp = params.find<
bool> (
"double_precision",
false);
153 dp ? alm2map_cxx<double>(params) : alm2map_cxx<float>(params);
void alm2map_der1(const Alm< xcomplex< T > > &alm, Healpix_Map< T > &map, Healpix_Map< T > &mapdth, Healpix_Map< T > &mapdph)
void ScaleL(const arr< T2 > &factor)
void read_Alm_from_fits(fitshandle &inp, Alm< xcomplex< T > > &alms, int lmax, int mmax)
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)
void write_Healpix_map_to_fits(fitshandle &out, const Healpix_Map< T > &map, PDT datatype)
void alm2map(const Alm< xcomplex< T > > &alm, Healpix_Map< T > &map, bool add_map)