Index: trunk/SophyaLib/Manual/piahelp.tex
===================================================================
--- trunk/SophyaLib/Manual/piahelp.tex	(revision 3419)
+++ trunk/SophyaLib/Manual/piahelp.tex	(revision 3429)
@@ -74,7 +74,7 @@
 fillnt & p. \pageref{fillnt}  & fillvec & p. \pageref{fillvec}  & gdfrvec & p. \pageref{gdfrvec}  \\  
 ntexpcfile & p. \pageref{ntexpcfile}  & ntloop & p. \pageref{ntloop}  & plot2d & p. \pageref{plot2d}  \\  
-plot2de & p. \pageref{plot2de}  & plot2dvec & p. \pageref{plot2dvec}  & plot2dw & p. \pageref{plot2dw}  \\  
-plot3d & p. \pageref{plot3d}  & plot3dw & p. \pageref{plot3dw}  & projh1d & p. \pageref{projh1d}  \\  
-projh2d & p. \pageref{projh2d}  & projprof & p. \pageref{projprof}  &   &   \\  
+plot2dc & p. \pageref{plot2dc}  & plot2de & p. \pageref{plot2de}  & plot2dvec & p. \pageref{plot2dvec}  \\  
+plot2dw & p. \pageref{plot2dw}  & plot3d & p. \pageref{plot3d}  & plot3dw & p. \pageref{plot3dw}  \\  
+projh1d & p. \pageref{projh1d}  & projh2d & p. \pageref{projh2d}  & projprof & p. \pageref{projprof}  \\  
 \end{tabular} 
 \end{center} 
@@ -103,8 +103,9 @@
 \begin{tabular}{llllll} 
 arrtoascii & p. \pageref{arrtoascii}  & fitsadapt & p. \pageref{fitsadapt}  & mtxfrascii & p. \pageref{mtxfrascii}  \\  
-ntfrascii & p. \pageref{ntfrascii}  & openppf & p. \pageref{openppf}  & print & p. \pageref{print}  \\  
-readfits & p. \pageref{readfits}  & saveall & p. \pageref{saveall}  & savelist & p. \pageref{savelist}  \\  
-saveobjs & p. \pageref{saveobjs}  & saveppf & p. \pageref{saveppf}  & scanfits & p. \pageref{scanfits}  \\  
-swfitstable & p. \pageref{swfitstable}  & vecfrascii & p. \pageref{vecfrascii}  & writefits & p. \pageref{writefits}  \\  
+ntfrascii & p. \pageref{ntfrascii}  & openfits & p. \pageref{openfits}  & openppf & p. \pageref{openppf}  \\  
+print & p. \pageref{print}  & readfits & p. \pageref{readfits}  & saveall & p. \pageref{saveall}  \\  
+savefits & p. \pageref{savefits}  & savelist & p. \pageref{savelist}  & saveobjs & p. \pageref{saveobjs}  \\  
+saveppf & p. \pageref{saveppf}  & scanfits & p. \pageref{scanfits}  & swfitstable & p. \pageref{swfitstable}  \\  
+vecfrascii & p. \pageref{vecfrascii}  & writefits & p. \pageref{writefits}  &   &   \\  
 \end{tabular} 
 \end{center} 
@@ -162,7 +163,8 @@
 bargraph & p. \pageref{bargraph}  & contour & p. \pageref{contour}  & disp & p. \pageref{disp}  \\  
 gfd2d & p. \pageref{gfd2d}  & gfd3d & p. \pageref{gfd3d}  & imag & p. \pageref{imag}  \\  
-imagnav & p. \pageref{imagnav}  & nt2d & p. \pageref{nt2d}  & nt2dvec & p. \pageref{nt2dvec}  \\  
-nt3d & p. \pageref{nt3d}  & ntcont & p. \pageref{ntcont}  & surf & p. \pageref{surf}  \\  
-textdrawer & p. \pageref{textdrawer}  & vecplot & p. \pageref{vecplot}  &   &   \\  
+imagnav & p. \pageref{imagnav}  & nt2d & p. \pageref{nt2d}  & nt2dci & p. \pageref{nt2dci}  \\  
+nt2dcn & p. \pageref{nt2dcn}  & nt2dvec & p. \pageref{nt2dvec}  & nt3d & p. \pageref{nt3d}  \\  
+ntcont & p. \pageref{ntcont}  & surf & p. \pageref{surf}  & textdrawer & p. \pageref{textdrawer}  \\  
+vecplot & p. \pageref{vecplot}  &   &  &  &   \\  
 \end{tabular} 
 \end{center} 
