Changeset 1756 in Sophya for trunk/SophyaLib/Samba/sphericaltransformserver.cc
- Timestamp:
- Nov 13, 2001, 4:29:59 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/sphericaltransformserver.cc
r1715 r1756 154 154 { 155 155 /*======================================================================= 156 computes a map f orm its alm for the HEALPIX pixelisation156 computes a map from its alm for the HEALPIX pixelisation 157 157 map(theta,phi) = sum_l_m a_lm Y_lm(theta,phi) 158 158 = sum_m {e^(i*m*phi) sum_l a_lm*lambda_lm(theta)} … … 167 167 int_4 nmmax=nlmax; 168 168 int_4 nsmax=0; 169 // le Resize est suppose mettre a zero 169 170 map.Resize(pixelSizeIndex); 170 171 char* sphere_type=map.TypeOfMap(); 172 int premiereTranche = 0; 173 int derniereTranche = map.NbThetaSlices()-1; 171 174 if (strncmp(sphere_type,"RING",4) == 0) 172 173 174 175 { 176 nsmax=map.SizeIndex(); 177 } 175 178 else 179 { 176 180 // pour une sphere Gorski le nombre de pixels est 12*nsmax**2 177 181 // on calcule une quantite equivalente a nsmax pour la sphere-theta-phi … … 179 183 // c'est approximatif ; a raffiner. 180 184 if (strncmp(sphere_type,"TETAFI",6) == 0) 181 { 182 nsmax=(int_4)sqrt(map.NbPixels()/12.); 183 } 185 { 186 nsmax=(int_4)sqrt(map.NbPixels()/12.); 187 premiereTranche++; 188 derniereTranche--; 189 } 184 190 else 185 186 187 188 191 { 192 cout << " unknown type of sphere : " << sphere_type << endl; 193 throw IOExc(" unknown type of sphere: " + (string)sphere_type ); 194 } 189 195 // cout << "GenerateFromAlm: the sphere is of type : " << sphere_type << endl; 190 196 // cout << "GenerateFromAlm: size index (nside) of the sphere= " << nsmax << endl; 191 197 // cout << "GenerateFromAlm: nlmax (from Alm) = " << nlmax << endl; 192 if (nlmax>3*nsmax-1)193 {198 // if (nlmax>3*nsmax-1) 199 // { 194 200 // cout << "GenerateFromAlm: nlmax should be <= 3*nside-1" << endl; 195 if (strncmp(sphere_type,"TETAFI",6) == 0) 196 { 197 cout << "GenerateFromAlm: nlmax should be <= 3*nside-1" << endl; 198 cout << " (for this criterium, nsmax is computed as sqrt(nbPixels/12))" << endl; 199 } 200 } 201 // if (strncmp(sphere_type,"TETAFI",6) == 0) 202 // { 203 // cout << "GenerateFromAlm: nlmax should be <= 3*nside-1" << endl; 204 // cout << " (for this criterium, nsmax is computed as sqrt(nbPixels/12))" << endl; 205 // } 206 //} 207 } 201 208 Bm<complex<T> > b_m_theta(nmmax); 202 209 … … 205 212 206 213 // pour chaque tranche en theta 207 for (int_4 ith = 0; ith < map.NbThetaSlices();ith++)214 for (int_4 ith = premiereTranche; ith <= derniereTranche;ith++) 208 215 { 209 216 int_4 nph; … … 231 238 } 232 239 } 233 234 240 // obtains the negative m of b(m,theta) (= complex conjugate) 235 241 … … 377 383 // si phi0 n'est pas nul, il y a juste un decalage a faire. 378 384 //********************************************************************** 379 380 385 TVector< complex<T> > bw(nph); 381 386 TVector< complex<T> > dataout(nph); … … 410 415 411 416 TVector<T> sortie; 412 413 417 fftIntfPtr_-> FFTBackward(data, sortie); 414 418 … … 419 423 /*! \fn Alm<T> SOPHYA::SphericalTransformServer::DecomposeToAlm(const SphericalMap<T>& map, int_4 nlmax, r_8 cos_theta_cut) const 420 424 421 \return the Alm coefficients from analysis of a temperature map. THE MAP CAN BE MODIFIED (if iterationOrder >0)425 \return the Alm coefficients from analysis of a temperature map. 422 426 423 427 \param<nlmax> : maximum value of the l index … … 425 429 \param<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. 426 430 427 \param<iterationOrder> : 1,2,3,4.... order of an iterative analysis. (Default : 0 -> standard analysis) 428 */ 431 */ 432 template<class T> 433 void SphericalTransformServer<T>::DecomposeToAlm(const SphericalMap<T>& map, Alm<T>& alm, int_4 nlmax, r_8 cos_theta_cut) const 434 { 435 DecomposeToAlm(const_cast< SphericalMap<T>& >(map), alm, nlmax, cos_theta_cut, 0); 436 } 437 //******************************************* 438 439 /*! \fn Alm<T> SOPHYA::SphericalTransformServer::DecomposeToAlm(const SphericalMap<T>& map, int_4 nlmax, r_8 cos_theta_cut, int iterationOrder) const 440 441 \return the Alm coefficients from analysis of a temperature map. THE MAP CAN BE MODIFIED (if iterationOrder >0) 442 443 \param<nlmax> : maximum value of the l index 444 445 \param<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. 446 447 \param<iterationOrder> : 1,2,3,4.... order of an iterative analysis. (Default : 0 -> standard analysis). If iterationOrder is not null, the method works with SphereHEALPix but NOT WITH SphereThetaPhi maps ! */ 429 448 template<class T> 430 449 void SphericalTransformServer<T>::DecomposeToAlm(SphericalMap<T>& map, Alm<T>& alm, int_4 nlmax, r_8 cos_theta_cut, int iterationOrder) const … … 606 625 throw PException("bizarre : vecteur datain de longueur nulle (CFromFourierAnalysis)"); 607 626 } 608 if (nph%2 != 0 )609 {610 throw PException("SphericalTransformServer<T>::CFromFourierAnalysis : longueur de datain impair ?");611 }627 // if (nph%2 != 0 ) 628 // { 629 // throw PException("SphericalTransformServer<T>::CFromFourierAnalysis : longueur de datain impair ?"); 630 // } 612 631 TVector<complex<T> > transformedData; 613 632 614 633 // la taille du vecteur complexe retourne est nph/2+1 (si la taille 615 634 // du vecteur reel entre est nph) 635 // cout << " longueur de datain = " << nph << endl; 616 636 fftIntfPtr_-> FFTForward(datain, transformedData); 617 637 // cout << " taille de la transformee " << transformedData.Size() << endl; 618 638 // TVector< complex<T> > dataout(nmmax+1); 619 639 dataout.ReSize(nmmax+1); … … 732 752 // mapFromPM(nlmax, nmmax, mapq, mapu, alme, almb); 733 753 } 734 735 736 754 /*! \fn void SOPHYA::SphericalTransformServer::DecomposeToAlm(const SphericalMap<T>& mapq, 737 755 const SphericalMap<T>& mapu, … … 749 767 750 768 \c 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. 769 770 771 */ 772 template<class T> 773 void SphericalTransformServer<T>::DecomposeToAlm(const SphericalMap<T>& mapq, 774 const SphericalMap<T>& mapu, 775 Alm<T>& alme, 776 Alm<T>& almb, 777 int_4 nlmax, 778 r_8 cos_theta_cut) const 779 { 780 DecomposeToAlm(const_cast< SphericalMap<T>& >(mapq), const_cast< SphericalMap<T>& >(mapu), alme, almb, nlmax, cos_theta_cut); 781 } 782 783 /*! \fn void SOPHYA::SphericalTransformServer::DecomposeToAlm(const SphericalMap<T>& mapq, 784 const SphericalMap<T>& mapu, 785 Alm<T>& alme, 786 Alm<T>& almb, 787 int_4 nlmax, 788 r_8 cos_theta_cut, 789 int iterationOrder) const 790 791 analysis of a polarization map into Alm coefficients. 792 793 The spheres \c mapq and \c mapu contain respectively the Stokes parameters. 794 795 \c a2lme and \c a2lmb will receive respectively electric and magnetic Alm's 796 nlmax : maximum value of the l index 797 798 \c 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. 799 800 \param<iterationOrder> : 1,2,3,4.... order of an iterative analysis. (Default : 0 -> standard analysis). If iterationOrder is not null, the method works with SphereHEALPix but NOT WITH SphereThetaPhi maps ! 801 802 THE INPUT MAPS CAN BE MODIFIED (only if iterationOrder >0) 803 751 804 */ 752 805 template<class T> … … 1243 1296 1244 1297 1245 /*! \fn TVector<T> SOPHYA::SphericalTransformServer::DecomposeToCl( const SphericalMap<T>& sph, int_4 nlmax, r_8 cos_theta_cut) const1298 /*! \fn TVector<T> SOPHYA::SphericalTransformServer::DecomposeToCl(SphericalMap<T>& sph, int_4 nlmax, r_8 cos_theta_cut, int iterationOrder) const 1246 1299 1247 1300 \return power spectrum from analysis of a temperature map. THE MAP CAN BE MODIFIED (if iterationOrder >0) … … 1251 1304 \param<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. 1252 1305 1253 \param<iterationOrder> : 1,2,3,4.... order of an iterative analysis. (Default : 0 -> standard analysis)1306 \param<iterationOrder> : 1,2,3,4.... order of an iterative analysis. If iterationOrder is not null, the method works with SphereHEALPix but NOT WITH SphereThetaPhi maps ! 1254 1307 1255 1308 */ … … 1259 1312 Alm<T> alm; 1260 1313 DecomposeToAlm( sph, alm, nlmax, cos_theta_cut, iterationOrder); 1261 // cout << " SphericalTransformServer : impression alm " << endl; 1262 // alm.Print(); 1314 // power spectrum 1315 return alm.powerSpectrum(); 1316 } 1317 1318 1319 /*! \fn TVector<T> SOPHYA::SphericalTransformServer::DecomposeToCl(const SphericalMap<T>& sph, int_4 nlmax, r_8 cos_theta_cut) const 1320 1321 \return power spectrum from analysis of a temperature map. 1322 1323 \param<nlmax> : maximum value of the l index 1324 1325 \param<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. 1326 1327 1328 */ 1329 1330 1331 template <class T> 1332 TVector<T> SphericalTransformServer<T>::DecomposeToCl(const SphericalMap<T>& sph, int_4 nlmax, r_8 cos_theta_cut) const 1333 { 1334 Alm<T> alm; 1335 DecomposeToAlm( sph, alm, nlmax, cos_theta_cut); 1263 1336 // power spectrum 1264 1337 return alm.powerSpectrum();
Note:
See TracChangeset
for help on using the changeset viewer.