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{
|
---|
63 | R. Ansari & ansari@lal.in2p3.fr \\
|
---|
64 | E. Aubourg & aubourg@hep.saclay.cea.fr \\
|
---|
65 | C. Magneville & cmv@hep.saclay.cea.fr \\
|
---|
66 | O. 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
|
---|
87 | and visualization program. It is based on the {\bf PI} GUI library
|
---|
88 | and 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.})
|
---|
91 | C++ data analysis class library.
|
---|
92 | \par
|
---|
93 | {\bf piapp} is a powerful command oriented tool for visualising and analysing data.
|
---|
94 | Its 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
|
---|
99 | exported 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
|
---|
103 | managed by the application through the on-the-fly compilation and execution
|
---|
104 | of c++ code fragments in piapp.
|
---|
105 | \item[\rond] piapp is a multi-threaded program with separate threads for graphics
|
---|
106 | and command execution, ensuring interactive response, even while heavy
|
---|
107 | computation is being performed. In addition, thread safe commands can be executed
|
---|
108 | in 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
|
---|
110 | loaded 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
|
---|
116 | once the SOPHYA/piapp environment has been initialised.
|
---|
117 | The environment variables {\tt SOPHYABASE} should contain the directory
|
---|
118 | where SOPHYA/piapp has been installed. the shared library path
|
---|
119 | {\tt LD\_LIBRARY\_PATH} must contain {\tt \$SOPHYABASE /slb} and the
|
---|
120 | current directory {\tt .} and the executable search path {\tt PATH} must
|
---|
121 | contain {\tt \$SOPHYABASE /exe}. Refer to the SOPHYA overview manual
|
---|
122 | for more information on SOPHYA directory structure. \\
|
---|
123 | It might also be necessary to define the environment variable
|
---|
124 | {\bf PIXKBMOMASK}, used by the libPI.a to map correctly
|
---|
125 | the {\tt <Alt>} key with some X servers (in particular with
|
---|
126 | X11 on MacOS X). \\
|
---|
127 | {\tt csh> setenv PIXKBMODMASK 2 }
|
---|
128 | \par
|
---|
129 | {\tt (s)piapp -h} provides a brief help of the command line
|
---|
130 | arguments. Xtoolkit options can also be specified as command line
|
---|
131 | arguments. {\bf spiapp} is the name of SOPHYA/piapp executable,
|
---|
132 | in order to distinguish it from PEIDA/piapp.
|
---|
133 | \begin{verbatim}
|
---|
134 | csh> spiapp -h
|
---|
135 | SophyaInitiator::SophyaInitiator() BaseTools Init
|
---|
136 | PIOPersist::Initialize() Starting Sophya Persistence management service
|
---|
137 | SOPHYA 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}
|
---|
154 | Once {\bf piapp} is started, the main piapp window appears.
|
---|
155 | It contains the menu bar, an upper part with the zoom and colormap
|
---|
156 | widgets for image displays, memory and CPU usage and a terminal like
|
---|
157 | widget (piapp console, see {\bf PIConsole} \myppageref{PIConsole})
|
---|
158 | in the lower part. The figure \ref{figmainwin}
|
---|
159 | shows an image of the piapp main window.
|
---|
160 | {\tt stdout/cout, stderr/cerr} are redirected to the piapp console and
|
---|
161 | commands can be entered in this widget. It is also possible to keep
|
---|
162 | the terminal where piapp was started for {\tt stdout/stderr} (flag {\tt -nored}).
|
---|
163 | It 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
|
---|
167 | producing long outputs, the application may block because of incorrect management
|
---|
168 | of pipes. If this happens, use piapp with {\tt -nored} flag.
|
---|
169 |
|
---|
170 | \par
|
---|
171 | In section 2, we present a quick tour of {\bf piapp}.
|
---|
172 | a brief overview of piapp graphics, supported data formats, interactive
|
---|
173 | analysis possibilities, the command interpreter and c++ execution
|
---|
174 | are presented in the following sections.
|
---|
175 | Section \ref{piappcmdref} contains a brief description of all piapp commands
|
---|
176 | and 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}
|
---|
191 | Users interact with piapp through commands entered in the piapp-console
|
---|
192 | (or the unix terminal), and through the different menus.
|
---|
193 | Some of the possibilities of the piapp-console are described
|
---|
194 | in {\bf PIConsole} help item, in the command reference section \myppageref{PIConsole}.
|
---|
195 | The description
|
---|
196 | of the commands in available online using the help command.
|
---|
197 | An online help window can be displayed by \menubar{File / Help}.
|
---|
198 | Commands and help items are grouped in categories which can be
|
---|
199 | selected using the OptionMenu in the Help window.
|
---|
200 | \begin{verbatim}
|
---|
201 | Cmd> help func
|
---|
202 | Displays 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
|
---|
205 | Cmd> func sin(x)/x 0.1 10 100 'red line=solid,2'
|
---|
206 | ---> Graphic display of the function
|
---|
207 | \end{verbatim}
|
---|
208 | The directory {\tt DemoPIApp} contains a number of example
|
---|
209 | command script and sample data files.
|
---|
210 |
|
---|
211 | \subsection{the Object Manager (NamedObjMgr)}
|
---|
212 | The {\bf piapp} application is built around an object manager
|
---|
213 | (class {\tt NamedObjMgr}) and a graphic application
|
---|
214 | (class {\tt PIStdImgApp}). Objects inheriting from
|
---|
215 | the class {\tt AnyDataObj} can be managed through adapter
|
---|
216 | classes (classes inheriting from {\tt NObjMgrAdapter}) by
|
---|
217 | the object manager.
|
---|
218 | \par
|
---|
219 | User sees the objects (such as Sophya objects Histo, NTuple,
|
---|
220 | Arrays, Images, SkyMaps, \ldots) kept in memory, organized
|
---|
221 | in a single level tree structure. Four memory directories
|
---|
222 | are automatically created and can not be removed: \\
|
---|
223 | \centerline{\bf /home \hspace{10mm} /old \hspace{10mm} /tmp \hspace{10mm} /autoc}
|
---|
224 | The default working directory (in memory) is {\bf /home}.
|
---|
225 | Other directories can be created by the user.
|
---|
226 | \begin{center}
|
---|
227 | {\bf Warning:} These are only the directory
|
---|
228 | structure managed by the piapp application and do not
|
---|
229 | correspond to the file system directories
|
---|
230 | \end{center}
|
---|
231 | The window {\bf ObjMgr} shown in figure \ref{figobjmgrw}
|
---|
232 | can be used to navigate in the memory directories and
|
---|
233 | execute simple operations on objects. \\
|
---|
234 | This window can be displayed using the menu command
|
---|
235 | \menubar{Objects / ObjectManager}.
|
---|
236 | The button \framebox{\small \bf SetCurObj} can be used to set the value
|
---|
237 | of the interpreter's variable {\tt cobj} to the selected
|
---|
238 | object name.
|
---|
239 | Refer to the commands in group {\bf Object Management}
|
---|
240 | for 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}
|
---|
252 | A basic command interpreter ({\bf PIACmd/Commander}) is included in {\bf piapp} and
|
---|
253 | other command interpreters can be inserted in the application
|
---|
254 | framework.
|
---|
255 | This interpreter ({\bf Commander} \myppageref{Commander})
|
---|
256 | synthax 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}).
|
---|
261 | Commands from a file (default extension .pic) can be executed
|
---|
262 | using the {\tt exec} command.
|
---|
263 | Long commands can be put on several lines, by ending a line
|
---|
264 | by the backslash \\ caracter, to signal that the command
|
---|
265 | continues on the next line.
|
---|
266 |
|
---|
267 | The command macro below shows a sample piapp session, where
|
---|
268 | data from the file {\tt demo.ppf} are displayed.
|
---|
269 | \begin{verbatim}
|
---|
270 | # Trace mode -> On
|
---|
271 | traceon
|
---|
272 | # Deleting all objects in the current directory
|
---|
273 | delobjs *
|
---|
274 | # Opening the PPF file demo.ppf
|
---|
275 | openppf demo.ppf
|
---|
276 | # Various displays in a graphic window, divided into 2x2 zones
|
---|
277 | zone 2 2
|
---|
278 | # 1D histogram display
|
---|
279 | disp h1d blue
|
---|
280 | # 2D histogram display
|
---|
281 | disp h2d
|
---|
282 | # Function display
|
---|
283 | func sin(x)/x 0.1 10. 200 gold
|
---|
284 | # Surface representation of a matrix
|
---|
285 | surf mtx1 colbr32
|
---|
286 | # Contour representation of a matrix
|
---|
287 | contour mtx1 'colrj32 normalline ncont=7'
|
---|
288 | # 3D representation of points using a PAW like command
|
---|
289 | n/plot nt31.z%y%x ! ! win
|
---|
290 | # 3D points superimposed on the previous display
|
---|
291 | nt3d nt32 x y z ex ey ez - - 'same fcirclemarker7 red'
|
---|
292 | \end{verbatim}
|
---|
293 |
|
---|
294 | \subsection{NTuple vue / PAW like commands}
|
---|
295 | It is possible to plot various expressions of objects, seen as
|
---|
296 | a 2D table, with named columns. This possibility exist not only
|
---|
297 | for NTuples, but also for most objects (from SOPHYA) handled
|
---|
298 | by piapp. See command groups {\bf Expr.Plotting} and
|
---|
299 | {\bf pawCmd}
|
---|
300 |
|
---|
301 | \subsection{C++ execution inside piapp}
|
---|
302 | For more complex processings, where the full power of C++
|
---|
303 | and the class libraries are necessary, {\bf piapp} provide
|
---|
304 | the possibility of executing C++ code, without the burden
|
---|
305 | of having to write a complete program. The objects
|
---|
306 | present in the current directory are automatically
|
---|
307 | declared. The communication with the piapp application
|
---|
308 | is done by the {\bf NamedObjMgr} class.
|
---|
309 | Two macros {\tt KeepObj()} and {\tt DisplayObj()}
|
---|
310 | simplify the task of keeping newly created objects.
|
---|
311 | In the example below, we first create a noisy signal
|
---|
312 | in a vector, and we keep it in the application
|
---|
313 | (Notice the use of multiline command) :
|
---|
314 |
|
---|
315 | \begin{verbatim}
|
---|
316 | Cmd> 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}
|
---|
322 | We can of course display the resulting vector:
|
---|
323 | \begin{verbatim}
|
---|
324 | Cmd> disp in
|
---|
325 | \end{verbatim}
|
---|
326 |
|
---|
327 | And, at a subsequent stage, make a low pass filter
|
---|
328 | on the vector in:
|
---|
329 | \begin{verbatim}
|
---|
330 | Cmd> 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 |
|
---|
337 | We can display the new vector {\tt out} overlayed
|
---|
338 | on the previously displayed vector:
|
---|
339 | \begin{verbatim}
|
---|
340 | Cmd> disp out 'red same'
|
---|
341 | \end{verbatim}
|
---|
342 |
|
---|
343 | See command group {\bf CxxExecutorCmd} for more information,
|
---|
344 | and the option window activated by the menu:
|
---|
345 | {\bf Special/CxxExecOption}.
|
---|
346 |
|
---|
347 | \subsection{Extending the application}
|
---|
348 | The {\bf piapp} application can easily be extended by the user.
|
---|
349 | This is done through shared libraries which can be opened
|
---|
350 | and used by the application.
|
---|
351 | Two main methods can be used (see command group
|
---|
352 | {\bf ExternalModules}) :
|
---|
353 | \begin{itemize}
|
---|
354 | \item Creation of user functions. A shared library containing
|
---|
355 | at least one user function with the following prototype
|
---|
356 | should be created:
|
---|
357 | \begin{verbatim}
|
---|
358 | extern "C" {
|
---|
359 | void myfonction(vector<string>& args);
|
---|
360 | }
|
---|
361 | \end{verbatim}
|
---|
362 | The class {\bf NameObjMgr} should be used to communicate with the
|
---|
363 | application. The {\tt link} \myppageref{link} and {\tt call} \myppageref{call}
|
---|
364 | should be used to load and execute user functions. An example of
|
---|
365 | user function can be found in DemoPIApp/user.cc exlink.pic.
|
---|
366 |
|
---|
367 | \item Creation of loadable modules: Loadable modules can be
|
---|
368 | used to extend the application possibilities in a way totally
|
---|
369 | transparent to the user. It is possible to define new commands,
|
---|
370 | handling of new object types, additional graphic functionalities
|
---|
371 | in a loadable module.
|
---|
372 |
|
---|
373 | The class {\bf CmdExecutor} is the base class for extending piapp.
|
---|
374 | A shared library should be built, containing two functions,for
|
---|
375 | the activation and deactivation of the module, with the following
|
---|
376 | prototype (where {\tt mymodule} is the module's name.
|
---|
377 | \begin{verbatim}
|
---|
378 | extern "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}
|
---|
389 | Display of objects in piapp are managed by {\bf PIDrawers} and three
|
---|
390 | main 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
|
---|
396 | and controls a zoom widget, as well as a global image view widget, and
|
---|
397 | a 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
|
---|
400 | and zoom. (see {\bf PIDraw3DWdg} \myppageref{PIDraw3DWdg} for more information.
|
---|
401 | \end{itemize}
|
---|
402 |
|
---|
403 | \par
|
---|
404 | Refer to the command reference section on windows ({\bf Windows}
|
---|
405 | \myppageref{Windows})
|
---|
406 | for information on the different type of windows used by piapp
|
---|
407 | and their properties.
|
---|
408 |
|
---|
409 | \par
|
---|
410 | In addition, a number of control windows can be used to examine and
|
---|
411 | change 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
|
---|
429 | menu \menubar{File/Open-PPF}. PPF files are the native persistence
|
---|
430 | format 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}
|
---|
440 | piapp uses the class {\bf PIACmd} which extends slightly the
|
---|
441 | SOPHYA class {\bf Commander} as the command interpreter.
|
---|
442 | {\bf Commander} is a c-shell inspired, string oriented command
|
---|
443 | interpreter. Although it has many limitations compared to
|
---|
444 | c-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 |
|
---|
453 | We describe below the {\bf Commander} possibilities,
|
---|
454 | as well as the few {\bf PIACmd} extensions.
|
---|
455 |
|
---|
456 | \subsection{Variables}
|
---|
457 | The SOPHYA::Commander interpreter manages non typed set of variables.
|
---|
458 | Environment variables are also accessible through
|
---|
459 | the usual {\tt \$varenvname}, unless shadowed by a Commander
|
---|
460 | variable. All Commander variables are vector of strings, and are
|
---|
461 | extended as necessary. {\tt \$varname} is the string formed by all
|
---|
462 | the vector elements. Except when performing arithmetic operations,
|
---|
463 | variables are treated as strings.
|
---|
464 | \par
|
---|
465 | An application level set of variables is also managed
|
---|
466 | by Commander, through redefinition of \\
|
---|
467 | {\tt Commander::GetVarApp() / GetVarApp() \ldots } methods.
|
---|
468 | The {\bf PIACmd} in piapp redefines the {\tt GetVarApp() }
|
---|
469 | in order to provide an easy access to some of objects attributes or methods,
|
---|
470 | managed 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
|
---|
476 | Cmd> set sv StringValue
|
---|
477 | # Clearing/removing of a variable : unset or clearvar
|
---|
478 | Cmd> unset sv
|
---|
479 |
|
---|
480 | # Definition of a multi element variable (vector type)
|
---|
481 | # Notice that spaces before / after '(' and ')' are mandatory
|
---|
482 | Cmd> 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
|
---|
485 | Cmd> a = 'Bonjour Madame'
|
---|
486 | # A vector element can be specified in the left hand side
|
---|
487 | Cmd> vecv[2] = 'coucou'
|
---|
488 | # Or using an interpreter variable as index :
|
---|
489 | Cmd> i = 3
|
---|
490 | Cmd> vecv[i] = 'Ooohhh'
|
---|
491 | \end{verbatim}
|
---|
492 |
|
---|
493 | On the right hand side, the value of a variable should be accessed using
|
---|
494 | the \$ character. \\
|
---|
495 | A string can be parsed into words using {\tt var2words}
|
---|
496 | \begin{verbatim}
|
---|
497 | Cmd> var2words varname wordvarname [separateur]
|
---|
498 | \end{verbatim}
|
---|
499 |
|
---|
500 | \item[\rond] {\bf Accessing variable contents } \\
|
---|
501 | The \$ character is used to access the content of a variable {\tt \$varname} .
|
---|
502 | Substitution rules :
|
---|
503 | The {\tt \$xxx} is replaced by the value of variable xxx.
|
---|
504 | No substitution is performed for strings enclosed in simple quotes {\tt ' ... \$xxx '},
|
---|
505 | but substitution is done in strings enclosed in double quotes.
|
---|
506 | Parenthesis or brackets can be used to specify the variable name, inside a string
|
---|
507 | without white space: {\tt \${vname} } ou {\tt \$(vname)}.
|
---|
508 | \begin{verbatim}
|
---|
509 | Cmd> x = 'Hello'
|
---|
510 | Cmd> echo $x
|
---|
511 | # Size of a vector variable : $#vname
|
---|
512 | Cmd> set vx ( 111 2222 3333 444444 )
|
---|
513 | Cmd> echo $#vx
|
---|
514 | # Accessing vector elements
|
---|
515 | Cmd> echo $vx[0] $vx[1]
|
---|
516 | # or using an interpreter variable as index :
|
---|
517 | Cmd> i = 2
|
---|
518 | Cmd> echo $vx[i]
|
---|
519 | # Special syntax: $[vname] is replaced by the content
|
---|
520 | # of a variable whose name is $vname
|
---|
521 | Cmd> zzz = 'Commander'
|
---|
522 | Cmd> xxx = 'zzz'
|
---|
523 | Cmd> echo '---> $[xxx]= ' $[xxx]
|
---|
524 | ---> $[xxx]= Commander
|
---|
525 | \end{verbatim}
|
---|
526 |
|
---|
527 | \par
|
---|
528 | When brackets are used, the priority level between interpreter variables
|
---|
529 | and 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
|
---|
531 | same name has been defined. For some classes managed by NamedObjMgr,
|
---|
532 | PIACmd provide acces to some of the attributes of the object by
|
---|
533 | {\tt \${objname.attname} }. This mechanism has been implemented in particular for
|
---|
534 | TArrays, TMatrix/TVector, Histograms, NTuples and DataTables.
|
---|
535 | \par
|
---|
536 | Environment variables can simply be accessed by {\tt \$varenvname}.
|
---|
537 | However, env. variables have the lowest priority.
|
---|
538 | Interpreter's variables have the highest priority in the substitution, followed
|
---|
539 | by 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.
|
---|
545 | Arguments 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}
|
---|
557 | foreach f ( w1 w2 w3 ... )
|
---|
558 | ...
|
---|
559 | echo $f
|
---|
560 | end
|
---|
561 | \end{verbatim}
|
---|
562 |
|
---|
563 | Note that spaces before/after '(' et and ')' are mandatory.
|
---|
564 | An alternative form uses a vector variable name :
|
---|
565 | \begin{verbatim}
|
---|
566 | foreach v vecname
|
---|
567 | ...
|
---|
568 | echo $v
|
---|
569 | end
|
---|
570 | \end{verbatim}
|
---|
571 |
|
---|
572 | \item[\rond] Integer type loop:
|
---|
573 | \begin{verbatim}
|
---|
574 | for i startInt:endInt[:stepInt]
|
---|
575 | ....
|
---|
576 | echo $i
|
---|
577 | end
|
---|
578 | \end{verbatim}
|
---|
579 |
|
---|
580 | \item[\rond] Integer type loop:
|
---|
581 | \begin{verbatim}
|
---|
582 | for f startFloat:endFloat[:stepFloat]
|
---|
583 | ....
|
---|
584 | echo $f
|
---|
585 | end
|
---|
586 | \end{verbatim}
|
---|
587 |
|
---|
588 | \item[\rond] Loop over lines of a file
|
---|
589 | \begin{verbatim}
|
---|
590 | forinfile line FileName
|
---|
591 | ...
|
---|
592 | echo $line
|
---|
593 | end
|
---|
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}
|
---|
600 | if ( test ) then
|
---|
601 | endif
|
---|
602 |
|
---|
603 | if ( test ) then
|
---|
604 | ....
|
---|
605 | else
|
---|
606 | ....
|
---|
607 | endif
|
---|
608 | \end{verbatim}
|
---|
609 | Note that spaces before/after '(' et and ')' are mandatory.
|
---|
610 |
|
---|
611 | test is in the form {\tt a == b} OR {\tt a != b} OR {\tt a < b} OR {\tt a > b}
|
---|
612 | OR {\tt a <= b} OR {\tt a >= b}. Comparison operators should be delimited
|
---|
613 | by 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}
|
---|
619 | A script is a sequence of commands. It is very similar to the execution of commands
|
---|
620 | from a file ({\bf exec filename}). Once a script has been defined, it can be called specifying
|
---|
621 | specifying the script name followed by its arguments.
|
---|
622 | \begin{verbatim}
|
---|
623 | # Script definition :
|
---|
624 | defscript scriptname [description ]
|
---|
625 | ....
|
---|
626 | endscript
|
---|
627 |
|
---|
628 | # Executing the script
|
---|
629 | Cmd> scriptname arg1 arg2 arg3 ....
|
---|
630 | \end{verbatim}
|
---|
631 |
|
---|
632 | The {\tt return} instruction stops the execution and returns from a script, or from a command
|
---|
633 | file called through {\bf exec}. \\
|
---|
634 | The commands {\bf listscript } and {\bf clearscript scriptname} can be used
|
---|
635 | to 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
|
---|
645 | the file named {\tt filename}. {\tt .pic} is the default extension for the interpreter
|
---|
646 | command 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
|
---|
649 | commands
|
---|
650 | \item[\rond] An alias for a command by {\bf alias aliasname 'string ' }. Alias substitution
|
---|
651 | occurs for the first word in a command line. {\bf listalias} prints the list of all
|
---|
652 | defined aliases.
|
---|
653 | \item[\rond] Execution control (piapp/PIACmd extension):
|
---|
654 | It is possible to stop the interpreter execution in a loop, a script or
|
---|
655 | a 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}
|
---|
660 | It is possible to create new threads to execute commands
|
---|
661 | ( for non built-in interpreter commands). The syntax is similar
|
---|
662 | to unix shell background tasks: an {\&} should be added at the end
|
---|
663 | of the command line. A new thread is then created for the
|
---|
664 | execution of the command, if declared as thread safe \\
|
---|
665 | (see {\tt CmdExecutor::IsThreadable() }.
|
---|
666 | \par
|
---|
667 | Thread management commands:
|
---|
668 | \begin{itemize}
|
---|
669 | \item[\rond] {\bf thrlist }Print current list of threads, with the associated command
|
---|
670 | the thread identifier (integer ThrId) and its status.
|
---|
671 | \item[\rond] {\bf cleanthrlist } Removes all finished threads from the list.
|
---|
672 | An automatic cleanup is performed periodically.
|
---|
673 | \item[\rond] {\bf cancelthr ThId } / {\bf killthr ThId } Stops/kills the thread with
|
---|
674 | the identifier ThId. Avoid using theses commands as the cleanup does
|
---|
675 | not release some resources associated with
|
---|
676 | the 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}
|
---|
687 | This section contains the description of piapp commands. This information
|
---|
688 | is available on-line, through the help command, or through a graphic
|
---|
689 | window, accessible by \menubar{File / Help}.
|
---|
690 | The help items and command are divided into different sections,
|
---|
691 | where 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}
|
---|
702 | The {\bf PIDrawerTools}, shown in the figure \ref{figdrwtools} can be
|
---|
703 | used to change the graphic attributes (color, font, marker, \ldots)
|
---|
704 | of 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
|
---|
708 | either using {\tt Alt<G>} on a PIScDrawWdg,PIDraw3DWdg,PIImage,
|
---|
709 | or through the menu {\bf Tools/Show DrawerTools}.
|
---|
710 | A 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}
|
---|
724 | The {\bf PIAxesTools}, shown in the figure \ref{figaxestools} can be used to
|
---|
725 | control and change the setting of axes on 2D displays
|
---|
726 | ({\bf PIScDrawWdg} \myppageref{PIScDrawWdg}).
|
---|
727 | The PIAxesTools can be activated
|
---|
728 | either using {\tt Alt<A>} on a PIScDrawWdg or through
|
---|
729 | the 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}
|
---|
742 | The {\bf PIImageTools}, shown in the figure \ref{figimgtools} can be used to
|
---|
743 | manipulate a display of type image. Image display are handled by the
|
---|
744 | {\bf PIImage} (\myppageref{PIImage}). The PIImageTools can be activated
|
---|
745 | either 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}
|
---|
759 | The {\bf PIHisto2DTools}, shown in the figure \ref{figh2dtools} can be
|
---|
760 | used to control and change the display caracteristics of 2D histograms.
|
---|
761 | PIHisto2DTools can be activated
|
---|
762 | either using {\tt Alt<O>} on a PIScDrawWdg, when the active
|
---|
763 | drawer is a PIHisto2DDrawer, or through the generic drawer tool
|
---|
764 | PIDrawerTools.
|
---|
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}
|
---|
777 | The {\bf PIContourTools}, shown in the figure \ref{figconttools} can be
|
---|
778 | used to control and change the caracteristics of contour displays.
|
---|
779 | PIContourTools can be activated
|
---|
780 | either using {\tt Alt<O>} on a PIScDrawWdg, when the active
|
---|
781 | drawer is a PIContDrawer, or through the generic drawer tool
|
---|
782 | PIDrawerTools.
|
---|
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 |
|
---|
795 | Both drawing options (e.g. color, line type, fonts...) and contour
|
---|
796 | determination parameters (e.g. contour number and levels) are controlled
|
---|
797 | by {\bf PIContourTools}.
|
---|
798 |
|
---|
799 | \subsubsection{Drawing options}
|
---|
800 | The top choices in {\bf PIContourTools}
|
---|
801 | concern the color map (left choice) or color (right choice) of the contours.
|
---|
802 | If 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
|
---|
804 | given a color using the left choice box.
|
---|
805 |
|
---|
806 | Contour are by default traced by lines.
|
---|
807 | Alternatively (or in addition) the user may ask to trace them by markers
|
---|
808 | or to put numeric labels (with the contour's level) aside the contour.
|
---|
809 | These options are enabled/disabled by the {\tt LineON}, {\tt MarkerON} and {\tt LabelON}
|
---|
810 | buttons from {\bf PIContourTools}.
|
---|
811 |
|
---|
812 | Options may be recovered ({\tt GetAtt}) or set ({\tt SetAtt})
|
---|
813 | from/to a drawer. Setting an option which adds to the screen will be immediately visible
|
---|
814 | whereas unsetting it requires a {\tt Refresh} to be visible.
|
---|
815 |
|
---|
816 |
|
---|
817 | \subsubsection{Contour options}
|
---|
818 | The contouring routines in {\tt spiapp} are based on a hack of the {\tt GNUPlot}
|
---|
819 | routines. Contours are determined from a grid of values
|
---|
820 | using 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 |
|
---|
828 | Contour levels and number are automatically
|
---|
829 | determined 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)
|
---|
832 | or the lower part of the {\bf PIContourTools} window.
|
---|
833 |
|
---|
834 | The user may specify one of the following alternatives :
|
---|
835 | \begin{enumerate}
|
---|
836 | \item the number of contour (their level beeing automatically set).
|
---|
837 | To do this, select {\tt LevelNum} in the right menu and enter the contour number
|
---|
838 | in 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).
|
---|
841 | To do this, select {\tt LevelDisc} and enter the contour number (left box)
|
---|
842 | and the values (right box) separated by ``{\tt ,}''.
|
---|
843 | \item the levels of the contours through an initial (lower) value and an increment.
|
---|
844 | For this, select {\tt LevelInc} and enter the contour number (left box)
|
---|
845 | and 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 |
|
---|
849 | Once these options are set, it is necessary the the program recomputes
|
---|
850 | the 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}
|
---|