Healpix C++  3.83
alm_healpix_tools.h
Go to the documentation of this file.
1 /*
2  * This file is part of Healpix_cxx.
3  *
4  * Healpix_cxx is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * Healpix_cxx is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Healpix_cxx; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * For more information about HEALPix, see http://healpix.sourceforge.net
19  */
20 
21 /*
22  * Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
23  * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
24  * (DLR).
25  */
26 
27 /*! \file alm_healpix_tools.h
28  * Copyright (C) 2003-2017 Max-Planck-Society
29  * \author Martin Reinecke
30  */
31 
32 #ifndef HEALPIX_ALM_HEALPIX_TOOLS_H
33 #define HEALPIX_ALM_HEALPIX_TOOLS_H
34 
35 #include "xcomplex.h"
36 #include "arr.h"
37 
38 template<typename T> class Alm;
39 template<typename T> class Healpix_Map;
40 
41 /*! \defgroup alm_healpix_group Conversions between a_lm and HEALPix maps */
42 /*! \{ */
43 
44 /*! Converts a Healpix map to a set of a_lms.
45  \param map the input map, which must have RING ordering
46  \param alm the output a_lms. l_max and m_max of the conversion are
47  determined from this object.
48  \param weight array containing the weights for the individual rings of
49  the map. It must have at least 2*\a map.Nside() entries.
50  \param add_alm If this is \a true, then the computed a_lm are added
51  to the values already residing in \a alm. */
52 template<typename T> void map2alm (const Healpix_Map<T> &map,
53  Alm<xcomplex<T> > &alm, const arr<double> &weight,
54  bool add_alm=false);
55 
56 /*! Converts a Healpix map to a set of a_lms, using an iterative scheme
57  which is more accurate than plain map2alm().
58  \param map the input map, which must have RING ordering.
59  \param alm the output a_lms. l_max and m_max of the conversion are
60  determined from this object.
61  \param num_iter the number of iterations (0 is identical to map2alm()).
62  \param weight array containing the weights for the individual rings of
63  the map. It must have at least 2*\a map.Nside() entries. */
64 template<typename T> void map2alm_iter (const Healpix_Map<T> &map,
65  Alm<xcomplex<T> > &alm, int num_iter, const arr<double> &weight);
66 
67 template<typename T> inline void map2alm_iter (const Healpix_Map<T> &map,
68  Alm<xcomplex<T> > &alm, int num_iter)
69  {
70  arr<double> wgt(2*map.Nside(),1.);
71  map2alm_iter(map,alm,num_iter,wgt);
72  }
73 
74 template<typename T> void map2alm_iter2 (const Healpix_Map<T> &map,
75  Alm<xcomplex<T> > &alm, double err_abs, double err_rel);
76 
77 template<typename T> void map2alm_spin
78  (const Healpix_Map<T> &map1, const Healpix_Map<T> &map2,
79  Alm<xcomplex<T> > &alm1, Alm<xcomplex<T> > &alm2,
80  int spin, const arr<double> &weight, bool add_alm);
81 
82 template<typename T> void map2alm_spin_iter2
83  (const Healpix_Map<T> &map1, const Healpix_Map<T> &map2,
84  Alm<xcomplex<T> > &alm1, Alm<xcomplex<T> > &alm2,
85  int spin, double err_abs, double err_rel);
86 
87 /*! Converts Healpix maps containing the I, Q and U Stokes parameters
88  to sets of a_lms.
89  \param mapT the I-Stokes parameter input map
90  \param mapQ the Q-Stokes parameter input map
91  \param mapU the U-Stokes parameter input map
92  \note All maps must have the same nside, and must be in RING scheme.
93  \param almT the output temperature a_lms
94  \param almG the output gradient a_lms
95  \param almC the output curl a_lms
96  \note all a_lm sets must have the the same lmax and mmax.
97  \param weight ring weights for the maps.
98  \param add_alm If this is \a true, then the computed a_lm are added
99  to the values already residing in \a alm.
100  \note The weight array must have at least 2*\a mapT.Nside() entries. */
101 template<typename T> void map2alm_pol
102  (const Healpix_Map<T> &mapT,
103  const Healpix_Map<T> &mapQ,
104  const Healpix_Map<T> &mapU,
105  Alm<xcomplex<T> > &almT,
106  Alm<xcomplex<T> > &almG,
107  Alm<xcomplex<T> > &almC,
108  const arr<double> &weight,
109  bool add_alm=false);
110 /*! Converts Healpix maps containing the I, Q and U Stokes parameters
111  to sets of a_lms, using an iterative scheme which is more accurate than
112  plain map2alm_pol().
113  \param mapT the I-Stokes parameter input map
114  \param mapQ the Q-Stokes parameter input map
115  \param mapU the U-Stokes parameter input map
116  \note All maps must have the same nside, and must be in RING scheme.
117  \param almT the output temperature a_lms
118  \param almG the output gradient a_lms
119  \param almC the output curl a_lms
120  \note all a_lm sets must have the the same lmax and mmax.
121  \param num_iter the number of iterations (0 is identical to map2alm_pol()).
122  \param weight ring weights for the maps.
123  \note The weight array must have at least 2*\a mapT.Nside() entries. */
124 template<typename T> void map2alm_pol_iter
125  (const Healpix_Map<T> &mapT,
126  const Healpix_Map<T> &mapQ,
127  const Healpix_Map<T> &mapU,
128  Alm<xcomplex<T> > &almT,
129  Alm<xcomplex<T> > &almG,
130  Alm<xcomplex<T> > &almC,
131  int num_iter,
132  const arr<double> &weight);
133 
134 template<typename T> inline void map2alm_pol_iter
135  (const Healpix_Map<T> &mapT,
136  const Healpix_Map<T> &mapQ,
137  const Healpix_Map<T> &mapU,
138  Alm<xcomplex<T> > &almT,
139  Alm<xcomplex<T> > &almG,
140  Alm<xcomplex<T> > &almC,
141  int num_iter)
142  {
143  arr<double> wgt(2*mapT.Nside(),1.);
144  map2alm_pol_iter(mapT,mapQ,mapU,almT,almG,almC,num_iter,wgt);
145  }
146 
147 template<typename T> void map2alm_pol_iter2
148  (const Healpix_Map<T> &mapT,
149  const Healpix_Map<T> &mapQ,
150  const Healpix_Map<T> &mapU,
151  Alm<xcomplex<T> > &almT,
152  Alm<xcomplex<T> > &almG,
153  Alm<xcomplex<T> > &almC,
154  double err_abs, double err_rel);
155 
156 /*! Converts a a set of a_lm to a HEALPix map.
157  \param alm the input a_lms. l_max and m_max of the conversion are
158  determined from this object.
159  \param map the output map, which must have RING ordering. */
160 template<typename T> void alm2map (const Alm<xcomplex<T> > &alm,
161  Healpix_Map<T> &map, bool add_map=false);
162 
163 /*! Adjoint of the alm2map transform.
164  \param map the input map, which must have RING ordering
165  \param alm the output a_lms. l_max and m_max of the conversion are
166  determined from this object. */
167 template<typename T> void alm2map_adjoint (const Healpix_Map<T> &map,
168  Alm<xcomplex<T> > &alm, bool add_alm=false);
169 
170 template<typename T> void alm2map_spin
171  (const Alm<xcomplex<T> > &alm1, const Alm<xcomplex<T> > &alm2,
172  Healpix_Map<T> &map1, Healpix_Map<T> &map2, int spin, bool add_map=false);
173 
174 template<typename T> void alm2map_spin_adjoint
175  (const Healpix_Map<T> &map1, const Healpix_Map<T> &map2,
176  Alm<xcomplex<T> > &alm1, Alm<xcomplex<T> > &alm2,
177  int spin, bool add_alm=false);
178 
179 /*! Converts a a set of polarised a_lm to a HEALPix map.
180  \param almT the input temperature a_lms
181  \param almG the input gradient a_lms
182  \param almC the input curl a_lms
183  \param mapT the I-Stokes parameter output map
184  \param mapQ the Q-Stokes parameter output map
185  \param mapU the U-Stokes parameter output map */
186 template<typename T> void alm2map_pol
187  (const Alm<xcomplex<T> > &almT,
188  const Alm<xcomplex<T> > &almG,
189  const Alm<xcomplex<T> > &almC,
190  Healpix_Map<T> &mapT,
191  Healpix_Map<T> &mapQ,
192  Healpix_Map<T> &mapU,
193  bool add_map=false);
194 
195  template<typename T> void alm2map_pol_adjoint
196  (const Healpix_Map<T> &mapT,
197  const Healpix_Map<T> &mapQ,
198  const Healpix_Map<T> &mapU,
199  Alm<xcomplex<T> > &almT,
200  Alm<xcomplex<T> > &almG,
201  Alm<xcomplex<T> > &almC,
202  bool add_alm=false);
203 
204 /*! Converts a a set of a_lm to a HEALPix map and its first derivatives.
205  \param alm the input a_lms. l_max and m_max of the conversion are
206  determined from this object.
207  \param map the output map, which must have RING ordering.
208  \param mapdth an output map containing \f$d (\mbox{map})/d\vartheta\f$,
209  which must have RING ordering.
210  \param mapdph an output map containing
211  \f$(\sin\vartheta)^{-1}d(\mbox{map})/d\varphi\f$,
212  which must have RING ordering. */
213 template<typename T> void alm2map_der1
214  (const Alm<xcomplex<T> > &alm,
215  Healpix_Map<T> &map,
216  Healpix_Map<T> &mapdth,
217  Healpix_Map<T> &mapdph);
218 
219 /*! \} */
220 
221 #endif
void alm2map_der1(const Alm< xcomplex< T > > &alm, Healpix_Map< T > &map, Healpix_Map< T > &mapdth, Healpix_Map< T > &mapdph)
I Nside() const
Definition: healpix_base.h:427
Definition: alm.h:88
void map2alm_pol(const Healpix_Map< T > &mapT, const Healpix_Map< T > &mapQ, const Healpix_Map< T > &mapU, Alm< xcomplex< T > > &almT, Alm< xcomplex< T > > &almG, Alm< xcomplex< T > > &almC, const arr< double > &weight, bool add_alm=false)
void map2alm(const Healpix_Map< T > &map, Alm< xcomplex< T > > &alm, const arr< double > &weight, bool add_alm=false)
void map2alm_pol_iter(const Healpix_Map< T > &mapT, const Healpix_Map< T > &mapQ, const Healpix_Map< T > &mapU, Alm< xcomplex< T > > &almT, Alm< xcomplex< T > > &almG, Alm< xcomplex< T > > &almC, int num_iter, const arr< double > &weight)
void alm2map_pol(const Alm< xcomplex< T > > &almT, const Alm< xcomplex< T > > &almG, const Alm< xcomplex< T > > &almC, Healpix_Map< T > &mapT, Healpix_Map< T > &mapQ, Healpix_Map< T > &mapU, bool add_map=false)
void alm2map_adjoint(const Healpix_Map< T > &map, Alm< xcomplex< T > > &alm, bool add_alm=false)
void map2alm_iter(const Healpix_Map< T > &map, Alm< xcomplex< T > > &alm, int num_iter, const arr< double > &weight)
void alm2map(const Alm< xcomplex< T > > &alm, Healpix_Map< T > &map, bool add_map=false)

Generated on Wed Nov 13 2024 12:18:30 for Healpix C++