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.sourceforge.net 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_healpix_tools.h 00028 * Copyright (C) 2003-2011 Max-Planck-Society 00029 * \author Martin Reinecke 00030 */ 00031 00032 #ifndef HEALPIX_ALM_HEALPIX_TOOLS_H 00033 #define HEALPIX_ALM_HEALPIX_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_healpix_group Conversions between a_lm and HEALPix 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> inline void map2alm_iter (const Healpix_Map<T> &map, 00068 Alm<xcomplex<T> > &alm, int num_iter) 00069 { 00070 arr<double> wgt(2*map.Nside(),1.); 00071 map2alm_iter(map,alm,num_iter,wgt); 00072 } 00073 00074 template<typename T> void map2alm_iter2 (const Healpix_Map<T> &map, 00075 Alm<xcomplex<T> > &alm, double err_abs, double err_rel); 00076 00077 template<typename T> void map2alm_spin 00078 (const Healpix_Map<T> &map1, const Healpix_Map<T> &map2, 00079 Alm<xcomplex<T> > &alm1, Alm<xcomplex<T> > &alm2, 00080 int spin, const arr<double> &weight, bool add_alm); 00081 00082 template<typename T> void map2alm_spin_iter2 00083 (const Healpix_Map<T> &map1, const Healpix_Map<T> &map2, 00084 Alm<xcomplex<T> > &alm1, Alm<xcomplex<T> > &alm2, 00085 int spin, double err_abs, double err_rel); 00086 00087 /*! Converts Healpix maps containing the I, Q and U Stokes parameters 00088 to sets of a_lms. 00089 \param mapT the I-Stokes parameter input map 00090 \param mapQ the Q-Stokes parameter input map 00091 \param mapU the U-Stokes parameter input map 00092 \note All maps must have the same nside, and must be in RING scheme. 00093 \param almT the output temperature a_lms 00094 \param almG the output gradient a_lms 00095 \param almC the output curl a_lms 00096 \note all a_lm sets must have the the same lmax and mmax. 00097 \param weight ring weights for the maps. 00098 \param add_alm If this is \a true, then the computed a_lm are added 00099 to the values already residing in \a alm. 00100 \note The weight array must have at least 2*\a mapT.Nside() entries. */ 00101 template<typename T> void map2alm_pol 00102 (const Healpix_Map<T> &mapT, 00103 const Healpix_Map<T> &mapQ, 00104 const Healpix_Map<T> &mapU, 00105 Alm<xcomplex<T> > &almT, 00106 Alm<xcomplex<T> > &almG, 00107 Alm<xcomplex<T> > &almC, 00108 const arr<double> &weight, 00109 bool add_alm=false); 00110 /*! Converts Healpix maps containing the I, Q and U Stokes parameters 00111 to sets of a_lms, using an iterative scheme which is more accurate than 00112 plain map2alm_pol(). 00113 \param mapT the I-Stokes parameter input map 00114 \param mapQ the Q-Stokes parameter input map 00115 \param mapU the U-Stokes parameter input map 00116 \note All maps must have the same nside, and must be in RING scheme. 00117 \param almT the output temperature a_lms 00118 \param almG the output gradient a_lms 00119 \param almC the output curl a_lms 00120 \note all a_lm sets must have the the same lmax and mmax. 00121 \param num_iter the number of iterations (0 is identical to map2alm_pol()). 00122 \param weight ring weights for the maps. 00123 \note The weight array must have at least 2*\a mapT.Nside() entries. */ 00124 template<typename T> void map2alm_pol_iter 00125 (const Healpix_Map<T> &mapT, 00126 const Healpix_Map<T> &mapQ, 00127 const Healpix_Map<T> &mapU, 00128 Alm<xcomplex<T> > &almT, 00129 Alm<xcomplex<T> > &almG, 00130 Alm<xcomplex<T> > &almC, 00131 int num_iter, 00132 const arr<double> &weight); 00133 00134 template<typename T> inline void map2alm_pol_iter 00135 (const Healpix_Map<T> &mapT, 00136 const Healpix_Map<T> &mapQ, 00137 const Healpix_Map<T> &mapU, 00138 Alm<xcomplex<T> > &almT, 00139 Alm<xcomplex<T> > &almG, 00140 Alm<xcomplex<T> > &almC, 00141 int num_iter) 00142 { 00143 arr<double> wgt(2*mapT.Nside(),1.); 00144 map2alm_pol_iter(mapT,mapQ,mapU,almT,almG,almC,num_iter,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 template<typename T> void alm2map_spin 00164 (const Alm<xcomplex<T> > &alm1, const Alm<xcomplex<T> > &alm2, 00165 Healpix_Map<T> &map1, Healpix_Map<T> &map2, int spin); 00166 00167 /*! Converts a a set of polarised a_lm to a HEALPix map. 00168 \param almT the input temperature a_lms 00169 \param almG the input gradient a_lms 00170 \param almC the input curl a_lms 00171 \param mapT the I-Stokes parameter output map 00172 \param mapQ the Q-Stokes parameter output map 00173 \param mapU the U-Stokes parameter output map */ 00174 template<typename T> void alm2map_pol 00175 (const Alm<xcomplex<T> > &almT, 00176 const Alm<xcomplex<T> > &almG, 00177 const Alm<xcomplex<T> > &almC, 00178 Healpix_Map<T> &mapT, 00179 Healpix_Map<T> &mapQ, 00180 Healpix_Map<T> &mapU); 00181 00182 /*! Converts a a set of a_lm to a HEALPix map and its first derivatives. 00183 \param alm the input a_lms. l_max and m_max of the conversion are 00184 determined from this object. 00185 \param map the output map, which must have RING ordering. 00186 \param mapdth an output map containing \f$d (\mbox{map})/d\vartheta\f$, 00187 which must have RING ordering. 00188 \param mapdph an output map containing 00189 \f$(\sin\vartheta)^{-1}d(\mbox{map})/d\varphi\f$, 00190 which must have RING ordering. */ 00191 template<typename T> void alm2map_der1 00192 (const Alm<xcomplex<T> > &alm, 00193 Healpix_Map<T> &map, 00194 Healpix_Map<T> &mapdth, 00195 Healpix_Map<T> &mapdph); 00196 00197 /*! \} */ 00198 00199 #endif