@@ -174,7 +176,7 @@
 cd & p. \pageref{cd}  & copy & p. \pageref{copy}  & cp & p. \pageref{cp}  \\  
 del & p. \pageref{del}  & delobjs & p. \pageref{delobjs}  & listdirs & p. \pageref{listdirs}  \\  
-listobjs & p. \pageref{listobjs}  & mkdir & p. \pageref{mkdir}  & mv & p. \pageref{mv}  \\  
-pwd & p. \pageref{pwd}  & rename & p. \pageref{rename}  & rm & p. \pageref{rm}  \\  
-rmdir & p. \pageref{rmdir}  & setdiratt & p. \pageref{setdiratt}  &   &   \\  
+listobjs & p. \pageref{listobjs}  & ls & p. \pageref{ls}  & mkdir & p. \pageref{mkdir}  \\  
+mv & p. \pageref{mv}  & pwd & p. \pageref{pwd}  & rename & p. \pageref{rename}  \\  
+rm & p. \pageref{rm}  & rmdir & p. \pageref{rmdir}  & setdiratt & p. \pageref{setdiratt}  \\  
 \end{tabular} 
 \end{center} 
@@ -232,9 +234,10 @@
 h/get\_vec & p. \pageref{hZgetZvec}  & h/integ & p. \pageref{hZinteg}  & h/oper & p. \pageref{hZoper}  \\  
 h/plot/2d & p. \pageref{hZplotZ2d}  & h/put\_vec & p. \pageref{hZputZvec}  & h/rebin & p. \pageref{hZrebin}  \\  
-h/set/cont & p. \pageref{hZsetZcont}  & h/set/err & p. \pageref{hZsetZerr}  & n/assoc/col & p. \pageref{nZassocZcol}  \\  
-n/copy & p. \pageref{nZcopy}  & n/merge & p. \pageref{nZmerge}  & n/merge/col & p. \pageref{nZmergeZcol}  \\  
-n/pl & p. \pageref{nZpl}  & n/plot & p. \pageref{nZplot}  & n/proj & p. \pageref{nZproj}  \\  
-n/read & p. \pageref{nZread}  & n/scan & p. \pageref{nZscan}  & reset & p. \pageref{reset}  \\  
-v/deriv & p. \pageref{vZderiv}  & v/integ & p. \pageref{vZinteg}  & v/sort & p. \pageref{vZsort}  \\  
+h/set/cont & p. \pageref{hZsetZcont}  & h/set/err & p. \pageref{hZsetZerr}  & herr/mean & p. \pageref{herrZmean}  \\  
+herr/variance & p. \pageref{herrZvariance}  & n/assoc/col & p. \pageref{nZassocZcol}  & n/copy & p. \pageref{nZcopy}  \\  
+n/merge & p. \pageref{nZmerge}  & n/merge/col & p. \pageref{nZmergeZcol}  & n/pl & p. \pageref{nZpl}  \\  
+n/plot & p. \pageref{nZplot}  & n/proj & p. \pageref{nZproj}  & n/read & p. \pageref{nZread}  \\  
+n/scan & p. \pageref{nZscan}  & reset & p. \pageref{reset}  & v/deriv & p. \pageref{vZderiv}  \\  
+v/integ & p. \pageref{vZinteg}  & v/sort & p. \pageref{vZsort}  &   &   \\  
 \end{tabular} 
 \end{center} 
@@ -467,6 +470,8 @@
   (_nl is the table line number or the sequential index)
 - NTuple: ntuple variable names,_nl
-- Histo1D/HProf/HistoErr: i,x,val,err,nb,_nl
+- Histo1D/HProf: i,x,val,err,nb,_nl
 - Histo2D: i,j,x,y,val,err,_nl
+- HistoErr: i,x,val,err2,nb,_nl
+- Histo2DErr: i,j,x,y,val,err2,nb,_nl
 - Vector/Matrix: n,r,c,val,real,imag,mod,phas,_nl
 - TArray: n,x,y,z,t,u,val,real,imag,mod,phas,_nl
@@ -504,6 +509,8 @@
 \piacommand{fillgd2} \label{fillgd2} 
 \begin{verbatim} 
-Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)
- Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]
+Creates and Fills a GeneralFitData with 
+            (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)
+ Usage: fillgd2 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() 
+                                [Cut() loop_param]
   Related commands: ntloop fillnt ObjectExpressions ...
 \end{verbatim} 
@@ -511,13 +518,16 @@
 \begin{verbatim} 
 Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) =  h_V(Object) 
- Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]
+ Usage: fillmtx namevec nameobj f_X() g_Y() h_V() 
+                [Cut() graphic_attributes loop_param]
   Related commands: fillvec fillnt ObjectExpressions ...
 \end{verbatim} 
 \piacommand{fillnt} \label{fillnt} 
 \begin{verbatim} 
-Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))
+Creates and Fills an NTuple(x,y,z,t) with 
+            (X=f(Object),Y=g(...),Z=h(...),T=k(...))
  Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]
   Related commands: ntloop plot2d projh1d projh2d projprof 
-  Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...
+  Related commands: fillvec fillmtx ntloop exptovec fillgd1 
+                    fillgd2 ObjectExpressions ...
 \end{verbatim} 
 \piacommand{fillvec} \label{fillvec} 
@@ -545,8 +555,9 @@
 \begin{verbatim} 
 Loops over an Object NTupleInterface calling a function from a C-file 
-and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))
+and optionaly fills an NTuple(x,y,z,t) with 
+     (X=f(Object),Y=g(...),Z=h(...),T=k(...))
  Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]
-  Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...
-  Related commands: ntexpcfile fillnt
+  Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 
+  Related commands: exptovec ntexpcfile fillnt ObjectExpressions ...
 \end{verbatim} 
 \piacommand{plot2d} \label{plot2d} 
@@ -556,8 +567,15 @@
   Related commands: plot2de plot2dw plot3d plot3dw ObjectExpressions ...
 \end{verbatim} 
+\piacommand{plot2dc} \label{plot2dc} 
+\begin{verbatim} 
+Plots (2D) Y=g(Object) vs. X=f(Object) with Color ColIndex=h(Object) 
+ Usage: plot2dc nameobj f_X() g_Y() h_Col() [Cut() graphic_attributes loop_param]
+  Related commands: plot2d plot2dw plot3d ObjectExpressions ...
+\end{verbatim} 
 \piacommand{plot2de} \label{plot2de} 
 \begin{verbatim} 
 Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) 
- Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]
+ Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() 
+                graphic_attributes loop_param]
   Related commands: plot2d plot2dw plot3d ObjectExpressions ...
 \end{verbatim} 
@@ -571,5 +589,5 @@
 Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) 
  Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]
-  Related commands: plot2d plot2dw plot3d ObjectExpressions ...
+  Related commands: plot2d plot2dc plot3d ObjectExpressions ...
 \end{verbatim} 
 \piacommand{plot3d} \label{plot3d} 
@@ -595,5 +613,6 @@
 \begin{verbatim} 
 Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram 
- Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]
+ Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() 
+                graphic_attributes loop_param]
    Histo2D nameh2d is created if necessary 
   Related commands: projh1d projprof ObjectExpressions ...
@@ -602,5 +621,6 @@
 \begin{verbatim} 
 Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram 
- Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]
+ Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() 
+                 graphic_attributes loop_param]
    HProf nameprof is created if necessary 
   Related commands: projh1d projh2d ObjectExpressions ...
@@ -702,9 +722,19 @@
   Related commands: ntloop fillnt 
 \end{verbatim} 
+\piacommand{openfits} \label{openfits} 
+\begin{verbatim} 
+openfits: alias for readfits 
+
+\end{verbatim} 
 \piacommand{openppf} \label{openppf} 
 \begin{verbatim} 
-Reads all or some objects from a PPF file 
- Usage: openppf filename [objname1 objname2 ...]
-  Related commands: saveall 
+Reads all or some objects from a PPF file
+  Usage: (1) openppf filename 
+     Or  (2) openppf -s filename (2)
+     Or  (3) openppf filename objname1 [ objname2 ...]
+  The first form reads all objects at NameTags,
+    or all objects if the file has no NameTags.
+  The third reads only the objects with the specified nametags
+  Related commands: saveppf saveall savelist
 \end{verbatim} 
 \piacommand{print} \label{print} 
@@ -726,4 +756,9 @@
  Usage: saveall filename
   Related commands: saveobj savelist openppf
+\end{verbatim} 
+\piacommand{savefits} \label{savefits} 
+\begin{verbatim} 
+savefits: alias for writefits 
+
 \end{verbatim} 
 \piacommand{savelist} \label{savelist} 
@@ -943,6 +978,6 @@
 \begin{verbatim} 
 Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)
- Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]
-  Related commands: func funcff func2d 
+ Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [gr_att]
+Related commands: func funcff func2d 
 \end{verbatim} 
 \piacommand{funcff} \label{funcff} 
@@ -1198,5 +1233,6 @@
 o <Alt>D : Shows the drawer manipulation pop-up menu 
 o <Alt>V : Copy/Paste / Text paste at the current cursor position 
-o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer 
+o <Alt>C : Copy/Paste / Copies the selected region content as text 
+                        in the copy/paste buffer 
 o <Alt>X : Show/Hide the Cut Window 
 o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) 
