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

Last change on this file since 858 was 858, checked in by ansari, 25 years ago

Adapatation a SphereHEALPix - Reza 10/4/2000

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