39 int compute_weights_module (
int argc,
const char **argv)
45 || params.param_present(
"outfile_full"),
"no job requested");
46 int nside = params.find<
int>(
"nside");
47 int nlmax = params.find<
int>(
"nlmax");
50 cout <<
"Warning: specified nlmax is odd. Reducing by 1" << endl;
53 double epsilon = params.find<
double>(
"epsilon",1e-7);
54 int itmax = params.find<
int>(
"max_iter",10000);
56 if (params.param_present(
"outfile_ring"))
59 vector<double> wgt=
get_ringweights(nside,nlmax,epsilon,itmax,epsilon_out);
61 out.
create (params.find<
string>(
"outfile_ring"));
62 vector<fitscolumn> cols;
64 cols.push_back (
fitscolumn (
"TEMPERATURE WEIGHTS",
"1",repcount,
66 cols.push_back (
fitscolumn (
"Q-POLARISATION WEIGHTS",
"1",repcount,
68 cols.push_back (
fitscolumn (
"U-POLARISATION WEIGHTS",
"1",repcount,
71 out.
set_key (
"CREATOR",
string(
"compute_weights"),
72 "Software creating the FITS file");
73 out.
set_key (
"NSIDE",nside,
"Resolution parameter for HEALPIX");
74 out.
set_key (
"MAX_LPOL",nlmax,
"Maximum multipole l used in map synthesis");
75 double val=*max_element(wgt.begin(),wgt.end());
76 out.
set_key(
"MAXVAL1",val,
"maximum value of T weights");
77 out.
set_key(
"MAXVAL2",val,
"maximum value of Q weights");
78 out.
set_key(
"MAXVAL3",val,
"maximum value of U weights");
79 val=*min_element(wgt.begin(),wgt.end());
80 out.
set_key(
"MINVAL1",val,
"minimum value of T weights");
81 out.
set_key(
"MINVAL2",val,
"minimum value of Q weights");
82 out.
set_key(
"MINVAL3",val,
"minimum value of U weights");
83 out.
set_key(
"EPSILON",epsilon_out,
"epsilon reached after minimization");
88 if (params.param_present(
"outfile_full"))
91 vector<double> wgt=
get_fullweights(nside,nlmax,epsilon,itmax,epsilon_out);
93 out.
create (params.find<
string>(
"outfile_full"));
94 vector<fitscolumn> cols;
96 cols.push_back (
fitscolumn (
"COMPRESSED PIXEL WEIGHTS",
"1",repcount,
99 out.
set_key (
"CREATOR",
string(
"compute_weights"),
100 "Software creating the FITS file");
101 out.
set_key (
"NSIDE",nside,
"Resolution parameter for HEALPix");
102 out.
set_key (
"MAX_LPOL",nlmax,
"Maximum l multipole");
103 double val=*max_element(wgt.begin(),wgt.end());
104 out.
set_key(
"MAXVAL1",val,
"maximum value of pixel weights");
105 val=*min_element(wgt.begin(),wgt.end());
106 out.
set_key(
"MINVAL1",val,
"minimum value of pixel weights");
107 out.
set_key(
"EPSILON",epsilon_out,
"epsilon reached after minimization");
void create(const std::string &fname)
vector< double > get_fullweights(int nside, int lmax, double epsilon, int itmax, double &epsilon_out)
void insert_bintab(const std::vector< fitscolumn > &cols, const std::string &extname="xtension")
void write_column(int colnum, const arr< T > &data, int64 offset=0)
void set_key(const std::string &name, const T &value, const std::string &comment="")
paramfile getParamsFromCmdline(int argc, const char **argv, bool verbose=true)
void module_startup(const std::string &name, bool argc_valid, const std::string &usage, bool verbose=true)
#define planck_assert(testval, msg)
vector< double > get_ringweights(int nside, int lmax, double epsilon, int itmax, double &epsilon_out)