@@ -1248,6 +1284,8 @@
 o Most objects can be also be displayed overlayed 
   on the last displayed widget (gr_att= same) 
-o The overlay can be on a selected rectangle of the 
-  last displayed widget (gr_att= inset) - See setinsetlimits
+  or by specifying a widget name samew=Widgetname 
+o The widget/window name can be specified (gr_att wname=Name) 
+o The overlay can be on a selected rectangle of the last 
+  displayed widget (gr_att: inset  or inset=fxmin,fxmax,fymin,fymax) 
 
   Related commands: newwin zone stacknext graphicatt setinsetlimits
@@ -1310,12 +1348,14 @@
 >> imagecenter=ix,iy : Position the image in widget
 >> lut=ltyp,min,max : Sets LUT type and min/max
-                      (ltyp=lin/log/sqrt/square)
+                   (ltyp=lin/log/sqrt/square)
+>> autolut=alt[,ns[,min,max]] : AutoLut method selection 
+                   (alt=minmax/meansig/hispeak/histail)
 >> invx,invy,exchxy : image axes configuration
->> for Axes / Axe labels / LogScale / xylimits / defdrrect
-       see setaxesatt command
 --- General purpose options:
 >> stat,stats / nsta,nstat,nostat,nostats : Toggle statistic display
 >> title,tit / notitle,notit -> Toggle automatic title display
 >> Choose display window: next same win stack inset
+>> for Axes / Axe labels / LogScale / xylimits / defdrrect
+       see setaxesatt command
 
    Related commands: setaxesatt setinsetlimits 
@@ -1387,5 +1427,6 @@
 Define the display rectangle for drawers added as insets 
  over existing graphic objects - limits expressed as fraction 
- graphic object size (0. .. 1.) Xmax at right, YMax top.  Usage: setinsetlimits xmin xmax ymin ymax
+ graphic object size (0. .. 1.) Xmax at right, YMax top 
+  Usage: setinsetlimits xmin xmax ymin ymax
   Related commands: graphicatt /inset
 \end{verbatim} 
@@ -1482,5 +1523,17 @@
 Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple 
  Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]
-  Related commands: disp  surf  nt3d  gfd2d vecplot
+  Related commands: disp surf nt2dcn nt2dci nt3d  gfd2d vecplot
+\end{verbatim} 
+\piacommand{nt2dci} \label{nt2dci} 
+\begin{verbatim} 
+   with colors specified by a column content (as color index) 
+ Usage : nt2dci nameobj color varx vary [errx erry wt label graphic_attributes]
+  Related commands: disp  surf  nt2d nt2dci nt3d  gfd2d vecplot
+\end{verbatim} 
+\piacommand{nt2dcn} \label{nt2dcn} 
+\begin{verbatim} 
+   with colors specified by a column content (as color names) 
+ Usage : nt2dcn nameobj color varx vary [errx erry wt label graphic_attributes]
+  Related commands: disp  surf  nt2d nt2dci nt3d  gfd2d vecplot
 \end{verbatim} 
 \piacommand{nt2dvec} \label{nt2dvec} 
@@ -1571,6 +1624,12 @@
 \begin{verbatim} 
 Prints the list of objects (Alias: ls)
- Usage: listobjs [patt=*] 
- patt : /*/x?y* ... 
+ Usage: listobjs [patt=*]  
+    Or  listobjs patt VarName 
+   Obj. name pattern patt in the form abc?x* or /*/x?y ... 
+\end{verbatim} 
+\piacommand{ls} \label{ls} 
+\begin{verbatim} 
+ Alias for listobjs 
+ Usage: ls [patt=*] [VarName]
 \end{verbatim} 
 \piacommand{mkdir} \label{mkdir} 
@@ -1833,5 +1892,6 @@
 \begin{verbatim} 
 Project a map(double) into a local map(double)
- Usage: map2local map(double) localmap(double) nx,ny angleX,angleY phi0,theta0 [x0,y0] [angle]
+ Usage: map2local map(double) localmap(double) nx,ny angleX,angleY phi0,theta0 
+                  [x0,y0] [angle]
    nx,ny: number of pixels in x(col),y(row) direction
           X-axis==phi, Y-axis==theta
@@ -2068,4 +2128,18 @@
      set error to setvalue for error values range v1:v2
   Related commands: h/set/cont
