Changeset 1387 in Sophya for trunk


Ignore:
Timestamp:
Jan 19, 2001, 11:13:04 AM (25 years ago)
Author:
lemeur
Message:

doc SkyMap, Samba, FitsioServer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Manual/sophya.tex

    r1362 r1387  
    694694
    695695\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}
     703The {\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}
     705There 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// ...
     710SphereHEALPix<double> sph(8);
     711for (int k=0; k< sph.NbPixels(); k++) sph(k) = (double)(10*k);
     712\end{verbatim}
     713
     714SphereThetaPhi is used in a similar way with an argument representing number of slices in theta (Euler angle) for an hemisphere.
     715\subsection {Local maps}
     716A 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
     718Internally, 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
     720The 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
     732All these objects have been design to be written to or read from a persistant file.
     733The following example shows how to write the previously created objects
     734into such a file~:
     735\begin{verbatim}
     736//-- Writing
     737
     738#include "fiospherehealpix.h"
     739//................
     740
     741char *fileout = "myfile.ppf";
     742POutPersist outppf(fileout);
     743FIO_SphereHEALPix<r_8> outsph(sph);
     744outsph.Write(outppf);
     745FIO_LocalMap<r_8> outloc(locmap);
     746outloc.Write(outppf);
     747
     748\end{verbatim}
     749
     750Sophya graphical tools (spiapp) can automatically display and operate
     751all these objects.
     752
    696753
    697754\section{Module NTools}
     
    806863\section{Module Samba}
    807864
     865The 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)
     872int lmax = 92;
     873Vector clin(lmax);
     874for(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
     880SphericalTransformServer<r_8> ylmserver;
     881int m = 128;  // HealPix pixelisation parameter
     882SphereHEALPix<r_8> map(m);
     883ylmserver.GenerateFromCl(map, m,  clin, 0.);
     884// Compute power spectrum from map
     885Vector clout = ylmserver.DecomposeToCl(map, lmax,  0.);
     886\end{verbatim}
     887
    808888\section{Module SkyT}
     889
     890\section{Module FitsIOServer}
     891\begin{figure}[hbt]
     892\dclsbb{FitsFile}{FitsInFile}
     893\dclsb{FitsOutFile}
     894\end{figure}
     895
     896This 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
     904int m=...;
     905SphereHEALPix<r_8> sph(m);
     906................
     907int dim1=...;
     908int dim2=...;
     909TMatrix<r_8> mat(dim1,dim2);
     910............
     911
     912FITS_SphereHEALPix<r_8> sph_temp(sph);
     913FITS_TArray<r_8> mat_temp(mat);
     914// writing
     915
     916FitsOutFile os("myfile.fits");
     917sph_temp.Write(os);
     918mat_temp.Write(os);
     919
     920// reading
     921FitsInFile is("myfile.fits");
     922sph_temp.Read(is);
     923mat_temp.Read(is);
     924SphereHEALPix<r_8> new_sph=(SphereHEALPix<r_8>)sph_temp;
     925TMatrix<r_8> new_mat=(TMatrix<r_8>)mat_temp;
     926................
     927     
     928\end{verbatim}
     929
    809930
    810931
Note: See TracChangeset for help on using the changeset viewer.