source: Sophya/trunk/SophyaProg/Examples/sphylm.icc@ 1650

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

Creation de module d'exemples (code Sophya + exemple pour (s)piapp)

Reza 20/11/2000

File size: 1.3 KB
Line 
1// Generate input spectra a + b* l + c * gaussienne(l, 50, 20)
2int lmax = 92;
3Vector clin(lmax);
4for(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
10SphericalTransformServer<r_8> ylmserver;
11int m = 128; // HealPix pixelisation parameter
12SphereHEALPix<r_8> map(m);
13ylmserver.GenerateFromCl(map, m, clin, 0.);
14// Compute power spectrum from map
15Vector clout = ylmserver.DecomposeToCl(map, lmax, 0.);
16
17// Copy the synthetised map
18SphereHEALPix<r_8> mapdip;
19mapdip = map;
20
21// Define the dipole direction
22double thetadipole = 1.2;
23double phidipole = 0.3;
24UnitVector vd(thetadipole, phidipole);
25UnitVector vc(thetadipole, phidipole);
26
27// Add a dipole component to the map
28for(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
36Vector cldip = ylmserver.DecomposeToCl(mapdip, lmax, 0.);
37
38// Display objects (kept automatically through Display)
39ExecuteCommand("zone 1 2");
40DisplayObj(map, " ");
41DisplayObj(mapdip, " ");
42DisplayObj(clin, "win");
43DisplayObj(clout, "same,red,fcirclemarker5,defline");
44KeepObj(cldip);
45
46
Note: See TracBrowser for help on using the repository browser.