+\end{verbatim} 
+\piacommand{herr/mean} \label{herrZmean} 
+\begin{verbatim} 
+Perform bin mean computation for HistoErr and Histo2DErr
+ herr/mean nameherr todo
+    todo = +1 : compute mean
+         = -1 : cancel computation
+\end{verbatim} 
+\piacommand{herr/variance} \label{herrZvariance} 
+\begin{verbatim} 
+Perform bin mean and variance computation for HistoErr and Histo2DErr
+ herr/variance nameherr todo
+    todo = +1 : compute mean and variance
+         = -1 : cancel computation
 \end{verbatim} 
 \piacommand{n/assoc/col} \label{nZassocZcol} 
Index: trunk/SophyaLib/Manual/piapp.tex
===================================================================
--- trunk/SophyaLib/Manual/piapp.tex	(revision 3419)
+++ trunk/SophyaLib/Manual/piapp.tex	(revision 3429)
@@ -22,7 +22,7 @@
            ]{hyperref}
 
-\setlength{\textwidth}{17cm}
-\setlength{\textheight}{21.5cm}
-\setlength{\topmargin}{0.5cm}
+\setlength{\textwidth}{15cm}
+\setlength{\textheight}{20.5cm}
+\setlength{\topmargin}{0.cm}
 \setlength{\oddsidemargin}{0.cm}
 \setlength{\evensidemargin}{0.cm}
@@ -72,5 +72,5 @@
 \vspace{1cm}
 \begin{center}
-{\bf \Large piapp Version: 4.1 (V\_Aug2007) } 
+{\bf \Large piapp Version: 4.1 (V\_Nov2007) } 
 \end{center}
 \titrebp{5}
@@ -111,6 +111,12 @@
 \end{itemize}
 %%%
-\vspace*{5mm}
-\par
+\begin{figure}[ht!]
+\begin{center}
+\includegraphics[width=15cm]{piapp_mainwin.eps}
+\caption{piapp main window}
+\label{figmainwin}
+\end{center}
+\end{figure}
+\subsection{starting piapp}
  {\bf piapp} can simply be started on the command line in a terminal window 
 once the SOPHYA/piapp  environment has been initialised. 
@@ -135,11 +141,12 @@
  SophyaInitiator::SophyaInitiator() BaseTools Init
  PIOPersist::Initialize() Starting Sophya Persistence management service 
-SOPHYA Version  2.0 Revision 0 (V_Jul2006) -- Jul 18 2006 12:35:58 gcc 3.3 20030304 (Apple Computer, Inc. build 1495)
-
+SOPHYA Version  2.1 Revision 0 (V_Nov2007) -- Nov 24 2007 13:08:58 gcc 3.3 
+20030304 (Apple Computer, Inc. build 1495)
  piapp: Interactive data analysis and visualisation program 
- Usage: piapp [-nored] [-termread] [-term] [-hidezswin] [-small] 
-              [-nosig] [-nosigfpe] [-nosigsegv] 
+ Usage: piapp [-nored] [-doublered] [-termread] [-term] 
+              [-hidezswin] [-small] [-nosig] [-nosigfpe] [-nosigsegv] 
               [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]] 
   -nored : Don't redirect stdout/stderr to piapp console
+  -doublered : Redirect stdout/stderr to piapp console AND the terminal 
   -termread : Read commands on terminal (stdin)
   -term : equivalent to -nored -termread -small 
@@ -166,5 +173,6 @@
 {\bf Warning:} The output redirection uses unix pipes. On Linux, with commands
 producing long outputs, the application may block because of incorrect management
-of pipes. If this happens, use piapp with  {\tt -nored} flag. 
+of pipes. If this happens, use piapp with  {\tt -nored} flag. This problem has been 
+in principle solved with SOPHYA V=2.1 / piapp V=4.1
 
 \par 
@@ -175,13 +183,4 @@
 Section \ref{piappcmdref} contains a brief description of all piapp commands 
 and help items. Various interactive control windows are described in appendix.
-
-\vspace*{10mm}
-\begin{figure}[ht!]
-\begin{center}
-\includegraphics[width=16cm]{piapp_mainwin.eps}
-\caption{piapp main window}
-\label{figmainwin}
-\end{center}
-\end{figure}
 
 
@@ -392,5 +391,6 @@
 {\bf disp} command  \myppageref{disp} can be used to display the object, while 
 other commands like {\bf surf} \myppageref{surf} , {\bf imag} 
-or {\bf contour} \myppageref{contour} will try to force a given graphic representation. \\
+or {\bf contour} \myppageref{contour} will try to force a given graphic representation. 
+
 Data from table like objects can be plotted using commands like {\bf nt2d}
 \myppageref{nt2d} or {\bf nt3d} \myppageref{nt3d}. Most objects in piapp 
