Changeset 1387 in Sophya for trunk/SophyaLib/Manual
- Timestamp:
- Jan 19, 2001, 11:13:04 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Manual/sophya.tex
r1362 r1387 694 694 695 695 \section{Module SkyMap} 696 \begin{figure}[hbt] 697 \dclsbb{AnyDataObj}{PixelMap} 698 \dclsccc{PixelMap}{Sphericalmap}{SphereHEALPix} 699 \dclsc{SphereThetaPhi} 700 \dclsb{LocalMap} 701 \caption{partial class diagram for pixelization classes in Sophya} 702 \end{figure} 703 The {\bf SkyMap} module provides classes for creating, filling, reading pixelized spherical and 2D-maps. The types of values stored in pixels can be int, float, double , complex etc. according to the specialization of the template type. 704 \subsection {Spherical maps} 705 There are two kinds of spherical maps according pixelization algorithms. SphereHEALPix represents spheres pixelized following the HEALPIix algorithm (E. Yvon, K. Gorski), SphereThetaPhi represents spheres pixelized following an algorithm developed at LAL-ORSAY. The example below shows creating and filling of a SphereHEALPix with nside = 8 (it will be 12*8*8= 768 pixels) : 706 707 \begin{verbatim} 708 #include ``spherehealpix.h'' 709 // ... 710 SphereHEALPix<double> sph(8); 711 for (int k=0; k< sph.NbPixels(); k++) sph(k) = (double)(10*k); 712 \end{verbatim} 713 714 SphereThetaPhi is used in a similar way with an argument representing number of slices in theta (Euler angle) for an hemisphere. 715 \subsection {Local maps} 716 A local map is a 2 dimensional array, with i as column index and j as row index. The map is supposed to lie on a plan tangent to the celestial sphere in a point whose coordinates are (x0,y0) on the local map and (theta0, phi0) on the sphere. The range of the map is defined by two values of angles covered respectively by all the pixels in x direction and all the pixels in y direction (SetSize()). Default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2). 717 718 Internally, a map is first defined within this reference plane and tranported until the point (theta0, phi0) in such a way that both axes are kept parallel to meridian and parallel lines of the sphere. The user can define its own map with axes rotated with respect to reference axes (this rotation is characterized by angle between the local parallel line and the wanted x-axis-- method SetOrigin(...)) 719 720 The example below shows creating and filling of a LocalMap with 4 columns and 5 rows. The origin is set to default. The map covers a sphere portion defined by two angles of 30. degrees (methods \textit{SetOrigin()} and \textit{SetSize()} must be called in order to completely define the map). 721 \begin{verbatim} 722 #include "localmap.h" 723 //.............. 724 LocalMap<r_4> locmap(4,5); 725 for (int k=0; k<locmap.NbPixels();k++) locmap(k)=10.*k; 726 locmap.SetOrigin(); 727 locmap.SetSize(30.,30.); 728 \end{verbatim} 729 730 \subsection{Writing, viewing \dots } 731 732 All these objects have been design to be written to or read from a persistant file. 733 The following example shows how to write the previously created objects 734 into such a file~: 735 \begin{verbatim} 736 //-- Writing 737 738 #include "fiospherehealpix.h" 739 //................ 740 741 char *fileout = "myfile.ppf"; 742 POutPersist outppf(fileout); 743 FIO_SphereHEALPix<r_8> outsph(sph); 744 outsph.Write(outppf); 745 FIO_LocalMap<r_8> outloc(locmap); 746 outloc.Write(outppf); 747 748 \end{verbatim} 749 750 Sophya graphical tools (spiapp) can automatically display and operate 751 all these objects. 752 696 753 697 754 \section{Module NTools} … … 806 863 \section{Module Samba} 807 864 865 The module provides several classes for spherical harmonic analysis. The main class is \textit{SphericalTranformServer}. It contains methods for analysis and synthesis of spherical maps. The following example fills a vector of Cl's, generate a spherical map from these Cl's. This map is analyzed back to Cl's... 866 \begin{verbatim} 867 #include "skymap.h" 868 #include "samba.h" 869 .................... 870 871 // Generate input spectra a + b* l + c * gaussienne(l, 50, 20) 872 int lmax = 92; 873 Vector clin(lmax); 874 for(int l=0; l<lmax; l++) { 875 double xx = (l-50.)/10.; 876 clin(l) = 1.e-2 -1.e-4*l + 0.1*exp(-xx*xx); 877 } 878 879 // Compute map from spectra 880 SphericalTransformServer<r_8> ylmserver; 881 int m = 128; // HealPix pixelisation parameter 882 SphereHEALPix<r_8> map(m); 883 ylmserver.GenerateFromCl(map, m, clin, 0.); 884 // Compute power spectrum from map 885 Vector clout = ylmserver.DecomposeToCl(map, lmax, 0.); 886 \end{verbatim} 887 808 888 \section{Module SkyT} 889 890 \section{Module FitsIOServer} 891 \begin{figure}[hbt] 892 \dclsbb{FitsFile}{FitsInFile} 893 \dclsb{FitsOutFile} 894 \end{figure} 895 896 This module provides classes for handling file input-output in FITS format using the cfitsio library. It works like the SOPHYA persistence (see Module SysTools), using delegate objects, but its design is simpler. The following example writes a matrix (see module TArray) and a spherical map (see module SkyMap) on a FITS file and reads back from FITS file and creates new objects : 897 \begin{verbatim} 898 #include "spherehealpix.h" 899 #include "fitsspherehealpix.h" 900 #include "fitstarray.h" 901 #include "tmatrix.h" 902 //........................... 903 904 int m=...; 905 SphereHEALPix<r_8> sph(m); 906 ................ 907 int dim1=...; 908 int dim2=...; 909 TMatrix<r_8> mat(dim1,dim2); 910 ............ 911 912 FITS_SphereHEALPix<r_8> sph_temp(sph); 913 FITS_TArray<r_8> mat_temp(mat); 914 // writing 915 916 FitsOutFile os("myfile.fits"); 917 sph_temp.Write(os); 918 mat_temp.Write(os); 919 920 // reading 921 FitsInFile is("myfile.fits"); 922 sph_temp.Read(is); 923 mat_temp.Read(is); 924 SphereHEALPix<r_8> new_sph=(SphereHEALPix<r_8>)sph_temp; 925 TMatrix<r_8> new_mat=(TMatrix<r_8>)mat_temp; 926 ................ 927 928 \end{verbatim} 929 809 930 810 931
Note:
See TracChangeset
for help on using the changeset viewer.