34 #include "fitshandle.h" 41 planck_assert ((nspecs==1)||(nspecs==4)||(nspecs==6),
42 "wrong number of spectra");
44 arr<double> tt(lmax+1,0),gg(lmax+1,0),cc(lmax+1,0),tg(lmax+1,0),
45 tc(lmax+1,0),gc(lmax+1,0);
47 int lmax_file = safe_cast<
int>(inp.nelems(1)-1);
49 cerr <<
"warning: lmax in file smaller than expected; padding with 0." 51 int lmax_read = min (lmax,lmax_file);
52 inp.read_column_raw (1,&tt[0],lmax_read+1);
55 inp.read_column_raw (2,&gg[0],lmax_read+1);
56 inp.read_column_raw (3,&cc[0],lmax_read+1);
57 inp.read_column_raw (4,&tg[0],lmax_read+1);
61 inp.read_column_raw (5,&tc[0],lmax_read+1);
62 inp.read_column_raw (6,&gc[0],lmax_read+1);
65 if (nspecs==1) powspec.
Set(tt);
66 if (nspecs==4) powspec.
Set(tt,gg,cc,tg);
67 if (nspecs==6) powspec.
Set(tt,gg,cc,tg,tc,gc);
78 int nspecs,
int lmax,
int hdunum)
88 int nspecs,
int lmax,
int hdunum)
96 const PowSpec &powspec,
int nspecs)
98 planck_assert ((nspecs==1)||(nspecs==4)||(nspecs==6),
99 "incorrect number of spectra");
100 vector<fitscolumn> cols;
101 cols.push_back(fitscolumn(
"Temperature C_l",
"unknown",1,PLANCK_FLOAT64));
104 cols.push_back(fitscolumn(
"E-mode C_l",
"unknown",1,PLANCK_FLOAT64));
105 cols.push_back(fitscolumn(
"B-mode C_l",
"unknown",1,PLANCK_FLOAT64));
106 cols.push_back(fitscolumn(
"T-E cross-corr.",
"unknown",1,
111 cols.push_back(fitscolumn(
"T-B cross-corr.",
"unknown",1,PLANCK_FLOAT64));
112 cols.push_back(fitscolumn(
"E-B cross-corr.",
"unknown",1,PLANCK_FLOAT64));
114 out.insert_bintab(cols);
115 out.write_column(1,powspec.
tt());
118 out.write_column(2,powspec.
gg());
119 out.write_column(3,powspec.
cc());
120 out.write_column(4,powspec.
tg());
124 out.write_column(5,powspec.
tc());
125 out.write_column(6,powspec.
gc());
130 const PowSpec &powspec,
int nspecs)
void Set(int nspec, int lmax)
const arr< double > & gg() const
const arr< double > & tc() const
const arr< double > & tt() const
const arr< double > & tg() const
const arr< double > & cc() const
void read_powspec_from_fits(fitshandle &inp, PowSpec &powspec, int nspecs, int lmax)
const arr< double > & gc() const
void write_powspec_to_fits(fitshandle &out, const PowSpec &powspec, int nspecs)