Changeset 3034 in Sophya for trunk/SophyaLib/Manual
- Timestamp:
- Jul 17, 2006, 7:12:21 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Manual/sophya.tex
r3026 r3034 49 49 \vspace{1cm} 50 50 \begin{center} 51 {\bf \Large Sophya Version: 1.966 (V\_Jun2006) }51 {\bf \Large Sophya Version: 2.0 (V\_Jul2006) } 52 52 % Document revision 1.0 } 53 53 \end{center} … … 312 312 csh> scanppf -h 313 313 PIOPersist::Initialize() Starting Sophya Persistence management service 314 SOPHYA Version 1.9 Revision 0 (V_Mai2005) -- May 31 2005 15:11:32cxx314 SOPHYA Version 2.0 Revision 0 (V_Jul2006) -- Jul 17 2006 14:13:27 cxx 315 315 Usage: scanppf [flags] filename 316 flags = -s -n -a0 -a1 -a2 -a3 -lh -lho 316 flags = -s -n -a0 -a1 -a2 -a3 -lh -lho -lmod 317 317 -s[=default} : Sequential reading of objects 318 318 -n : Object reading at NameTags … … 320 320 -lh : List PPersist handler classes 321 321 -lho : List PPersist handler and dataobj classes 322 -lmod : List initialized/registered modules 322 323 \end{verbatim} 323 324 … … 406 407 \vspace*{5mm} 407 408 409 \subsection{Initialisation} 410 \index{SophyaInitiator} 411 A number of actions have to be taken before 412 some of the services provided by SOPHYA become operational. This is the case 413 of SOPHYA persistence, as well as FITS I/O facilities. 414 Initialisation of many SOPHYA modules is performed through an initialiser class, 415 which inherits from {\bf SophyaInitiator}. Static instance of each 416 initialiser class exist in the library and the various SOPHYA services 417 should be operational when the user code ({\tt main()}) starts. 418 However, in some cases the run time loader may not perform correctly the static 419 object initialisation. You may thus need to instanciate the initialiser class 420 for the modules you use in the beginning of your main program: \\ 421 {\tt TArrayInitiator , HiStatsInitiator , SkyMapInitiator \ldots } 422 %%% 408 423 \subsection{SOPHYA persistence} 409 424 \label{ppfdesc} … … 778 793 \begin{center} 779 794 \begin{tabular}{ll} 795 \hline \\ 780 796 \multicolumn{2}{c}{ {\bf Range} {\tt (start, end, size, step) } } \\[2mm] 781 797 \hline \\ 798 {\bf Range} {\tt r(7); } & index range: \hspace{2mm} 7 \\ 782 799 {\bf Range} {\tt r(3,6); } & index range: \hspace{2mm} 3,4,5,6 \\ 783 {\bf Range} {\tt r(3, 6,0,1); } & index range: \hspace{2mm} 3,4,5,6\\800 {\bf Range} {\tt r(3,7,2); } & index range: \hspace{2mm} 3,5,7 \\ 784 801 {\bf Range} {\tt r(7,0,3,1); } & index range: \hspace{2mm} 7,8,9 \\ 785 {\bf Range} {\tt r(10,0,5,2); } & index range: \hspace{2mm} 10,12,14,16,18 \\ 802 {\bf Range} {\tt r(10,0,5,2); } & index range: \hspace{2mm} 10,12,14,16,18 \\[2mm] 803 \hline 786 804 \end{tabular} 787 805 \end{center} … … 1168 1186 1169 1187 \subsubsection{DataTables} 1188 \label{datatables} 1170 1189 \index{DataTable} 1171 1190 The class {\bf DataTable} extends significantly the functionalities provided by … … 1204 1223 The class {\bf DataTableRow } is an auxiliary class which simplifies the manipulation 1205 1224 of BaseDataTable object rows. 1206 \begin{verbatim} 1207 #include "datatable.h" 1225 The example below show how to create and filling a table, using a PPF stream as 1226 swap space. In addition, we have used a {\tt DataTableRow} to prepare data 1227 for each table line. 1228 \begin{verbatim} 1229 #include "swppfdtable.h" 1208 1230 // ... 1209 // Create a table with 3 columns 1210 DataTable dtrow(64); 1231 { 1232 // ---------- Create an output PPF stream (file) 1233 POutPersist po("swdtable.ppf"); 1234 // ------------------ 1235 // Create a table with 3 columns, using the above stream as swap space 1236 SwPPFDataTable dtrow(po, 64); 1211 1237 dtrow.AddStringColumn("sline"); 1212 1238 dtrow.AddIntegerColumn("line"); 1213 dtrow.AddDateTimeColumn("datime"); 1214 1239 dtrow.AddDateTimeColumn("datime"); 1240 // 1215 1241 TimeStamp ts, ts2; // Initialize current date and time 1216 1242 string sline; 1217 // Create a table row with the required structure1243 //---- Create a table row with the required structure 1218 1244 DataTableRow row = dtrow.EmptyRow(); 1219 // Fill the table1220 for(int k = 0; k<25 ; k++) {1245 // ----- Fill the table 1246 for(int k = 0; k<2500; k++) { 1221 1247 sline = "L-"; 1222 1248 sline += (string)MuTyV(k); … … 1227 1253 dtrow.AddRow(row); 1228 1254 } 1229 // Acces and print two of the table rows : 1230 cout << dtrow.GetRow(6, row) << endl; 1231 cout << dtrow.GetRow(6, row) << endl; 1232 \end{verbatim} 1233 1255 //------ Write the table itself to the stream, before closing the file 1256 po << PPFNameTag("SwTable") << dtrow; 1257 } 1258 \end{verbatim} 1259 %% 1260 The previously created table can easily be read in, as shown below: 1261 %% 1262 \begin{verbatim} 1263 #include "swppfdtable.h" 1264 // ... 1265 { 1266 // ------ Create the input PPF stream (file) 1267 PInPersist pin("swdtable.ppf"); 1268 // ------ Read in the SwPPFDataTable object 1269 SwPPFDataTable dtr; 1270 pin >> PPFNameTag("SwTable") >> dtr; 1271 // ---- Create a table row with the required structure 1272 DataTableRow row = dtr.EmptyRow(); 1273 // ---- Acces and print two of the table rows : 1274 cout << dtr.GetRow(6, row) << endl; 1275 cout << dtr.GetRow(17, row) << endl; 1276 } 1277 \end{verbatim} 1278 1234 1279 \subsection{Writing, viewing \dots } 1235 1280 … … 1698 1743 \newpage 1699 1744 \section{Module FitsIOServer} 1745 \subsection{FITS streams} 1700 1746 \index{FITS} \index{FitsInFile} \index{FitsOutFile} 1701 1747 This module provides classes for handling file input-output in FITS format using the cfitsio library. Its … … 1724 1770 \end{figure} 1725 1771 %%%% 1726 \ par1772 \subsection{FITS handlers} 1727 1773 Handlers classes inheriting from {\bf FitsHandlerInterface} perform write/read operations 1728 1774 for AnyDataObj objects to/from FitsInOutFile streams. The {\bf FitsManager} class provides … … 1736 1782 {\bf \tcls{FitsArrayHandler}} and {\bf FitsHandler$<$BaseDataTable$>$}. \\ 1737 1783 A number of more specific handlers are also available, in particular for NTuple, 1738 \tcls{SphereHealPix} and \tcls{SphereThetaPhi}. 1784 \tcls{SphereHealPix} and \tcls{SphereThetaPhi}. \\[2mm] 1785 {\bf Warning:} Some handlers were written with the old FitsIOServer classes and 1786 inherit from the intermediate class {\bf FitsIOHandler}. They 1787 have been adapted to the new scheme, but may not perform correctly if not used 1788 through the {\bf FitsManager} class. \\[2mm] 1739 1789 %%% 1740 The example below illustrates the usage of FitsIOServer classes.1790 The examples below illustrates the usage of FitsIOServer classes. 1741 1791 \begin{enumerate} 1742 1792 \item Saving an array and a HealPix map to a Fits file 1743 1793 \begin{verbatim} 1744 1794 #include "fitsioserver.h" 1795 #include "fiosinit.h" 1796 1745 1797 // .... 1746 1798 { 1747 // Initialize the FitsIOServer module:1799 // Make sure FitsIOServer module is initialised : 1748 1800 FitsIOServerInit(); 1749 1801 // Create and open a fits file named myfile.fits … … 1759 1811 } 1760 1812 \end{verbatim} 1813 %%%% 1814 %%%% 1815 \item Reading objects and the header from the previously created fits file: 1816 \begin{verbatim} 1817 { 1818 FitsIOServerInit(); // Initialisation 1819 // ---- Open the fits file named myfile.fits 1820 FitsInFile fis("myfile.fits"); 1821 //---- print file information on cout 1822 cout << fis << endl; 1823 //--- Read in the array 1824 TArray<int_4> arr; 1825 fis >> arr; 1826 arr.Show(); 1827 //--- Position on second HDU 1828 fis.MoveAbsToHDU(2); 1829 //--- read and display header information 1830 DVList hdu2; 1831 fis.GetHeaderRecords(hdu2, true, true); 1832 cout << hdu2; 1833 //--- read in the HEALPix map 1834 SphereHEALPix<r_8> sph; 1835 FitsManager::Read(fis, sph); 1836 fis.MoveAbsToHDU(2); 1837 sph.Show(); 1838 } 1839 \end{verbatim} 1840 %%%%%%% 1841 %%% 1842 \item DataTable objects can be read from and written to FITS files as ASCII or 1843 binary tables. The example belo show reading the DataTable created in the example 1844 in section \ref{datatables} from a PPF file and saving it to a fits file; 1845 \begin{verbatim} 1846 { 1847 FitsIOServerInit(); // Initialisation 1848 FitsInOutFile fos("dtable.fits", FitsInOutFile ::Fits_Create); 1849 } 1850 \end{verbatim} 1851 %%%% 1761 1852 \end{enumerate} 1762 1853 1763 1764 \begin{verbatim}1765 #include "spherehealpix.h"1766 #include "fitsspherehealpix.h"1767 #include "fitstarray.h"1768 #include "tmatrix.h"1769 //...........................1770 1771 int m=...;1772 SphereHEALPix<r_8> sph(m);1773 ................1774 int dim1=...;1775 int dim2=...;1776 TMatrix<r_8> mat(dim1,dim2);1777 ............1778 1779 FITS_SphereHEALPix<r_8> sph_temp(sph);1780 FITS_TArray<r_8> mat_temp(mat);1781 // writing1782 1783 FitsOutFile os("myfile.fits");1784 sph_temp.Write(os);1785 mat_temp.Write(os);1786 1787 // reading1788 FitsInFile is("myfile.fits");1789 sph_temp.Read(is);1790 mat_temp.Read(is);1791 SphereHEALPix<r_8> new_sph=(SphereHEALPix<r_8>)sph_temp;1792 TMatrix<r_8> new_mat=(TMatrix<r_8>)mat_temp;1793 ................1794 1795 \end{verbatim}1796 1797 The operators {\tt operator << (FitsOutFile ...)} and1798 {\tt operator >> (FitsInFile ...)} are defined in order1799 to facilitate the FITS file operations:1800 \begin{verbatim}1801 // Writing an array object to a FITS file1802 #include "fitstarray.h"1803 FitsOutFile fio("arr.fits");1804 Matrix m(20,30);1805 m = 12345.;1806 fio << m;1807 // .....1808 // Reading a binary table to a XNTuple1809 #include "fitsxntuple.h"1810 XNTuple xn;1811 FitsInFile fii("table.fits");1812 fii >> xn;1813 \end{verbatim}1814 1854 1815 1855 A partial class diagram of FITS persistence handling classes is shown below. The … … 1823 1863 % \dclsb{FITS\_LocalMap} 1824 1864 \end{figure} 1865 1866 \subsection{SwFitsDataTable and other classes} 1867 1868 \subsection{scanfits} 1825 1869 1826 1870 \newpage
Note:
See TracChangeset
for help on using the changeset viewer.