@@ -398,13 +398,17 @@
 like  {\bf plot2d} \myppageref{plot2d} , {\bf plot3d} \myppageref{plot3d} 
 or {\bf n/plot}  \myppageref{nZplot}. These commands are described in section
-\ref{tableplot}. \\
-Commands producing a graphic output have usually an optional argument called 
-{\tt graphic\_attributes} or {\tt gr\_att}. This argument provide a flexible and easy 
-way to change and customise the output graphic, as discussed in the paragraph below. 
+\ref{tableplot}. 
+
+Commands producing a graphic output have usually an optional argument called \\
+{\tt graphic\_attributes} or {\tt gr\_att}. \\
+This argument provide a flexible and easy 
+way to change and customise the output graphic, as discussed in the paragraphs below.
+ 
 The piapp graphics can be exported in postscript (.ps) or encapsulated postscript 
 (.eps) format. The commands {\bf w2ps} \myppageref{w2ps} and 
  {\bf w2eps} \myppageref{w2eps} as well the menu  \menubar{PostScript} can 
- be used to export graphics. \\[1mm]
-The examples below illustrates the usage of some piapp graphic commands.
+ be used to export graphics. \\[2mm]
+The examples in the followwing pages illustrates the usage of some piapp graphic commands. 
+\newpage
 \begin{enumerate}
 \item Image display 
@@ -483,7 +487,9 @@
 for multi-layer 2D overlay vector graphics. \\[2mm]
 %%
-Main piapp/PI graphic viewers, windows and drawer objects:
-\begin{itemize}
-\item[\bul]  The {\bf PIScDrawWdg} handles a set of  of 2-D drawers, managing 
+Main piapp/PI graphic viewers, windows and drawer objects are described if 
+the following sections.
+
+\subsubsection{PIScDrawWdg (2D display)}
+The {\bf PIScDrawWdg} handles a set of  of 2-D drawers, managing 
 the 2D coordinate  system and interactive zoom. The axes drawing is 
 handled by a specialised drawer, number 0, which also manages various added 
@@ -494,5 +500,6 @@
 activates the PIDrawer graphic attributes control window ({\bf PIDrawerTools}).
 %%%
-\item[\bul] The {\bf PIDraw3DWdg}  handles a set of of 3-D drawers, managing
+\subsubsection{PIDraw3DWdg (3D display)}
+The {\bf PIDraw3DWdg}  handles a set of of 3-D drawers, managing
 interactive camera/object rotation (mouse-button-2) and zoom (mouse-button-2). 
 {\tt $<$Alt$>$G} to display/activate  the PIDrawer graphic attributes 
@@ -502,5 +509,6 @@
 Drawer 0 handles axes drawing and graphic elements.
 %%%
-\item[\bul] The display of 2-D arrays $A(i,j)$ as an image is managed by 
+\subsubsection{PIImage (Image Display)}
+The display of 2-D arrays $A(i,j)$ as an image is managed by 
 the {\bf PIImage} viewer/widget. The PI library interface  {\bf P2DArrayAdapter} is used
 to represent a generic 2-D array. The array values are converted into an index, converted 
@@ -515,22 +523,39 @@
 axes drawing and added graphic elements.
 %%%
-\item[\bul] {\bf Windows} 
+\subsubsection{Windows}
 The viewers described above are displayed in differnt kind of windows.
 The graphic option {\tt next,win,same,stack} can be used to control the way the
 type of windows used. Graphic windows can be divided into several zones
-(Command {\bf zone} \myppageref{zone}).
+(Command {\bf zone} \myppageref{zone}). 
+
+When an object is diplayed in piapp, a widget (PIWdg) is created which manages 
+the drawer or the 2d-array.  The default name for this widget is the displayed 
+object name. However, it is possible to specify a name using the graphic attribute: \\
+\hspace*{5mm} {\tt wname=WidgetName} \\
+It is possible to display multiple objects on a single widget, corresponding
+to the superposition of the different drawers. Displaying an object superimposed
+on the previously displayed object can be done using the graphic option 
+{\tt same}. It is also possible to specify a target widget by its name, through 
+the graphic option \\
+\hspace*{5mm} {\tt samew=WidgetName} \\
+It is also possible to specify the display of the drawer in a specified region
+of the last displayed widget \\
+\hspace*{5mm} {\tt same=fx1,fx2,fy1,fy2} \\
+where {\tt fx1,fx2,fy1,fy2} express X and Y limits, as fraction of widget size. 
+ 
 Refer to the command reference section on windows ({\bf Windows}
 \myppageref{Windows})
 for information on the different type of windows used by piapp 
-and their properties.
+and their properties. \\
+ 
 %%% 
