| [1337] | 1 | // Generate input spectra  a + b* l + c * gaussienne(l, 50, 20)
 | 
|---|
 | 2 | int lmax = 92;
 | 
|---|
 | 3 | Vector clin(lmax);
 | 
|---|
 | 4 | for(int l=0; l<lmax; l++) {
 | 
|---|
 | 5 |   double xx = (l-50.)/10.;
 | 
|---|
 | 6 |   clin(l) = 1.e-2 -1.e-4*l + 0.1*exp(-xx*xx);
 | 
|---|
 | 7 | }
 | 
|---|
 | 8 | 
 | 
|---|
 | 9 | // Compute map from spectra
 | 
|---|
 | 10 | SphericalTransformServer<r_8> ylmserver;
 | 
|---|
 | 11 | int m = 128;  // HealPix pixelisation parameter
 | 
|---|
 | 12 | SphereHEALPix<r_8> map(m);
 | 
|---|
 | 13 | ylmserver.GenerateFromCl(map, m,  clin, 0.);
 | 
|---|
 | 14 | // Compute power spectrum from map
 | 
|---|
 | 15 | Vector clout = ylmserver.DecomposeToCl(map, lmax,  0.);
 | 
|---|
 | 16 | 
 | 
|---|
 | 17 | // Copy the synthetised map
 | 
|---|
 | 18 | SphereHEALPix<r_8> mapdip;
 | 
|---|
 | 19 | mapdip = map;
 | 
|---|
 | 20 | 
 | 
|---|
 | 21 | // Define the dipole direction
 | 
|---|
 | 22 | double thetadipole = 1.2;
 | 
|---|
 | 23 | double phidipole = 0.3;
 | 
|---|
 | 24 | UnitVector vd(thetadipole, phidipole);
 | 
|---|
 | 25 | UnitVector vc(thetadipole, phidipole);
 | 
|---|
 | 26 | 
 | 
|---|
 | 27 | // Add a dipole component to the map
 | 
|---|
 | 28 | for(int i=0; i<mapdip.NbPixels(); i++) {  // Boucle sur les pixels
 | 
|---|
 | 29 |   double Thetar,Phir;
 | 
|---|
 | 30 |   mapdip.PixThetaPhi(i,Thetar,Phir);  // direction du pixel      
 | 
|---|
 | 31 |   vc.SetThetaPhi(Thetar,  Phir);      
 | 
|---|
 | 32 |   mapdip(i) += 5.*vd.Psc(vc);  // Produit scalaire 
 | 
|---|
 | 33 | }
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | // Compute the new map power spectrum 
 | 
|---|
 | 36 | Vector cldip = ylmserver.DecomposeToCl(mapdip, lmax,  0.);
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | // Display objects (kept automatically through Display)
 | 
|---|
 | 39 | ExecuteCommand("zone 1 2");
 | 
|---|
 | 40 | DisplayObj(map, " ");
 | 
|---|
 | 41 | DisplayObj(mapdip, " ");
 | 
|---|
 | 42 | DisplayObj(clin, "win");
 | 
|---|
 | 43 | DisplayObj(clout, "same,red,fcirclemarker5,defline");
 | 
|---|
 | 44 | KeepObj(cldip);
 | 
|---|
 | 45 | 
 | 
|---|
 | 46 | 
 | 
|---|