source: Sophya/trunk/SophyaLib/Samba/sphericaltransformserver.h@ 748

Last change on this file since 748 was 746, checked in by ansari, 26 years ago

ajustement de type double r_8 etc.

File size: 7.0 KB
Line 
1#ifndef SPHERICALTRANFORMSERVER_SEEN
2#define SPHERICALTRANFORMSERVER_SEEN
3
4#include "sphericalmap.h"
5#include "spheregorski.h"
6#include "fftservintf.h"
7#include "fftpserver.h"
8#include "alm.h"
9#include "lambdaBuilder.h"
10
11
12namespace SOPHYA {
13
14//
15/*! Class for performing analysis and synthesis of sky maps using spin-0 or spin-2 spherical harmonics.
16 */
17template <class T>
18class SphericalTransformServer
19{
20
21 public:
22
23 SphericalTransformServer()
24{
25 fftIntfPtr_=new FFTPackServer;
26 fftIntfPtr_->setNormalize(false);
27};
28 ~SphericalTransformServer(){ if (fftIntfPtr_!=NULL) delete fftIntfPtr_;};
29/*!
30 Set a fft server. The constructor sets a default fft server (fft-pack). So it is not necessary to call this method for a standard use.
31*/
32 void SetFFTServer(FFTServerInterface* srv=NULL)
33{
34 if (fftIntfPtr_!=NULL) delete fftIntfPtr_;
35 fftIntfPtr_=srv;
36 fftIntfPtr_->setNormalize(false);
37}
38 /*! synthesis of a temperature map from Alm coefficients */
39 void GenerateFromAlm( SphericalMap<T>& map, int_4 pixelSizeIndex, const Alm<T>& alm) const;
40 /*! synthesis of a polarization map from Alm coefficients. The spheres mapq and mapu contain respectively the Stokes parameters. */
41 void GenerateFromAlm(SphericalMap<T>& mapq, SphericalMap<T>& mapu, int_4 pixelSizeIndex, const Alm<T>& alme, const Alm<T>& almb) const;
42
43 /*! synthesis of a temperature map from power spectrum Cl (Alm's are generated randomly, following a gaussian distribution). */
44 void GenerateFromCl(SphericalMap<T>& sph, int_4 pixelSizeIndex,
45 const TVector<T>& Cl, const r_8 fwhm) const;
46 /*! synthesis of a polarization map from power spectra electric-Cl and magnetic-Cl (Alm's are generated randomly, following a gaussian distribution).
47 \param fwhm FWHM in arcmin for random generation of Alm's (eg. 5)
48
49*/
50 void GenerateFromCl(SphericalMap<T>& sphq, SphericalMap<T>& sphu,
51 int_4 pixelSizeIndex,
52 const TVector<T>& Cle, const TVector<T>& Clb,
53 const r_8 fwhm) const;
54 /*!return the Alm coefficients from analysis of a temperature map.
55
56 nlmax : maximum value of the l index
57
58 cos_theta_cut : cosinus of the symmetric cut EULER angle theta : cos_theta_cut=0 means no cut ; cos_theta_cut=1 all the sphere is cut.
59 */
60
61
62Alm<T> DecomposeToAlm(const SphericalMap<T>& map, int_4 nlmax, r_8 cos_theta_cut) const;
63 /*analysis of a polarization map into Alm coefficients.
64
65 The spheres mapq and mapu contain respectively the Stokes parameters.
66
67 a2lme and a2lmb will receive respectively electric and magnetic Alm's
68 nlmax : maximum value of the l index
69
70 cos_theta_cut : cosinus of the symmetric cut EULER angle theta : cos_theta_cut=0 means no cut ; cos_theta_cut=1 all the sphere is cut.
71 */
72
73 void DecomposeToAlm(const SphericalMap<T>& mapq, const SphericalMap<T>& mapu,
74 Alm<T>& a2lme, Alm<T>& a2lmb,
75 int_4 nlmax, r_8 cos_theta_cut) const;
76
77 // /*return power spectrum from analysis of a temperature map.
78
79 // nlmax : maximum value of the l index
80
81 // cos_theta_cut : cosinus of the symmetric cut EULER angle theta : cos_theta_cut=0 means no cut ; cos_theta_cut=1 all the sphere is cut.
82 // */
83 TVector<T> DecomposeToCl(const SphericalMap<T>& sph,
84 int_4 nlmax, r_8 cos_theta_cut) const;
85
86
87 private:
88 /*! return a vector with nph elements which are sums :\f$\sum_{m=-mmax}^{mmax}b_m(\theta)e^{im\varphi}\f$ for nph values of \f$\varphi\f$ regularly distributed in \f$[0,\pi]\f$ ( calculated by FFT)
89
90 The object b_m (\f$b_m\f$) of the class Bm is a special vector which index goes from -mmax to mmax.
91 */
92 TVector< complex<T> > fourierSynthesisFromB(const Bm<complex<T> >& b_m,
93 int_4 nph, r_8 phi0) const;
94/*! same as fourierSynthesisFromB, but return a real vector, taking into account the fact that b(-m) is conjugate of b(m) */
95 TVector<T> RfourierSynthesisFromB(const Bm<complex<T> >& b_m,
96 int_4 nph, r_8 phi0) const;
97
98 /*! return a vector with mmax elements which are sums :
99\f$\sum_{k=0}^{nphi}datain(\theta,\varphi_k)e^{im\varphi_k}\f$ for (mmax+1) values of \f$m\f$ from 0 to mmax.
100 */
101 TVector< complex<T> > CFromFourierAnalysis(int_4 mmax,
102 const TVector<complex<T> > datain,
103 r_8 phi0) const;
104/* same as previous one, but with a "datain" which is real (not complex) */
105 TVector< complex<T> > CFromFourierAnalysis(int_4 mmax,
106 const TVector<T> datain,
107 r_8 phi0) const;
108
109 /*!
110Compute polarized Alm's as :
111\f[
112a_{lm}^E=\frac{1}{\sqrt{2}}\sum_{slices}{\omega_{pix}\left(_{w}\lambda_l^m\tilde{Q}-i_{x}\lambda_l^m\tilde{U}\right)}
113\f]
114\f[
115a_{lm}^B=\frac{1}{\sqrt{2}}\sum_{slices}{\omega_{pix}\left(i_{x}\lambda_l^m\tilde{Q}+_{w}\lambda_l^m\tilde{U}\right)}
116\f]
117
118where \f$\tilde{Q}\f$ and \f$\tilde{U}\f$ are C-coefficients computed by FFT (method CFromFourierAnalysis, called by present method) from the Stokes parameters.
119
120\f$\omega_{pix}\f$ are solid angle of each pixel.
121
122dataq, datau : Stokes parameters.
123
124 */
125void almFromWX(int_4 nlmax, int_4 nmmax, r_8 phi0,
126 r_8 domega, r_8 theta,
127 const TVector<T>& dataq, const TVector<T>& datau,
128 Alm<T>& alme, Alm<T>& almb) const;
129 /*!
130Compute polarized Alm's as :
131\f[
132a_{lm}^E=-\frac{1}{2}\sum_{slices}{\omega_{pix}\left(_{+}\lambda_l^m\tilde{P^+}+_{-}\lambda_l^m\tilde{P^-}\right)}
133\f]
134\f[
135a_{lm}^B=\frac{i}{2}\sum_{slices}{\omega_{pix}\left(_{+}\lambda_l^m\tilde{P^+}-_{-}\lambda_l^m\tilde{P^-}\right)}
136\f]
137
138where \f$\tilde{P^{\pm}}=\tilde{Q}\pm\tilde{U}\f$ computed by FFT (method CFromFourierAnalysis, called by present method) from the Stokes parameters,\f$Q\f$ and \f$U\f$ .
139
140\f$\omega_{pix}\f$ are solid angle of each pixel.
141
142dataq, datau : Stokes parameters.
143
144 */
145void almFromPM(int_4 nph, int_4 nlmax, int_4 nmmax,
146 r_8 phi0, r_8 domega, r_8 theta,
147 const TVector<T>& dataq, const TVector<T>& datau,
148 Alm<T>& alme, Alm<T>& almb) const;
149
150/*! synthesis of Stokes parameters following formulae :
151
152\f[
153Q=\sum_{m=-mmax}^{mmax}b_m^qe^{im\varphi}
154\f]
155\f[
156U=\sum_{m=-mmax}^{mmax}b_m^ue^{im\varphi}
157\f]
158
159computed by FFT (method fourierSynthesisFromB called by the present one)
160
161with :
162
163\f[
164b_m^q=-\frac{1}{\sqrt{2}}\sum_{l=|m|}^{lmax}{\left(_{w}\lambda_l^ma_{lm}^E-i_{x}\lambda_l^ma_{lm}^B\right) }
165\f]
166\f[
167b_m^u=\frac{1}{\sqrt{2}}\sum_{l=|m|}^{lmax}{\left(i_{x}\lambda_l^ma_{lm}^E+_{w}\lambda_l^ma_{lm}^B\right) }
168\f]
169 */
170void mapFromWX(int_4 nlmax, int_4 nmmax,
171 SphericalMap<T>& mapq, SphericalMap<T>& mapu,
172 const Alm<T>& alme, const Alm<T>& almb) const;
173
174/*! synthesis of polarizations following formulae :
175
176\f[
177P^+ = \sum_{m=-mmax}^{mmax} {b_m^+e^{im\varphi} }
178\f]
179\f[
180P^- = \sum_{m=-mmax}^{mmax} {b_m^-e^{im\varphi} }
181\f]
182
183computed by FFT (method fourierSynthesisFromB called by the present one)
184
185with :
186
187\f[
188b_m^+=-\sum_{l=|m|}^{lmax}{_{+}\lambda_l^m \left( a_{lm}^E+ia_{lm}^B \right) }
189\f]
190\f[
191b_m^-=-\sum_{l=|m|}^{lmax}{_{+}\lambda_l^m \left( a_{lm}^E-ia_{lm}^B \right) }
192\f]
193 */
194
195void mapFromPM(int_4 nlmax, int_4 nmmax,
196 SphericalMap<T>& mapq, SphericalMap<T>& mapu,
197 const Alm<T>& alme, const Alm<T>& almb) const;
198
199
200
201 FFTServerInterface* fftIntfPtr_;
202};
203} // Fin du namespace
204
205
206#endif
Note: See TracBrowser for help on using the repository browser.