00001 /* 00002 * This file is part of Healpix_cxx. 00003 * 00004 * Healpix_cxx is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * Healpix_cxx is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with Healpix_cxx; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 * 00018 * For more information about HEALPix, see http://healpix.jpl.nasa.gov 00019 */ 00020 00021 /* 00022 * Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik 00023 * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt 00024 * (DLR). 00025 */ 00026 00027 /*! \file alm_map_tools.h 00028 * Copyright (C) 2003, 2004, 2005 Max-Planck-Society 00029 * \author Martin Reinecke 00030 */ 00031 00032 #ifndef HEALPIX_ALM_MAP_TOOLS_H 00033 #define HEALPIX_ALM_MAP_TOOLS_H 00034 00035 #include "xcomplex.h" 00036 #include "arr.h" 00037 00038 template<typename T> class Alm; 00039 template<typename T> class Healpix_Map; 00040 00041 /*! \defgroup alm_map_group Conversions between a_lm and maps */ 00042 /*! \{ */ 00043 00044 /*! Converts a Healpix map to a set of a_lms. 00045 \param map the input map, which must have RING ordering 00046 \param alm the output a_lms. l_max and m_max of the conversion are 00047 determined from this object. 00048 \param weight array containing the weights for the individual rings of 00049 the map. It must have at least 2*\a map.Nside() entries. 00050 \param add_alm If this is \a true, then the computed a_lm are added 00051 to the values already residing in \a alm. */ 00052 template<typename T> void map2alm (const Healpix_Map<T> &map, 00053 Alm<xcomplex<T> > &alm, const arr<double> &weight, 00054 bool add_alm=false); 00055 00056 /*! Converts a Healpix map to a set of a_lms, using an iterative scheme 00057 which is more accurate than plain map2alm(). 00058 \param map the input map, which must have RING ordering. 00059 \param alm the output a_lms. l_max and m_max of the conversion are 00060 determined from this object. 00061 \param num_iter the number of iterations (0 is identical to map2alm()). 00062 \param weight array containing the weights for the individual rings of 00063 the map. It must have at least 2*\a map.Nside() entries. */ 00064 template<typename T> void map2alm_iter (const Healpix_Map<T> &map, 00065 Alm<xcomplex<T> > &alm, int num_iter, const arr<double> &weight); 00066 00067 template<typename T> void map2alm_iter (const Healpix_Map<T> &map, 00068 Alm<xcomplex<T> > &alm, int num_iter) 00069 { 00070 arr<double> wgt(2*map.Nside()); 00071 wgt.fill(1); 00072 map2alm_iter(map,alm,num_iter,wgt); 00073 } 00074 00075 template<typename T> void map2alm_iter2 (const Healpix_Map<T> &map, 00076 Alm<xcomplex<T> > &alm, double err_abs, double err_rel); 00077 00078 /*! Converts Healpix maps containing the I, Q and U Stokes parameters 00079 to sets of a_lms. 00080 \param mapT the I-Stokes parameter input map 00081 \param mapQ the Q-Stokes parameter input map 00082 \param mapU the U-Stokes parameter input map 00083 \note All maps must have the same nside, and must be in RING scheme. 00084 \param almT the output temperature a_lms 00085 \param almG the output gradient a_lms 00086 \param almC the output curl a_lms 00087 \note all a_lm sets must have the the same lmax and mmax. 00088 \param weightT ring weights for \a mapT. 00089 \param weightQ ring weights for \a mapQ. 00090 \param weightU ring weights for \a mapU. 00091 \param add_alm If this is \a true, then the computed a_lm are added 00092 to the values already residing in \a alm. 00093 \note The weight arrays must have at least 2*\a mapT.Nside() entries. */ 00094 template<typename T> void map2alm_pol 00095 (const Healpix_Map<T> &mapT, 00096 const Healpix_Map<T> &mapQ, 00097 const Healpix_Map<T> &mapU, 00098 Alm<xcomplex<T> > &almT, 00099 Alm<xcomplex<T> > &almG, 00100 Alm<xcomplex<T> > &almC, 00101 const arr<double> &weightT, 00102 const arr<double> &weightQ, 00103 const arr<double> &weightU, 00104 bool add_alm=false); 00105 /*! Converts Healpix maps containing the I, Q and U Stokes parameters 00106 to sets of a_lms, using an iterative scheme which is more accurate than 00107 plain map2alm_pol(). 00108 \param mapT the I-Stokes parameter input map 00109 \param mapQ the Q-Stokes parameter input map 00110 \param mapU the U-Stokes parameter input map 00111 \note All maps must have the same nside, and must be in RING scheme. 00112 \param almT the output temperature a_lms 00113 \param almG the output gradient a_lms 00114 \param almC the output curl a_lms 00115 \note all a_lm sets must have the the same lmax and mmax. 00116 \param num_iter the number of iterations (0 is identical to map2alm_pol()). 00117 \param weightT ring weights for \a mapT. 00118 \param weightQ ring weights for \a mapQ. 00119 \param weightU ring weights for \a mapU. 00120 \note The weight arrays must have at least 2*\a mapT.Nside() entries. */ 00121 template<typename T> void map2alm_pol_iter 00122 (const Healpix_Map<T> &mapT, 00123 const Healpix_Map<T> &mapQ, 00124 const Healpix_Map<T> &mapU, 00125 Alm<xcomplex<T> > &almT, 00126 Alm<xcomplex<T> > &almG, 00127 Alm<xcomplex<T> > &almC, 00128 int num_iter, 00129 const arr<double> &weightT, 00130 const arr<double> &weightQ, 00131 const arr<double> &weightU); 00132 00133 template<typename T> void map2alm_pol_iter 00134 (const Healpix_Map<T> &mapT, 00135 const Healpix_Map<T> &mapQ, 00136 const Healpix_Map<T> &mapU, 00137 Alm<xcomplex<T> > &almT, 00138 Alm<xcomplex<T> > &almG, 00139 Alm<xcomplex<T> > &almC, 00140 int num_iter) 00141 { 00142 arr<double> wgt(2*mapT.Nside()); 00143 wgt.fill(1); 00144 map2alm_pol_iter(mapT,mapQ,mapU,almT,almG,almC,num_iter,wgt,wgt,wgt); 00145 } 00146 00147 template<typename T> void map2alm_pol_iter2 00148 (const Healpix_Map<T> &mapT, 00149 const Healpix_Map<T> &mapQ, 00150 const Healpix_Map<T> &mapU, 00151 Alm<xcomplex<T> > &almT, 00152 Alm<xcomplex<T> > &almG, 00153 Alm<xcomplex<T> > &almC, 00154 double err_abs, double err_rel); 00155 00156 /*! Converts a a set of a_lm to a HEALPix map. 00157 \param alm the input a_lms. l_max and m_max of the conversion are 00158 determined from this object. 00159 \param map the output map, which must have RING ordering. */ 00160 template<typename T> void alm2map (const Alm<xcomplex<T> > &alm, 00161 Healpix_Map<T> &map); 00162 00163 /*! Converts a a set of polarised a_lm to a HEALPix map. 00164 \param almT the input temperature a_lms 00165 \param almG the input gradient a_lms 00166 \param almC the input curl a_lms 00167 \param mapT the I-Stokes parameter output map 00168 \param mapQ the Q-Stokes parameter output map 00169 \param mapU the U-Stokes parameter output map */ 00170 template<typename T> void alm2map_pol 00171 (const Alm<xcomplex<T> > &almT, 00172 const Alm<xcomplex<T> > &almG, 00173 const Alm<xcomplex<T> > &almC, 00174 Healpix_Map<T> &mapT, 00175 Healpix_Map<T> &mapQ, 00176 Healpix_Map<T> &mapU); 00177 00178 /*! Converts a a set of a_lm to a HEALPix map and its first derivatives. 00179 \param alm the input a_lms. l_max and m_max of the conversion are 00180 determined from this object. 00181 \param map the output map, which must have RING ordering. 00182 \param mapdth an output map containing \f$d (\mbox{map})/d\vartheta\f$, 00183 which must have RING ordering. 00184 \param mapdph an output map containing 00185 \f$(\sin\vartheta)^{-1}d(\mbox{map})/d\varphi\f$, 00186 which must have RING ordering. */ 00187 template<typename T> void alm2map_der1 00188 (const Alm<xcomplex<T> > &alm, 00189 Healpix_Map<T> &map, 00190 Healpix_Map<T> &mapdth, 00191 Healpix_Map<T> &mapdph); 00192 00193 /*! \} */ 00194 00195 #endif