32 #include "paramfile.h" 35 #include "fitshandle.h" 36 #include "levels_facilities.h" 37 #include "geom_utils.h" 45 double alpha (
const pointing &p1,
const pointing &p2)
49 return orientation (v2, dir) - orientation (v1,dir);
57 planck_assert(q2.
Nside()<q1.
Nside(),
"this is no degrade");
60 "the larger Nside must be a multiple of the smaller one");
62 int minhits = pessimistic ? fact*fact : 1;
65 int m, npix=q2.
Npix();
66 #pragma omp for schedule (static) 67 for (m=0; m<npix; ++m)
72 xcomplex<double> sum = 0;
73 for (
int j=fact*y; j<fact*(y+1); ++j)
74 for (
int i=fact*x; i<fact*(x+1); ++i)
76 int opix = q1.xyf2pix(i,j,f);
81 xcomplex<double> val(q1[opix],u1[opix]);
83 xcomplex<double> mul(cos(2*ang),sin(2*ang));
93 template<
typename T>
void udgrade_cxx (paramfile ¶ms)
95 string infile = params.template find<string>(
"infile");
96 string outfile = params.template find<string>(
"outfile");
97 int nside = params.template find<int>(
"nside");
98 bool polarisation = params.template find<bool>(
"polarisation",
false);
99 bool pessimistic = params.template find<bool>(
"pessimistic",
false);
107 outmap.
Import(inmap,pessimistic);
115 outmapQ (nside,inmap.
Scheme(),SET_NSIDE),
116 outmapU (nside,inmap.
Scheme(),SET_NSIDE);
120 outmapT.
Import(inmap,pessimistic);
121 if ((outmapQ.Nside()<inmap.
Nside())
122 && params.template find<bool>(
"parallel_transport",
true))
124 cout <<
"Experimental: polarised degrade with parallel transport" << endl;
128 degrade_pol (inmap, inmap2, outmapQ, outmapU, pessimistic);
132 cout <<
"WARNING: polarised degrade without parallel transport" << endl;
134 outmapQ.Import(inmap,pessimistic);
136 outmapU.Import(inmap,pessimistic);
144 int udgrade_cxx_module (
int argc,
const char **argv)
146 module_startup (
"udgrade_cxx", argc, argv);
147 paramfile params (getParamsFromCmdline(argc,argv));
149 bool dp = params.find<
bool> (
"double_precision",
false);
150 dp ? udgrade_cxx<double>(params) : udgrade_cxx<float>(params);
void read_Healpix_map_from_fits(fitshandle &inp, Healpix_Map< T > &map, int colnum)
void Import(const Healpix_Map< T > &orig, bool pessimistic=false)
Healpix_Ordering_Scheme Scheme() const
void write_Healpix_map_to_fits(fitshandle &out, const Healpix_Map< T > &map, PDT datatype)
const double Healpix_undef
Healpix value representing "undefined".
bool conformable(const T_Healpix_Base &other) const
pointing pix2ang(I pix) const