-\item[\bul] {\bf PIDrawer} Graphical representation of most objects in piapp is 
-handled through objects inheriting from the PIDrawer class. A base drawer 
+\subsubsection{Drawers}
+Graphical representation of most objects in piapp is 
+handled through objects inheriting from the {\bf PIDrawer class}. A base drawer 
 (PIElDrawer, number 0) associated to all three above viewers manages the axes drawing 
 as well as the added graphic elements (text, arrow, \ldots). A drawer management menu 
 can be activated using {\tt $<$Alt$>$D}. This menu can be used to move and resize
 drawers, or to display a window for changing drawers graphic attributes. 
-\end{itemize}
-
+%%%
 \par
 In addition, a number of control windows can be used to examine and 
@@ -764,4 +789,15 @@
   
 \end{verbatim}  
+\item[\bul]  The {\bf (PIContourDrawer)} decodes the following options :  \\
+\begin{verbatim}
+ autolevels : automatic selection of levels and number of contours 
+ ncont=nLevel (or nc=NLevel) : sets the number of contour
+ lev=v1,v2,v3... (or niv=v1,v2,v3...) set the number and levels of contours
+ lstep=nLev,start,step : define incremental levels 
+ labon/laboff : display of contour level values on/off 
+ linear/bspline/cubicspl=3spl : select contour kind 
+ 
+\end{verbatim}  
+
 \item[\bul]  {\bf PIBarGraph} options : \\
 \begin{verbatim}
@@ -794,15 +830,139 @@
 \end{itemize}
 
