source: Sophya/trunk/SophyaLib/Manual/piapp.tex@ 3041

Last change on this file since 3041 was 3041, checked in by ansari, 19 years ago

ecriture documentation piapp pour piapp V4/sophya V2 , Reza 20/7/2006

File size: 31.4 KB
Line 
1\documentclass[twoside,10pt]{article}
2% \usepackage[latin1]{inputenc}
3% \usepackage[T1]{fontenc}
4\usepackage[francais]{babel}
5\usepackage{graphicx}
6
7\usepackage{amsmath}
8\usepackage{amssymb}
9\usepackage{latexsym}
10
11\usepackage{palatino}
12
13% Definition pour Docs Sophya
14\usepackage{defsophya}
15
16\usepackage{makeidx}
17
18\usepackage[ps2pdf,bookmarks,bookmarksnumbered,%
19 urlcolor=blue,citecolor=blue,linkcolor=blue,%
20 pagecolor=blue,%hyperindex,%
21 colorlinks=true,hyperfigures=true,hyperindex=true
22 ]{hyperref}
23
24\setlength{\textwidth}{17cm}
25\setlength{\textheight}{21.5cm}
26\setlength{\topmargin}{0.5cm}
27\setlength{\oddsidemargin}{0.cm}
28\setlength{\evensidemargin}{0.cm}
29\setlength{\unitlength}{1mm}
30
31% \newcommand{\piacommand}[1]{
32% \framebox{\bf \Large #1 } \index{#1} % (Command)
33%}
34% \newcommand{\piahelpitem}[1]{
35% \framebox{\bf \Large #1 } \index{#1} (Help item)
36%}
37
38\newcommand{\rond}{$\bullet \ $}
39\newcommand{\etoile}{$\star \ $}
40\newcommand{\cercle}{$\circ \ $}
41\newcommand{\carre}{$\Box \ $}
42
43%%%% Definition des commandes pour l'aide en ligne
44\newcommand{\piacommand}[1]{
45$\blacksquare$ \hspace{3mm} {\bf \Large #1 } \index{#1} % (Command)
46}
47\newcommand{\piahelpitem}[1]{
48$\square$ \hspace{3mm} {\bf \Large #1 } \index{#1} (Help item)
49}
50
51\newcommand{\menubar}[1]{\hspace{1mm} \framebox{\it MenuBar::#1} \hspace{1mm}}
52
53\newcommand{\myppageref}[1]{ (p. \pageref{#1} ) }
54
55\makeindex % Constitution d'index
56
57\begin{document}
58\begin{titlepage}
59% The title page - top of the page with the title of the paper
60\titrehp{piapp \\ An interactive data analysis tool}
61% Authors list
62\auteurs{
63R. Ansari & ansari@lal.in2p3.fr \\
64E. Aubourg & aubourg@hep.saclay.cea.fr \\
65C. Magneville & cmv@hep.saclay.cea.fr \\
66O. Perdereau & perderos@lal.in2p3.fr \\
67}
68% \author{R. Ansari {\tt ansari@lal.in2p3.fr} \\
69% E. Aubourg {\tt aubourg@hep.saclay.cea.fr} \\
70% C. Magneville {\tt cmv@hep.saclay.cea.fr}
71% }
72\vspace{1cm}
73\begin{center}
74{\bf \Large piapp Version: 4.0 (V\_Jul2006) }
75\end{center}
76\titrebp{5}
77
78\end{titlepage}
79
80\newpage
81\tableofcontents
82\newpage
83
84\section{Introduction}
85\index{piapp}
86{\bf piapp} (or {\bf spiapp}) is an interactive data analysis
87and visualization program. It is based on the {\bf PI} GUI library
88and the {\bf SOPHYA} \footnote{see http://www.sophya.org}
89(or {\bf PEIDA++} \footnote{PEIDA++ has been used in EROS software.
90(http://eros.in2p3.fr). It is not maintained anymore.})
91C++ data analysis class library.
92\par
93{\bf piapp} is a powerful command oriented tool for visualising and analysing data.
94Its main features are summarised below:
95\begin{itemize}
96\item[\rond] Image, multiple 2D and few 3D representations
97\item[\rond] Highly interactive graphics, with postscript as export format
98\item[\rond] Capability to handle large data sets. Data can be imported and
99exported in different formats: ASCII, PPF and FITS.
100\item[\rond] Interactive analysis: 2D/3D distributions, histograms, FFT \ldots
101\item[\rond] Flexible c-shell inspired command interpreter.
102\item[\rond] Possibility to perform more complex operations in C++, on objects
103managed by the application through the on-the-fly compilation and execution
104of c++ code fragments in piapp.
105\item[\rond] piapp is a multi-threaded program with separate threads for graphics
106and command execution, ensuring interactive response, even while heavy
107computation is being performed. In addition, thread safe commands can be executed
108in separate threads, for taking advantage of multi CPU (or CPU-cores) workstations.
109\item[\rond] The application can be easily extended through modules which can be
110loaded at run time.
111\end{itemize}
112%%%
113\vspace*{5mm}
114\par
115 {\bf piapp} can simply be started on the command line in a terminal window
116once the SOPHYA/piapp environment has been initialised.
117The environment variables {\tt SOPHYABASE} should contain the directory
118where SOPHYA/piapp has been installed. the shared library path
119{\tt LD\_LIBRARY\_PATH} must contain {\tt \$SOPHYABASE /slb} and the
120current directory {\tt .} and the executable search path {\tt PATH} must
121contain {\tt \$SOPHYABASE /exe}. Refer to the SOPHYA overview manual
122for more information on SOPHYA directory structure. \\
123It might also be necessary to define the environment variable
124{\bf PIXKBMOMASK}, used by the libPI.a to map correctly
125the {\tt <Alt>} key with some X servers (in particular with
126X11 on MacOS X). \\
127{\tt csh> setenv PIXKBMODMASK 2 }
128\par
129{\tt (s)piapp -h} provides a brief help of the command line
130arguments. Xtoolkit options can also be specified as command line
131arguments. {\bf spiapp} is the name of SOPHYA/piapp executable,
132in order to distinguish it from PEIDA/piapp.
133\begin{verbatim}
134csh> spiapp -h
135 SophyaInitiator::SophyaInitiator() BaseTools Init
136 PIOPersist::Initialize() Starting Sophya Persistence management service
137SOPHYA Version 2.0 Revision 0 (V_Jul2006) -- Jul 18 2006 12:35:58 gcc 3.3 20030304 (Apple Computer, Inc. build 1495)
138
139 piapp: Interactive data analysis and visualisation program
140 Usage: piapp [-nored] [-termread] [-term] [-hidezswin] [-small]
141 [-nosig] [-nosigfpe] [-nosigsegv]
142 [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]]
143 -nored : Don't redirect stdout/stderr to piapp console
144 -termread : Read commands on terminal (stdin)
145 -term : equivalent to -nored -termread -small
146 -hidezswin : Hide Zoom/Stat/ColMap window
147 -small : Create small size main piapp window
148 -nosig : Don't catch SigFPE, SigSEGV
149 -nosigfpe -nosigsegv: Don t catch SigFPE / SigSEGV
150 -tmpdir TmpDirectory: defines TMDIR for temporary files
151 -help2tex: Create a LaTeX help file (piahelp.tex)
152 -exec file [args] : Execute command file (last option)
153\end{verbatim}
154Once {\bf piapp} is started, the main piapp window appears.
155It contains the menu bar, an upper part with the zoom and colormap
156widgets for image displays, memory and CPU usage and a terminal like
157widget (piapp console, see {\bf PIConsole} \myppageref{PIConsole})
158in the lower part. The figure \ref{figmainwin}
159shows an image of the piapp main window.
160{\tt stdout/cout, stderr/cerr} are redirected to the piapp console and
161commands can be entered in this widget. It is also possible to keep
162the terminal where piapp was started for {\tt stdout/stderr} (flag {\tt -nored}).
163It is also possible to have a command reader on the terminal
164({\tt stdin}), using the flag {\tt -term}. \\[1mm]
165%
166{\bf Warning:} The output redirection uses unix pipes. On Linux, with commands
167producing long outputs, the application may block because of incorrect management
168of pipes. If this happens, use piapp with {\tt -nored} flag.
169
170\par
171In section 2, we present a quick tour of {\bf piapp}.
172a brief overview of piapp graphics, supported data formats, interactive
173analysis possibilities, the command interpreter and c++ execution
174are presented in the following sections.
175Section \ref{piappcmdref} contains a brief description of all piapp commands
176and help items. Various interactive control windows are described in appendix.
177
178\vspace*{10mm}
179\begin{figure}[ht!]
180\begin{center}
181\includegraphics[width=16cm]{piapp_mainwin.eps}
182\caption{piapp main window}
183\label{figmainwin}
184\end{center}
185\end{figure}
186
187
188\newpage
189\section{A Tour of piapp}
190\subsection{Interacting with piapp, getting help}
191Users interact with piapp through commands entered in the piapp-console
192(or the unix terminal), and through the different menus.
193Some of the possibilities of the piapp-console are described
194in {\bf PIConsole} help item, in the command reference section \myppageref{PIConsole}.
195The description
196of the commands in available online using the help command.
197An online help window can be displayed by \menubar{File / Help}.
198Commands and help items are grouped in categories which can be
199selected using the OptionMenu in the Help window.
200\begin{verbatim}
201Cmd> help func
202Displays a function y=f(x) (Fills a vector with function values)
203 Usage: func f(x) xmin xmax [npt graphic_attributes]
204 Related commands: funcff func2d func2dff
205Cmd> func sin(x)/x 0.1 10 100 'red line=solid,2'
206---> Graphic display of the function
207\end{verbatim}
208The directory {\tt DemoPIApp} contains a number of example
209command script and sample data files.
210
211\subsection{the Object Manager (NamedObjMgr)}
212The {\bf piapp} application is built around an object manager
213(class {\tt NamedObjMgr}) and a graphic application
214(class {\tt PIStdImgApp}). Objects inheriting from
215the class {\tt AnyDataObj} can be managed through adapter
216classes (classes inheriting from {\tt NObjMgrAdapter}) by
217the object manager.
218\par
219User sees the objects (such as Sophya objects Histo, NTuple,
220Arrays, Images, SkyMaps, \ldots) kept in memory, organized
221in a single level tree structure. Four memory directories
222are automatically created and can not be removed: \\
223\centerline{\bf /home \hspace{10mm} /old \hspace{10mm} /tmp \hspace{10mm} /autoc}
224The default working directory (in memory) is {\bf /home}.
225Other directories can be created by the user.
226\begin{center}
227{\bf Warning:} These are only the directory
228structure managed by the piapp application and do not
229correspond to the file system directories
230\end{center}
231The window {\bf ObjMgr} shown in figure \ref{figobjmgrw}
232can be used to navigate in the memory directories and
233execute simple operations on objects. \\
234This window can be displayed using the menu command
235\menubar{Objects / ObjectManager}.
236The button \framebox{\small \bf SetCurObj} can be used to set the value
237of the interpreter's variable {\tt cobj} to the selected
238object name.
239Refer to the commands in group {\bf Object Management}
240for more information.
241
242\vspace*{5mm}
243\begin{figure}[ht!]
244\begin{center}
245\includegraphics[width=10cm]{piapp_objmgr.eps}
246\caption{The interactive object management window}
247\label{figobjmgrw}
248\end{center}
249\end{figure}
250
251\subsection{command language}
252A basic command interpreter ({\bf PIACmd/Commander}) is included in {\bf piapp} and
253other command interpreters can be inserted in the application
254framework.
255This interpreter ({\bf Commander} \myppageref{Commander})
256synthax is close to the c-shell
257(csh) shell script. It is possible to define and use variables
258({\tt set} command, {\tt \$varname}), and execute loops
259({\tt foreach,for}), as well as simple tests
260({\tt if test then ... else ... endif}).
261Commands from a file (default extension .pic) can be executed
262using the {\tt exec} command.
263Long commands can be put on several lines, by ending a line
264by the backslash \\ caracter, to signal that the command
265continues on the next line.
266
267The command macro below shows a sample piapp session, where
268data from the file {\tt demo.ppf} are displayed.
269\begin{verbatim}
270# Trace mode -> On
271traceon
272# Deleting all objects in the current directory
273delobjs *
274# Opening the PPF file demo.ppf
275openppf demo.ppf
276# Various displays in a graphic window, divided into 2x2 zones
277zone 2 2
278# 1D histogram display
279disp h1d blue
280# 2D histogram display
281disp h2d
282# Function display
283func sin(x)/x 0.1 10. 200 gold
284# Surface representation of a matrix
285surf mtx1 colbr32
286# Contour representation of a matrix
287contour mtx1 'colrj32 normalline ncont=7'
288# 3D representation of points using a PAW like command
289n/plot nt31.z%y%x ! ! win
290# 3D points superimposed on the previous display
291nt3d nt32 x y z ex ey ez - - 'same fcirclemarker7 red'
292\end{verbatim}
293
294\subsection{NTuple vue / PAW like commands}
295It is possible to plot various expressions of objects, seen as
296a 2D table, with named columns. This possibility exist not only
297for NTuples, but also for most objects (from SOPHYA) handled
298by piapp. See command groups {\bf Expr.Plotting} and
299{\bf pawCmd}
300
301\subsection{C++ execution inside piapp}
302For more complex processings, where the full power of C++
303and the class libraries are necessary, {\bf piapp} provide
304the possibility of executing C++ code, without the burden
305of having to write a complete program. The objects
306present in the current directory are automatically
307declared. The communication with the piapp application
308is done by the {\bf NamedObjMgr} class.
309Two macros {\tt KeepObj()} and {\tt DisplayObj()}
310simplify the task of keeping newly created objects.
311In the example below, we first create a noisy signal
312in a vector, and we keep it in the application
313(Notice the use of multiline command) :
314
315\begin{verbatim}
316Cmd> c++exec c++exec Vector in(1024); \
317...? in = RandomSequence(RandomSequence::Gaussian, 0., 1.); \
318...? for(int kk=0; kk<in.Size(); kk++) \
319...? in(kk) += 2*sin(kk*0.05); \
320...? KeepObj(in);
321\end{verbatim}
322We can of course display the resulting vector:
323\begin{verbatim}
324Cmd> disp in
325\end{verbatim}
326
327And, at a subsequent stage, make a low pass filter
328on the vector in:
329\begin{verbatim}
330Cmd> c++exec Vector out(1024); \
331...? int w = 2; \
332...? for(int k=w; k<in.Size()-w; k++) \
333...? out(k) = in(Range(k-w, k+w)).Sum()/(2.*w+1.); \
334...? KeepObj(out);
335\end{verbatim}
336
337We can display the new vector {\tt out} overlayed
338on the previously displayed vector:
339\begin{verbatim}
340Cmd> disp out 'red same'
341\end{verbatim}
342
343See command group {\bf CxxExecutorCmd} for more information,
344and the option window activated by the menu:
345{\bf Special/CxxExecOption}.
346
347\subsection{Extending the application}
348The {\bf piapp} application can easily be extended by the user.
349This is done through shared libraries which can be opened
350and used by the application.
351Two main methods can be used (see command group
352{\bf ExternalModules}) :
353\begin{itemize}
354\item Creation of user functions. A shared library containing
355at least one user function with the following prototype
356should be created:
357\begin{verbatim}
358extern "C" {
359 void myfonction(vector<string>& args);
360}
361\end{verbatim}
362The class {\bf NameObjMgr} should be used to communicate with the
363application. The {\tt link} \myppageref{link} and {\tt call} \myppageref{call}
364should be used to load and execute user functions. An example of
365user function can be found in DemoPIApp/user.cc exlink.pic.
366
367\item Creation of loadable modules: Loadable modules can be
368used to extend the application possibilities in a way totally
369transparent to the user. It is possible to define new commands,
370handling of new object types, additional graphic functionalities
371in a loadable module.
372
373The class {\bf CmdExecutor} is the base class for extending piapp.
374A shared library should be built, containing two functions,for
375the activation and deactivation of the module, with the following
376prototype (where {\tt mymodule} is the module's name.
377\begin{verbatim}
378extern "C" {
379 void mymodule_init();
380 void mymodule_end();
381}
382\end{verbatim}
383
384\end{itemize}
385
386%%%%%%%%%% Section 3: Graphiques
387\newpage
388\section{Interactive graphics}
389Display of objects in piapp are managed by {\bf PIDrawers} and three
390main viewers:
391
392\begin{itemize}
393\item[\bul] PIScDrawWdg: Handler of 2-D drawers with interactive zoom
394(see {\bf PIScDrawWdg} \myppageref{PIScDrawWdg} for more information.
395\item[\bul] PIImage: Manages display of a 2-D array (P2DArrayAdapter) as an image
396and controls a zoom widget, as well as a global image view widget, and
397a color map view widget. (see {\bf PIImage} \myppageref{PIImage} for
398 more information.
399\item[\bul] PIDraw3DWdg: handler of 3-D drawers with interacive rotation
400and zoom. (see {\bf PIDraw3DWdg} \myppageref{PIDraw3DWdg} for more information.
401\end{itemize}
402
403\par
404Refer to the command reference section on windows ({\bf Windows}
405\myppageref{Windows})
406for information on the different type of windows used by piapp
407and their properties.
408
409\par
410In addition, a number of control windows can be used to examine and
411change view properties of differents viewers and drawers.
412\begin{itemize}
413\item[] PIDrawerTools (see page \myppageref{secdrwtools})
414\item[] PIAxesTools (see page \myppageref{secaxestools})
415\item[] PIImageTools (see page \myppageref{secimagetools})
416\item[] PIHisto2DTools (see page \myppageref{sech2dtools})
417\item[] PIContourTools (see page \myppageref{secconttools})
418\end{itemize}
419
420%%%%%%%%%%%%%%% Section 4 : I/O
421\newpage
422\section{Data formats and I/O}
423\begin{itemize}
424\item[\bul] ASCII files (see {\tt ntfrascii} \myppageref{ntfrascii} and
425{\tt newnt} \myppageref{newnt} command)
426\item[\bul] FITS format files, through \menubar{File/Open-Fits}.
427(see also (see {\tt openfits} \myppageref{openfits}) command.
428\item[\bul] PPF (Portable Persistence file Format) files through
429menu \menubar{File/Open-PPF}. PPF files are the native persistence
430format in Sophya (or PEIDA++).
431\end{itemize}
432
433%%%%%%%%%%%%%%% Section 5 : analyse a la paw
434\newpage
435\section{Tables and interactive analysis}
436
437%%%%%%%%%%%%%%% Section 6 : command interpreter
438\newpage
439\section{Command interpreter}
440piapp uses the class {\bf PIACmd} which extends slightly the
441SOPHYA class {\bf Commander} as the command interpreter.
442{\bf Commander} is a c-shell inspired, string oriented command
443interpreter. Although it has many limitations compared to
444c-shell, or Tcl , it provides some interesting possibilities:
445\begin{itemize}
446\item Extended arithmetic operations (c-like and RPN)
447\item Simple and vector variables
448\item Script definition
449\item Command execution in separate threads
450\item Dynamic Load
451\end{itemize}
452
453We describe below the {\bf Commander} possibilities,
454as well as the few {\bf PIACmd} extensions.
455
456\subsection{Variables}
457The SOPHYA::Commander interpreter manages non typed set of variables.
458Environment variables are also accessible through
459the usual {\tt \$varenvname}, unless shadowed by a Commander
460variable. All Commander variables are vector of strings, and are
461extended as necessary. {\tt \$varname} is the string formed by all
462the vector elements. Except when performing arithmetic operations,
463variables are treated as strings.
464\par
465An application level set of variables is also managed
466by Commander, through redefinition of \\
467{\tt Commander::GetVarApp() / GetVarApp() \ldots } methods.
468The {\bf PIACmd} in piapp redefines the {\tt GetVarApp() }
469in order to provide an easy access to some of objects attributes or methods,
470managed by {\bf NamedObjMgr}.
471
472\begin{itemize}
473\item[\rond] {\bf Definition and initialisation of variables }
474\begin{verbatim}
475# Notice that the set command has no = sign
476Cmd> set sv StringValue
477# Clearing/removing of a variable : unset or clearvar
478Cmd> unset sv
479
480# Definition of a multi element variable (vector type)
481# Notice that spaces before / after '(' and ')' are mandatory
482Cmd> set vecv ( mot1 mot2 mot3 mot4 mot5 )
483# Arithmetic expression : C language syntax - spaces before/after '=' are mandatory Cmd> a = 2+3*sqrt(4)
484# The '=' operator can also be used to initialize a variable with a string
485Cmd> a = 'Bonjour Madame'
486# A vector element can be specified in the left hand side
487Cmd> vecv[2] = 'coucou'
488# Or using an interpreter variable as index :
489Cmd> i = 3
490Cmd> vecv[i] = 'Ooohhh'
491\end{verbatim}
492
493On the right hand side, the value of a variable should be accessed using
494the \$ character. \\
495A string can be parsed into words using {\tt var2words}
496\begin{verbatim}
497Cmd> var2words varname wordvarname [separateur]
498\end{verbatim}
499
500\item[\rond] {\bf Accessing variable contents } \\
501The \$ character is used to access the content of a variable {\tt \$varname} .
502Substitution rules :
503The {\tt \$xxx} is replaced by the value of variable xxx.
504No substitution is performed for strings enclosed in simple quotes {\tt ' ... \$xxx '},
505but substitution is done in strings enclosed in double quotes.
506Parenthesis or brackets can be used to specify the variable name, inside a string
507without white space: {\tt \${vname} } ou {\tt \$(vname)}.
508\begin{verbatim}
509Cmd> x = 'Hello'
510Cmd> echo $x
511# Size of a vector variable : $#vname
512Cmd> set vx ( 111 2222 3333 444444 )
513Cmd> echo $#vx
514# Accessing vector elements
515Cmd> echo $vx[0] $vx[1]
516# or using an interpreter variable as index :
517Cmd> i = 2
518Cmd> echo $vx[i]
519# Special syntax: $[vname] is replaced by the content
520# of a variable whose name is $vname
521Cmd> zzz = 'Commander'
522Cmd> xxx = 'zzz'
523Cmd> echo '---> $[xxx]= ' $[xxx]
524---> $[xxx]= Commander
525\end{verbatim}
526
527\par
528When brackets are used, the priority level between interpreter variables
529and application level variable is changed. If vname exist at the application level,
530{\tt \${vname} } is replaced by its value, even if an interpreter variable with the
531same name has been defined. For some classes managed by NamedObjMgr,
532PIACmd provide acces to some of the attributes of the object by
533{\tt \${objname.attname} }. This mechanism has been implemented in particular for
534TArrays, TMatrix/TVector, Histograms, NTuples and DataTables.
535\par
536Environment variables can simply be accessed by {\tt \$varenvname}.
537However, env. variables have the lowest priority.
538Interpreter's variables have the highest priority in the substitution, followed
539by the application level variables.
540
541\item[\rond] {\bf Special variables }
542\begin{itemize}
543\item {\tt \$retval} ou {\tt \$retstr} : the string specified in the last {\bf return} statement
544\item {\tt \$status} : Return code from the last executed command.
545Arguments of scripts (see below) or file executed through {\bf exec} command.
546\item {\tt \$\# } : number of arguments, except \$0
547\item {\tt \$0} : Script or file name
548\item {\tt \$1 \$2 \$3} .... : Arguments (for scripts and .pic files (exec))
549\end{itemize}
550\end{itemize}
551
552\subsection{Control structures}
553
554\begin{itemize}
555\item[\rond] Enumerated loop:
556\begin{verbatim}
557foreach f ( w1 w2 w3 ... )
558 ...
559 echo $f
560end
561\end{verbatim}
562
563Note that spaces before/after '(' et and ')' are mandatory.
564An alternative form uses a vector variable name :
565\begin{verbatim}
566foreach v vecname
567 ...
568 echo $v
569end
570\end{verbatim}
571
572\item[\rond] Integer type loop:
573\begin{verbatim}
574for i startInt:endInt[:stepInt]
575 ....
576 echo $i
577end
578\end{verbatim}
579
580\item[\rond] Integer type loop:
581\begin{verbatim}
582for f startFloat:endFloat[:stepFloat]
583 ....
584 echo $f
585end
586\end{verbatim}
587
588\item[\rond] Loop over lines of a file
589\begin{verbatim}
590forinfile line FileName
591 ...
592 echo $line
593end
594\end{verbatim}
595
596\item[\rond] The {\tt break} instruction can be used to exit from a loop
597
598\item[\rond] {\bf if then else} Conditional execution:
599\begin{verbatim}
600if ( test ) then
601endif
602
603if ( test ) then
604 ....
605else
606 ....
607endif
608\end{verbatim}
609Note that spaces before/after '(' et and ')' are mandatory.
610
611test is in the form {\tt a == b} OR {\tt a != b} OR {\tt a < b} OR {\tt a > b}
612OR {\tt a <= b} OR {\tt a >= b}. Comparison operators should be delimited
613by spaces.
614{\tt ==} et {\tt !=} make a string comparison, while
615{\tt < , > , <= , >=} compare the values obtained after string to double conversion.
616\end{itemize}
617
618\subsection{Script definition}
619A script is a sequence of commands. It is very similar to the execution of commands
620from a file ({\bf exec filename}). Once a script has been defined, it can be called specifying
621specifying the script name followed by its arguments.
622\begin{verbatim}
623# Script definition :
624defscript scriptname [description ]
625 ....
626endscript
627
628# Executing the script
629Cmd> scriptname arg1 arg2 arg3 ....
630\end{verbatim}
631
632The {\tt return} instruction stops the execution and returns from a script, or from a command
633file called through {\bf exec}. \\
634The commands {\bf listscript } and {\bf clearscript scriptname} can be used
635to obtain the list of already defined script, or to clear a script definition.
636
637\subsection{Other built-in commands}
638\begin{itemize}
639\item[\rond] Instruction {\bf echo } to write the line to cout/stdout
640\item[\rond] Instruction {\bf echo2file} to write (append) the line to file ({\tt echo2file filename ....})
641\item[\rond] Instruction {\bf sleep nsec} wait for {\tt nsec} seconds
642\item[\rond] Instructions {\bf timingon , timingoff , traceon , traceoff } \\
643%
644\item[\rond] {\bf exec filename [arg1 arg2 ... ] } to execute command from
645the file named {\tt filename}. {\tt .pic} is the default extension for the interpreter
646command files.
647\item[\rond] {\bf help} and {help keyword/commandname }
648\item[\rond] {\bf listvars , listcommands } to print the list of defined variables and known
649commands
650\item[\rond] An alias for a command by {\bf alias aliasname 'string ' }. Alias substitution
651occurs for the first word in a command line. {\bf listalias} prints the list of all
652defined aliases.
653\item[\rond] Execution control (piapp/PIACmd extension):
654It is possible to stop the interpreter execution in a loop, a script or
655a command file by the {\bf stop} command, or using
656 {\tt <Cntrl C>} in the piapp console (PIConsole) \\
657\end{itemize}
658
659\subsection {Command execution in separate threads}
660It is possible to create new threads to execute commands
661( for non built-in interpreter commands). The syntax is similar
662to unix shell background tasks: an {\&} should be added at the end
663of the command line. A new thread is then created for the
664execution of the command, if declared as thread safe \\
665(see {\tt CmdExecutor::IsThreadable() }.
666\par
667Thread management commands:
668\begin{itemize}
669\item[\rond] {\bf thrlist }Print current list of threads, with the associated command
670the thread identifier (integer ThrId) and its status.
671\item[\rond] {\bf cleanthrlist } Removes all finished threads from the list.
672An automatic cleanup is performed periodically.
673\item[\rond] {\bf cancelthr ThId } / {\bf killthr ThId } Stops/kills the thread with
674the identifier ThId. Avoid using theses commands as the cleanup does
675not release some resources associated with
676the thread (memory, mutex \ldots).
677\end{itemize}
678
679%%%%%%%%%%%%%%% Section 7 : c++ execution
680\newpage
681\section{On the fly C++ execution}
682
683%%%%%%%%%%%%%%% Section 8 : command reference
684\newpage
685\section{piapp command reference}
686\label{piappcmdref}
687This section contains the description of piapp commands. This information
688is available on-line, through the help command, or through a graphic
689window, accessible by \menubar{File / Help}.
690The help items and command are divided into different sections,
691where related commands are grouped. \\[10mm]
692
693% \include{piahelp}
694\input{piahelp.tex}
695
696% La partie des appendix
697\appendix
698\newpage
699\section{Interactive control windows}
700\subsection{DrawerTools} \index{DrawerTools}
701\label{secdrwtools}
702The {\bf PIDrawerTools}, shown in the figure \ref{figdrwtools} can be
703used to change the graphic attributes (color, font, marker, \ldots)
704of the Drawers displayed in 2D displays
705({\bf PIScDrawWdg} \myppageref{PIScDrawWdg}) or 3D displays
706({\bf PIDraw3DWdg} \myppageref{PIDraw3DWdg}), as well in image displays
707{\bf PIImage} (\myppageref{PIImage}). The PIDrawerTools can be activated
708either using {\tt Alt<G>} on a PIScDrawWdg,PIDraw3DWdg,PIImage,
709or through the menu {\bf Tools/Show DrawerTools}.
710A given drawer can be selected through the DrawerId selector.
711
712\vspace*{5mm}
713\begin{figure}[ht!]
714\begin{center}
715\includegraphics[width=7cm]{piapp_drwtools.eps}
716\caption{PIDrawerTools}
717\label{figdrwtools}
718\end{center}
719\end{figure}
720\newpage
721%%%%
722\subsection{AxesTools} \index{AxesTools}
723\label{secaxestools}
724The {\bf PIAxesTools}, shown in the figure \ref{figaxestools} can be used to
725control and change the setting of axes on 2D displays
726({\bf PIScDrawWdg} \myppageref{PIScDrawWdg}).
727The PIAxesTools can be activated
728either using {\tt Alt<A>} on a PIScDrawWdg or through
729the menu {\bf Tools/Show AxesTools}.
730
731\vspace*{5mm}
732\begin{figure}[ht!]
733\begin{center}
734\includegraphics[width=8cm]{piapp_axestools.eps}
735\caption{PIAxesTools}
736\label{figaxestools}
737\end{center}
738\end{figure}
739%%%%%
740\section{ImageTools} \index{ImageTools}
741\label{secimagetools}
742The {\bf PIImageTools}, shown in the figure \ref{figimgtools} can be used to
743manipulate a display of type image. Image display are handled by the
744{\bf PIImage} (\myppageref{PIImage}). The PIImageTools can be activated
745either using {\tt Alt<O>} on a PIImage, or through the menu
746{\bf Tools/Show ImageTools}.
747
748\vspace*{5mm}
749\begin{figure}[ht!]
750\begin{center}
751\includegraphics[width=8cm]{piapp_imgtools.eps}
752\caption{PIImageTools}
753\label{figimgtools}
754\end{center}
755\end{figure}
756
757\subsection{Histo2DTools} \index{Histo2DTools}
758\label{sech2dtools}
759The {\bf PIHisto2DTools}, shown in the figure \ref{figh2dtools} can be
760used to control and change the display caracteristics of 2D histograms.
761PIHisto2DTools can be activated
762either using {\tt Alt<O>} on a PIScDrawWdg, when the active
763drawer is a PIHisto2DDrawer, or through the generic drawer tool
764PIDrawerTools.
765
766\vspace*{5mm}
767\begin{figure}[ht!]
768\begin{center}
769\includegraphics[width=8cm]{piapp_h2dtools.eps}
770\caption{PIHisto2DTools}
771\label{figh2dtools}
772\end{center}
773\end{figure}
774
775\subsection{ContourTools} \index{ContourTools}
776\label{secconttools}
777The {\bf PIContourTools}, shown in the figure \ref{figconttools} can be
778used to control and change the caracteristics of contour displays.
779PIContourTools can be activated
780either using {\tt Alt<O>} on a PIScDrawWdg, when the active
781drawer is a PIContDrawer, or through the generic drawer tool
782PIDrawerTools.
783
784\vspace*{10mm}
785\begin{figure}[ht!]
786\begin{center}
787\includegraphics[width=11cm]{piapp_conttools.eps}
788\caption{PIContourTools}
789\label{figconttools}
790\end{center}
791\end{figure}
792
793
794
795Both drawing options (e.g. color, line type, fonts...) and contour
796determination parameters (e.g. contour number and levels) are controlled
797by {\bf PIContourTools}.
798
799\subsubsection{Drawing options}
800The top choices in {\bf PIContourTools}
801concern the color map (left choice) or color (right choice) of the contours.
802If a color map has been chosen, it is used to give each contour a color
803(according to its level). If no color map has been chosen, contours may be
804given a color using the left choice box.
805
806Contour are by default traced by lines.
807Alternatively (or in addition) the user may ask to trace them by markers
808or to put numeric labels (with the contour's level) aside the contour.
809These options are enabled/disabled by the {\tt LineON}, {\tt MarkerON} and {\tt LabelON}
810buttons from {\bf PIContourTools}.
811
812Options may be recovered ({\tt GetAtt}) or set ({\tt SetAtt})
813from/to a drawer. Setting an option which adds to the screen will be immediately visible
814whereas unsetting it requires a {\tt Refresh} to be visible.
815
816
817\subsubsection{Contour options}
818The contouring routines in {\tt spiapp} are based on a hack of the {\tt GNUPlot}
819routines. Contours are determined from a grid of values
820using an interpolation scheme. Three schemes may be used
821(selected by the left menu) :
822\begin{enumerate}
823\item Linear interpolation (default), selected by the {\tt Int. Lin.} option
824\item A cubic spline algorithm, selected by the {\tt CubicSpl} option
825\item A 2d BSpline algorihm, selected by the {\tt B-Spline} option
826\end{enumerate}
827
828Contour levels and number are automatically
829determined by the program. They may be specified differently,
830 through command-line options
831(see section \ref{piappcmdref} for the help of the contour/ntcont commands)
832or the lower part of the {\bf PIContourTools} window.
833
834The user may specify one of the following alternatives :
835\begin{enumerate}
836\item the number of contour (their level beeing automatically set).
837To do this, select {\tt LevelNum} in the right menu and enter the contour number
838in the left box below.
839\item the levels of the contours, through an array of numerical values
840(e.g. 1,4,6,9,27,4.5 will result in 6 contour lines being drawn, if possible and necessary).
841To do this, select {\tt LevelDisc} and enter the contour number (left box)
842and the values (right box) separated by ``{\tt ,}''.
843\item the levels of the contours through an initial (lower) value and an increment.
844For this, select {\tt LevelInc} and enter the contour number (left box)
845and the initial value and increment in the right box, as above.
846\item come back to the default situation, by choosing {\tt LevelAuto}
847\end{enumerate}
848
849Once these options are set, it is necessary the the program recomputes
850the contour lines. This is commanded by the {\tt SetParm} button.
851
852
853\newpage
854\addcontentsline{toc}{section}{Index}
855\printindex
856
857\end{document}
Note: See TracBrowser for help on using the repository browser.