33 #include "fitshandle.h" 37 template<
typename T> Moc<T> read_Moc_from_fits
38 (
const std::string &filename,
bool peano)
44 inp.read_entire_column(1,data);
46 Moc<T>::uniq_nest2peano(data);
47 return Moc<T>::fromUniq(data);
50 template Moc<int> read_Moc_from_fits
51 (
const std::string &filename,
bool peano);
52 template Moc<int64> read_Moc_from_fits
53 (
const std::string &filename,
bool peano);
55 template<
typename T>
void write_Moc_to_fits
56 (
const std::string &outfile,
const Moc<T> &moc,
bool peano)
58 PDT outtype=PLANCK_INT16;
59 vector<T> data=moc.toUniq();
61 Moc<T>::uniq_peano2nest(data);
64 if (data.back()>0x7fff) outtype=PLANCK_INT32;
65 if (data.back()>0x7fffffffLL) outtype=PLANCK_INT64;
69 vector<fitscolumn> cols;
70 cols.push_back (fitscolumn (
"PIXEL",
"",1,outtype));
71 out.insert_bintab(cols);
72 out.set_key(
"PIXTYPE",
string(
"HEALPIX"),
"HEALPix magic value");
73 out.set_key(
"ORDERING",
string(
"NUNIQ"),
"NUNIQ coding method");
74 out.set_key(
"COORDSYS",
string(
"C"),
"mandated by MOC standard");
75 out.set_key<
int>(
"MOCORDER", moc.maxOrder(),
"MOC resolution (best order)");
76 out.write_column(1,data);
79 template void write_Moc_to_fits
80 (
const std::string &outfile,
const Moc<int> &moc,
bool peano);
81 template void write_Moc_to_fits
82 (
const std::string &outfile,
const Moc<int64> &moc,
bool peano);