-\subsection{text files}
-ASCII files (see {\tt ntfrascii} \myppageref{ntfrascii} and 
-{\tt newnt} \myppageref{newnt} command)
-\subsection{FITS and PPF}
-FITS format files, through \menubar{File/Open-Fits}. 
-(see also (see {\tt openfits} \myppageref{openfits}) command.
-PPF (Portable Persistence file Format) files through 
-menu \menubar{File/Open-PPF}. PPF files are the native persistence 
-format in Sophya 
+\subsection{Text files}
+Text (or ascii) files can be read into array or datatable objects by spiapp. 
+
+{\bf Arrays :} \\
+Arrays can be written to to files in text/ascii format using the {\tt arrtoascii}
+  \myppageref{arrtoascii} command. Double precision matrices and vectors 
+  can be read from text files using the commands 
+  {\tt mtxfrascii}  \myppageref{mtxfrascii} and
+    {\tt vecfrascii}  \myppageref{vecfrascii} . \\
+The menu-bar command  \menubar{File/Open-ASCII} reads in a text 
+file as a matrix. 
+\begin{verbatim}
+#  Create and initialize a matrix
+newmtx arr 250 150 x+3*y 
+#  Save the file in the text file arr.txt
+arrtoascii arr arr.txt
+#  Read the previously created file and fill a matrix
+mtxfrascii mxa arr.txt
+#  Print and display the matrix 
+print mxa
+disp mxa zoomx2
+\end{verbatim}
+It is possible to specify the field separator in the input file, as well as the marker for the comment 
+lines. 
+
+{\bf DataTable :} \\
+Text files can also be read as a 2-D table (NTuple or DataTable). The table should be 
+created using the  {\tt newnt} \myppageref{newnt}  or 
+{\tt newdt} \myppageref{newdt} command.  
+The command {\tt ntfrascii} \myppageref{ntfrascii} can then be used to append
+data from the file to the datatable.
+
+\subsection{PPF}
+%%%
+PPF (Portable Persistence file Format) is the the native persistence 
+format of SOPHYA and thus is fully handled by spiapp.   PPF files can 
+be opened through the menu-bar  \menubar{File/Open-PPF}, or through 
+the {\tt openppf} \myppageref{openppf}.
+
+If the PPF file contains NameTags, only the objects marked with nametags are read and given 
+the corresponding names. Otherwise, all objects are red sequentially, with their names 
+formed by the filename followed by a sequence number. It is also possible to force the sequential 
+reading specifying the {\tt -s} flag for openppf.
+
+The objects managed in spiapp by the {\bf NamedObjMgr} can be saved to PPF files, with their
+names as NameTags. The commands {\tt saveppf} \myppageref{saveppf} or 
+ {\tt saveall} \myppageref{saveall} can be used to this end.
+
+\begin{verbatim}
+# Create two vectors and two matrices
+newvec va1 150 sin(sqrt(x)) 
+newvec vb2 150 sin(sqrt(x))*sqrt(x*0.1)
+newmtx mxa 250 150 x+2.*y
+newmtx mxb 250 150 sin(sqrt(x))*cos(sqrt(y))
+# List of the objects in memory 
+listobjs
+#  Save the two vectors in the file vecab.ppf
+saveppf v* vecab.ppf
+#  Save the two matrices in the file mxab.ppf
+saveppf m* mxab.ppf
+\end{verbatim}
+
+\subsection{FITS}
+FITS files may contain three types of data structures 
+\begin{enumerate}
+\item Image or array data structure : {\tt IMAGE\_HDU}
+\item Binary table : {\tt BINARY\_TBL}
+\item ascii table : {\tt ASCII\_TBL}
+\end{enumerate}
+The {\bf FitsIOServer} module contain FitsHandler classes which 
+can map many SOPHYA classes on FITS data structures.
+Generic {\tt IMAGE\_HDU} correspond to the SOPHYA \tcls{TArray}
+class, while {\tt BINARY\_TBL} or {\tt ASCII\_TBL} is mapped 
+to NTuple or DataTable.
+
+FITS format files can be read through the menu command \menubar{File/Open-Fits},
+or using {\tt readfits/openfits} \myppageref{readfits} command.
+Objects can be exported to FITS using the {\tt writefits/savefits} 
+\myppageref{writefits} command.
+
+\begin{verbatim}
+# Open the PPF file created by the commands above
+openppf vecab.ppf
+# Export the two vector objects to file vecab.fits
+# Note that the '!' forces c-fitsio to overwrite the file, if it exists
+writefits v?? !vecab.fits
+\end{verbatim}
+
 \subsection{Graphic export in postscript}
-See the menu under \menubar{PostScript}
+%%
+Postscript a page description language widely used for printing and 
+graphic output, developed by Adobe systems. Refer to 
+\href{http://www.adobe.com/products/postscript/}{Adobe/PostScript3} 
+for more detail.
+
+Piapp graphic output can be exported in postscript (level 2) or
+encapsulated postscript format. 
+Postscript (.ps) files my contain several pages, each vue or window
+corresponding to one page and are suitable for direct printing. 
+An Encapsulated Postscript (.eps) file contains a single page,
+corresponding to a window and is suitable for inclusion in 
+other document. 
+
+Postscript file can easily be converted to other formats, 
+PDF or image formats (jpeg \ldots) using converters like
+{\bf ps2pdf} or {imagemagick}.  
+
+The menu items under \menubar{PostScript} can be used to export 
+graphics in postscript. The default file name is {\tt pia.ps}
+or {\tt pia1.eps} {\tt pia2.eps} \ldots
+The following commands can also be used to create postscriot file
+from the display in the current graphic window:
+\begin{itemize}
+\item {\tt w2ps} \myppageref{w2ps} to add the current graphic 
+output as a new page to the output postscript file.
+The current output postscript file (default = w2ps.ps) 
+should be closed before being used. Exiting piapp closes automatically 
+all postscript files.
+\item {\tt psclosefile} \myppageref{psclosefile} to close the current
+output postscript file.
+\item {\tt pssetfilename} \myppageref{pssetfilename} To define 
+the output postscript file name for the subsequent {\tt w2ps} commands.
+\item {\tt w2eps} \myppageref{w2eps} to export the current 
+graphic display, in Encapsulated Postscript format to the specified file. 
+\begin{verbatim}
+# Open the PPF file created by the commands above
+openppf vecab.ppf
+# Display one of the vectors
+setaxesatt 'font=helvetica,bold,18 fixedfontsize'
+disp va1 'blue marker=box,5' 
+#  Export the graphic to file va1.eps
+w2eps va1.eps 
+#  The created file can be viewed using gv 
+\end{verbatim}
+\end{itemize}
 
 %%%%%%%%%%%%%%% Section 5 :   analyse a la paw
@@ -857,5 +1017,6 @@
 # Notice that spaces before / after '(' and ')' are mandatory 
 Cmd> set vecv ( mot1 mot2 mot3 mot4 mot5 )
-# Arithmetic  expression : C language syntax - spaces before/after '=' are mandatory  
+# Arithmetic  expression : C language syntax - spaces 
+# before/after '=' are mandatory  
 Cmd> a = 2+3*sqrt(4)
 # The '=' operator can also be used to initialize a variable with a string
@@ -932,5 +1093,6 @@
 piapp[3] echo ${va.?}
 TMatrix.Att: rank size/nelts nrow/nrows ncol/ncols sum 
-#  Compound names, in the form  name.att must be inclosed in braces {name.att}
+#  Compound names, in the form  name.att must be inclosed in
+#    braces {name.att}
 piapp[4] echo ${va.size}
 12 
