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}{15cm}
|
---|
25 | \setlength{\textheight}{20.5cm}
|
---|
26 | \setlength{\topmargin}{0.cm}
|
---|
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.1 (V\_Nov2007) }
|
---|
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 | \subsection{Acknowlegments}
|
---|
114 | Many people have contributed to the development SOPHYA and/or the PI library
|
---|
115 | and (s)piapp interactive analysis tool.
|
---|
116 | we are grateful to the following people:
|
---|
117 |
|
---|
118 | \begin{tabular}{lcl}
|
---|
119 | Reza Ansari & \hspace{5mm} & (LAL-Univ.Paris Sud, Orsay) \\
|
---|
120 | Eric Aubourg & & (DAPNIA-CEA/APC, Saclay) \\
|
---|
121 | Sophie Henrot-Versille & & (LAL-IN2P3/CNRS, Orsay) \\
|
---|
122 | Alex Kim & & (LBL, Berkeley) \\
|
---|
123 | Guy Le Meur & & (LAL-IN2P3/CNRS, Orsay) \\
|
---|
124 | Eric Lesquoy & & (DAPNIA-CEA, Saclay) \\
|
---|
125 | Christophe Magneville & & (DAPNIA-CEA, Saclay) \\
|
---|
126 | Bruno Mansoux & & (LAL-IN2P3/CNRS, Orsay) \\
|
---|
127 | Olivier Perdereau & & (LAL-IN2P3/CNRS, Orsay) \\
|
---|
128 | Nicolas Regnault & & (LPNHE-IN2P3/CNRS, Paris) \\
|
---|
129 | Benoit Revenu & & (APC/Univ.Paris 7, Paris) \\
|
---|
130 | Francois Touze & & (LAL-IN2P3/CNRS, Orsay) \\
|
---|
131 | \end{tabular}
|
---|
132 |
|
---|
133 | We thank also the persons who have helped us by useful suggestions, among others : \\
|
---|
134 | S. Bargot, S. Du, S. Plasczczynski, C. Renault and D. Yvon.
|
---|
135 |
|
---|
136 | %%%
|
---|
137 | \begin{figure}[ht!]
|
---|
138 | \begin{center}
|
---|
139 | \includegraphics[width=15cm]{piapp_mainwin.eps}
|
---|
140 | \caption{piapp main window}
|
---|
141 | \label{figmainwin}
|
---|
142 | \end{center}
|
---|
143 | \end{figure}
|
---|
144 | \subsection{starting piapp}
|
---|
145 | {\bf piapp} can simply be started on the command line in a terminal window
|
---|
146 | once the SOPHYA/piapp environment has been initialised.
|
---|
147 | The environment variables {\tt SOPHYABASE} should contain the directory
|
---|
148 | where SOPHYA/piapp has been installed. the shared library path
|
---|
149 | {\tt LD\_LIBRARY\_PATH} must contain {\tt \$SOPHYABASE /slb} and the
|
---|
150 | current directory {\tt .} and the executable search path {\tt PATH} must
|
---|
151 | contain {\tt \$SOPHYABASE /exe}. Refer to the SOPHYA overview manual
|
---|
152 | for more information on SOPHYA directory structure. \\
|
---|
153 | It might also be necessary to define the environment variable
|
---|
154 | {\bf PIXKBMOMASK}, used by the libPI.a to map correctly
|
---|
155 | the {\tt <Alt>} key with some X servers (in particular with
|
---|
156 | X11 on MacOS X). \\
|
---|
157 | {\tt csh> setenv PIXKBMODMASK 2 }
|
---|
158 | \par
|
---|
159 | {\tt (s)piapp -h} provides a brief help of the command line
|
---|
160 | arguments. Xtoolkit options can also be specified as command line
|
---|
161 | arguments. {\bf spiapp} is the name of SOPHYA/piapp executable,
|
---|
162 | in order to distinguish it from PEIDA/piapp.
|
---|
163 | \begin{verbatim}
|
---|
164 | csh> spiapp -h
|
---|
165 | SophyaInitiator::SophyaInitiator() BaseTools Init
|
---|
166 | PIOPersist::Initialize() Starting Sophya Persistence management service
|
---|
167 | SOPHYA Version 2.1 Revision 0 (V_Nov2007) -- Nov 24 2007 13:08:58 gcc 3.3
|
---|
168 | 20030304 (Apple Computer, Inc. build 1495)
|
---|
169 | piapp: Interactive data analysis and visualisation program
|
---|
170 | Usage: piapp [-nored] [-doublered] [-termread] [-term]
|
---|
171 | [-hidezswin] [-small] [-nosig] [-nosigfpe] [-nosigsegv]
|
---|
172 | [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]]
|
---|
173 | -nored : Don't redirect stdout/stderr to piapp console
|
---|
174 | -doublered : Redirect stdout/stderr to piapp console AND the terminal
|
---|
175 | -termread : Read commands on terminal (stdin)
|
---|
176 | -term : equivalent to -nored -termread -small
|
---|
177 | -hidezswin : Hide Zoom/Stat/ColMap window
|
---|
178 | -small : Create small size main piapp window
|
---|
179 | -nosig : Don't catch SigFPE, SigSEGV
|
---|
180 | -nosigfpe -nosigsegv: Don t catch SigFPE / SigSEGV
|
---|
181 | -tmpdir TmpDirectory: defines TMDIR for temporary files
|
---|
182 | -help2tex: Create a LaTeX help file (piahelp.tex)
|
---|
183 | -exec file [args] : Execute command file (last option)
|
---|
184 | \end{verbatim}
|
---|
185 | Once {\bf piapp} is started, the main piapp window appears.
|
---|
186 | It contains the menu bar, an upper part with the zoom and colormap
|
---|
187 | widgets for image displays, memory and CPU usage and a terminal like
|
---|
188 | widget (piapp console, see {\bf PIConsole} \myppageref{PIConsole})
|
---|
189 | in the lower part. The figure \ref{figmainwin}
|
---|
190 | shows an image of the piapp main window.
|
---|
191 | {\tt stdout/cout, stderr/cerr} are redirected to the piapp console and
|
---|
192 | commands can be entered in this widget. It is also possible to keep
|
---|
193 | the terminal where piapp was started for {\tt stdout/stderr} (flag {\tt -nored}).
|
---|
194 | It is also possible to have a command reader on the terminal
|
---|
195 | ({\tt stdin}), using the flag {\tt -term}. \\[1mm]
|
---|
196 | %
|
---|
197 | {\bf Warning:} The output redirection uses unix pipes. On Linux, with commands
|
---|
198 | producing long outputs, the application may block because of incorrect management
|
---|
199 | of pipes. If this happens, use piapp with {\tt -nored} flag. This problem has been
|
---|
200 | in principle solved with SOPHYA V=2.1 / piapp V=4.1
|
---|
201 |
|
---|
202 | \par
|
---|
203 | In section 2, we present a quick tour of {\bf piapp}.
|
---|
204 | a brief overview of piapp graphics, supported data formats, interactive
|
---|
205 | analysis possibilities, the command interpreter and c++ execution
|
---|
206 | are presented in the following sections.
|
---|
207 | Section \ref{piappcmdref} contains a brief description of all piapp commands
|
---|
208 | and help items. Various interactive control windows are described in appendix.
|
---|
209 |
|
---|
210 |
|
---|
211 | \newpage
|
---|
212 | \section{A Tour of piapp}
|
---|
213 | \subsection{Interacting with piapp, getting help}
|
---|
214 | Users interact with piapp through commands entered in the piapp-console
|
---|
215 | (or the unix terminal), and through the different menus.
|
---|
216 | Some of the possibilities of the piapp-console are described
|
---|
217 | in {\bf PIConsole} help item, in the command reference section \myppageref{PIConsole}.
|
---|
218 | The description
|
---|
219 | of the commands in available online using the help command.
|
---|
220 | An online help window can be displayed by \menubar{File / Help}.
|
---|
221 | Commands and help items are grouped in categories which can be
|
---|
222 | selected using the OptionMenu in the Help window.
|
---|
223 | \begin{verbatim}
|
---|
224 | Cmd> help func
|
---|
225 | Displays a function y=f(x) (Fills a vector with function values)
|
---|
226 | Usage: func f(x) xmin xmax [npt graphic_attributes]
|
---|
227 | Related commands: funcff func2d func2dff
|
---|
228 | Cmd> func sin(x)/x 0.1 10 100 'red line=solid,2'
|
---|
229 | ---> Graphic display of the function
|
---|
230 | \end{verbatim}
|
---|
231 | The directory {\tt DemoPIApp} contains a number of example
|
---|
232 | command script and sample data files.
|
---|
233 |
|
---|
234 | \subsection{the Object Manager (NamedObjMgr)}
|
---|
235 | The {\bf piapp} application is built around an object manager
|
---|
236 | (class {\tt NamedObjMgr}) and a graphic application
|
---|
237 | (class {\tt PIStdImgApp}). Objects inheriting from
|
---|
238 | the class {\tt AnyDataObj} can be managed through adapter
|
---|
239 | classes (classes inheriting from {\tt NObjMgrAdapter}) by
|
---|
240 | the object manager.
|
---|
241 | \par
|
---|
242 | User sees the objects (such as Sophya objects Histo, NTuple,
|
---|
243 | Arrays, Images, SkyMaps, \ldots) kept in memory, organized
|
---|
244 | in a single level tree structure. Four memory directories
|
---|
245 | are automatically created and can not be removed: \\
|
---|
246 | \centerline{\bf /home \hspace{10mm} /old \hspace{10mm} /tmp \hspace{10mm} /autoc}
|
---|
247 | The default working directory (in memory) is {\bf /home}.
|
---|
248 | Other directories can be created by the user.
|
---|
249 | \begin{center}
|
---|
250 | {\bf Warning:} These are only the directory
|
---|
251 | structure managed by the piapp application and do not
|
---|
252 | correspond to the file system directories
|
---|
253 | \end{center}
|
---|
254 | The window {\bf ObjMgr} shown in figure \ref{figobjmgrw}
|
---|
255 | can be used to navigate in the memory directories and
|
---|
256 | execute simple operations on objects. \\
|
---|
257 | This window can be displayed using the menu command
|
---|
258 | \menubar{Objects / ObjectManager}.
|
---|
259 | The button \framebox{\small \bf SetCurObj} can be used to set the value
|
---|
260 | of the interpreter's variable {\tt cobj} to the selected
|
---|
261 | object name.
|
---|
262 | Refer to the commands in group {\bf Object Management}
|
---|
263 | for more information.
|
---|
264 |
|
---|
265 | \vspace*{5mm}
|
---|
266 | \begin{figure}[ht!]
|
---|
267 | \begin{center}
|
---|
268 | \includegraphics[width=10cm]{piapp_objmgr.eps}
|
---|
269 | \caption{The interactive object management window}
|
---|
270 | \label{figobjmgrw}
|
---|
271 | \end{center}
|
---|
272 | \end{figure}
|
---|
273 |
|
---|
274 | \subsection{command language}
|
---|
275 | A basic command interpreter ({\bf PIACmd/Commander}) is included in {\bf piapp} and
|
---|
276 | other command interpreters can be inserted in the application
|
---|
277 | framework.
|
---|
278 | This interpreter ({\bf Commander} \myppageref{Commander})
|
---|
279 | synthax is close to the c-shell
|
---|
280 | (csh) shell script. It is possible to define and use variables
|
---|
281 | ({\tt set} command, {\tt \$varname}), and execute loops
|
---|
282 | ({\tt foreach,for}), as well as simple tests
|
---|
283 | ({\tt if test then ... else ... endif}).
|
---|
284 | Commands from a file (default extension .pic) can be executed
|
---|
285 | using the {\tt exec} command.
|
---|
286 | Long commands can be put on several lines, by ending a line
|
---|
287 | by the backslash \\ caracter, to signal that the command
|
---|
288 | continues on the next line.
|
---|
289 |
|
---|
290 | The command macro below shows a sample piapp session, where
|
---|
291 | data from the file {\tt demo.ppf} are displayed.
|
---|
292 | \begin{verbatim}
|
---|
293 | # Trace mode -> On
|
---|
294 | traceon
|
---|
295 | # Deleting all objects in the current directory
|
---|
296 | delobjs *
|
---|
297 | # Opening the PPF file demo.ppf
|
---|
298 | openppf demo.ppf
|
---|
299 | # Various displays in a graphic window, divided into 2x2 zones
|
---|
300 | zone 2 2
|
---|
301 | # 1D histogram display
|
---|
302 | disp h1d blue
|
---|
303 | # 2D histogram display
|
---|
304 | disp h2d
|
---|
305 | # Function display
|
---|
306 | func sin(x)/x 0.1 10. 200 gold
|
---|
307 | # Surface representation of a matrix
|
---|
308 | surf mtx1 colbr32
|
---|
309 | # Contour representation of a matrix
|
---|
310 | contour mtx1 'colrj32 normalline ncont=7'
|
---|
311 | # 3D representation of points using a PAW like command
|
---|
312 | n/plot nt31.z%y%x ! ! win
|
---|
313 | # 3D points superimposed on the previous display
|
---|
314 | nt3d nt32 x y z ex ey ez - - 'same fcirclemarker7 red'
|
---|
315 | \end{verbatim}
|
---|
316 |
|
---|
317 | \subsection{NTuple vue / PAW like commands}
|
---|
318 | It is possible to plot various expressions of objects, seen as
|
---|
319 | a 2D table, with named columns. This possibility exist not only
|
---|
320 | for NTuples, but also for most objects (from SOPHYA) handled
|
---|
321 | by piapp. See command groups {\bf Expr.Plotting} and
|
---|
322 | {\bf pawCmd}
|
---|
323 |
|
---|
324 | \subsection{C++ execution inside piapp}
|
---|
325 | For more complex processings, where the full power of C++
|
---|
326 | and the class libraries are necessary, {\bf piapp} provide
|
---|
327 | the possibility of executing C++ code, without the burden
|
---|
328 | of having to write a complete program. The objects
|
---|
329 | present in the current directory are automatically
|
---|
330 | declared. The communication with the piapp application
|
---|
331 | is done by the {\bf NamedObjMgr} class.
|
---|
332 | Two macros {\tt KeepObj()} and {\tt DisplayObj()}
|
---|
333 | simplify the task of keeping newly created objects.
|
---|
334 | In the example below, we first create a noisy signal
|
---|
335 | in a vector, and we keep it in the application
|
---|
336 | (Notice the use of multiline command) :
|
---|
337 |
|
---|
338 | \begin{verbatim}
|
---|
339 | Cmd> c++exec c++exec Vector in(1024); \
|
---|
340 | ...? in = RandomSequence(RandomSequence::Gaussian, 0., 1.); \
|
---|
341 | ...? for(int kk=0; kk<in.Size(); kk++) \
|
---|
342 | ...? in(kk) += 2*sin(kk*0.05); \
|
---|
343 | ...? KeepObj(in);
|
---|
344 | \end{verbatim}
|
---|
345 | We can of course display the resulting vector:
|
---|
346 | \begin{verbatim}
|
---|
347 | Cmd> disp in
|
---|
348 | \end{verbatim}
|
---|
349 |
|
---|
350 | And, at a subsequent stage, make a low pass filter
|
---|
351 | on the vector in:
|
---|
352 | \begin{verbatim}
|
---|
353 | Cmd> c++exec Vector out(1024); \
|
---|
354 | ...? int w = 2; \
|
---|
355 | ...? for(int k=w; k<in.Size()-w; k++) \
|
---|
356 | ...? out(k) = in(Range(k-w, k+w)).Sum()/(2.*w+1.); \
|
---|
357 | ...? KeepObj(out);
|
---|
358 | \end{verbatim}
|
---|
359 |
|
---|
360 | We can display the new vector {\tt out} overlayed
|
---|
361 | on the previously displayed vector:
|
---|
362 | \begin{verbatim}
|
---|
363 | Cmd> disp out 'red same'
|
---|
364 | \end{verbatim}
|
---|
365 |
|
---|
366 | See command group {\bf CxxExecutorCmd} for more information,
|
---|
367 | and the option window activated by the menu:
|
---|
368 | {\bf Special/CxxExecOption}.
|
---|
369 |
|
---|
370 | \subsection{Extending the application}
|
---|
371 | The {\bf piapp} application can easily be extended by the user.
|
---|
372 | This is done through shared libraries which can be opened
|
---|
373 | and used by the application.
|
---|
374 | Two main methods can be used (see command group
|
---|
375 | {\bf ExternalModules}) :
|
---|
376 | \begin{itemize}
|
---|
377 | \item Creation of user functions. A shared library containing
|
---|
378 | at least one user function with the following prototype
|
---|
379 | should be created:
|
---|
380 | \begin{verbatim}
|
---|
381 | extern "C" {
|
---|
382 | void myfonction(vector<string>& args);
|
---|
383 | }
|
---|
384 | \end{verbatim}
|
---|
385 | The class {\bf NameObjMgr} should be used to communicate with the
|
---|
386 | application. The {\tt link} \myppageref{link} and {\tt call} \myppageref{call}
|
---|
387 | should be used to load and execute user functions. An example of
|
---|
388 | user function can be found in DemoPIApp/user.cc exlink.pic.
|
---|
389 |
|
---|
390 | \item Creation of loadable modules: Loadable modules can be
|
---|
391 | used to extend the application possibilities in a way totally
|
---|
392 | transparent to the user. It is possible to define new commands,
|
---|
393 | handling of new object types, additional graphic functionalities
|
---|
394 | in a loadable module.
|
---|
395 |
|
---|
396 | The class {\bf CmdExecutor} is the base class for extending piapp.
|
---|
397 | A shared library should be built, containing two functions,for
|
---|
398 | the activation and deactivation of the module, with the following
|
---|
399 | prototype (where {\tt mymodule} is the module's name.
|
---|
400 | \begin{verbatim}
|
---|
401 | extern "C" {
|
---|
402 | void mymodule_init();
|
---|
403 | void mymodule_end();
|
---|
404 | }
|
---|
405 | \end{verbatim}
|
---|
406 |
|
---|
407 | \end{itemize}
|
---|
408 |
|
---|
409 | %%%%%%%%%% Section 3: Graphiques
|
---|
410 | \newpage
|
---|
411 | \section{Interactive graphics}
|
---|
412 | %%%
|
---|
413 | \subsection{Display commands}
|
---|
414 | Many objects managed by piapp have a default graphic representation. The
|
---|
415 | {\bf disp} command \myppageref{disp} can be used to display the object, while
|
---|
416 | other commands like {\bf surf} \myppageref{surf} , {\bf imag}
|
---|
417 | or {\bf contour} \myppageref{contour} will try to force a given graphic representation.
|
---|
418 |
|
---|
419 | Data from table like objects can be plotted using commands like {\bf nt2d}
|
---|
420 | \myppageref{nt2d} or {\bf nt3d} \myppageref{nt3d}. Most objects in piapp
|
---|
421 | can also be manipulated like table for plotting purposes, using commands
|
---|
422 | like {\bf plot2d} \myppageref{plot2d} , {\bf plot3d} \myppageref{plot3d}
|
---|
423 | or {\bf n/plot} \myppageref{nZplot}. These commands are described in section
|
---|
424 | \ref{tableplot}.
|
---|
425 |
|
---|
426 | Commands producing a graphic output have usually an optional argument called \\
|
---|
427 | {\tt graphic\_attributes} or {\tt gr\_att}. \\
|
---|
428 | This argument provide a flexible and easy
|
---|
429 | way to change and customise the output graphic, as discussed in the paragraphs below.
|
---|
430 |
|
---|
431 | The piapp graphics can be exported in postscript (.ps) or encapsulated postscript
|
---|
432 | (.eps) format. The commands {\bf w2ps} \myppageref{w2ps} and
|
---|
433 | {\bf w2eps} \myppageref{w2eps} as well the menu \menubar{PostScript} can
|
---|
434 | be used to export graphics. \\[2mm]
|
---|
435 | The examples in the followwing pages illustrates the usage of some piapp graphic commands.
|
---|
436 | \newpage
|
---|
437 | \begin{enumerate}
|
---|
438 | \item Image display
|
---|
439 | \begin{verbatim}
|
---|
440 | # Open a PPF file containing topographic data for france
|
---|
441 | # as a TMatrix<short> 1332x1548
|
---|
442 | openppf francetopo.ppf
|
---|
443 | # Display the matrix, whit a zoom factor, lut and color map
|
---|
444 | disp francetopo 'zoom/3 lut=lin,-700,800 colbr128 win'
|
---|
445 | w2eps francetopo.eps
|
---|
446 | \end{verbatim}
|
---|
447 | \begin{center}
|
---|
448 | \includegraphics[width=13cm]{francetopo.eps}
|
---|
449 | \end{center}
|
---|
450 |
|
---|
451 | \item Simple 2D graphics with vector displays
|
---|
452 | \begin{verbatim}
|
---|
453 | # Create and initialize two vectors - prevent display : nodisp
|
---|
454 | Cmd> newvec vva 100 sin(x/10.+0.7)+cos(x/7.+1.4)*1.26 nodisp
|
---|
455 | Cmd> newvec vvb 100 sin(x/10.)+cos(x/7.)*1.34 nodisp
|
---|
456 | # Set axe drawing options
|
---|
457 | Cmd> setaxesatt 'font=times,bold,16 minorticks tickslen=0.02,0.012'
|
---|
458 | # Display the two vectors, with different graphic attributes
|
---|
459 | Cmd> disp vva 'red line=solid,2 notitle'
|
---|
460 | # Define a title for the graphic
|
---|
461 | Cmd> settitle 'Example-1: 2 vectors' ' ' 'font=times,bolditalic,18'
|
---|
462 | Cmd> disp vvb 'blue marker=box,7 same'
|
---|
463 | # Save the graphic into an eps file
|
---|
464 | Cmd> w2eps gr2vec.eps
|
---|
465 | \end{verbatim}
|
---|
466 | % \begin{figure}[ht!]
|
---|
467 | \begin{center}
|
---|
468 | \includegraphics[width=12cm]{gr2vec.eps}
|
---|
469 | % \label{g22vec}
|
---|
470 | \end{center}
|
---|
471 | %%%
|
---|
472 | \item Creating a comparison chart using {\bf bargraph}
|
---|
473 | \begin{verbatim}
|
---|
474 | # Representation du PNB (en $, 2003) pour quelques pays
|
---|
475 | set pays ( Allemagne Espagne France Italie Pays-Bas Suisse UK USA )
|
---|
476 | set pnbh ( 22670 14430 22010 18960 23960 37930 25250 35060 )
|
---|
477 | setaxesatt 'font=times,bold,16'
|
---|
478 | bargraph pnbh pays - 'blue horizontalbars nofill packfrac=0.65 font=helvetica,bold,14'
|
---|
479 | setaxelabels 'PNB / Hab , $ 2003' ' ' 'font=times,bold,16'
|
---|
480 | w2eps pnbargraph.eps
|
---|
481 | \end{verbatim}
|
---|
482 | \begin{center}
|
---|
483 | \includegraphics[width=12cm]{pnbbargraph.eps}
|
---|
484 | \end{center}
|
---|
485 | %%%
|
---|
486 | \item Displaying a matrix as a surface
|
---|
487 | \begin{verbatim}
|
---|
488 | openppf demo.ppf mtx1
|
---|
489 | setaxesatt 'font=time,bold,16'
|
---|
490 | surf mtx1 'colbr128 line=solid,1 grey'
|
---|
491 | w2eps surfcol.eps
|
---|
492 | \end{verbatim}
|
---|
493 | \begin{center}
|
---|
494 | \includegraphics[width=13cm]{surfcol.eps}
|
---|
495 | \end{center}
|
---|
496 |
|
---|
497 | \end{enumerate}
|
---|
498 |
|
---|
499 | %%%%%%%%%%
|
---|
500 | \subsection{Graphic objects in piapp}
|
---|
501 | The piapp graphics is handled by the {\bf PI} \footnote {http://www.sophya.org/PI} library,
|
---|
502 | which provide a large variety of 2D representations,
|
---|
503 | few 3D graphics and powerful image display. \\
|
---|
504 | Currently, all graphic representations, except for image displays, are handled
|
---|
505 | through {\bf PIDrawers} which are managed by a viewer. A viewer can
|
---|
506 | manage several {\bf PIDrawers} objects which correspond then to a multilayer
|
---|
507 | graphic display. The viewers are also responsible for managing user
|
---|
508 | interactions. \\
|
---|
509 | Image displays are handled through a specific viewer
|
---|
510 | {\bf PIImage} which is also capable of managing PIDrawer objects
|
---|
511 | for multi-layer 2D overlay vector graphics. \\[2mm]
|
---|
512 | %%
|
---|
513 | Main piapp/PI graphic viewers, windows and drawer objects are described if
|
---|
514 | the following sections.
|
---|
515 |
|
---|
516 | \subsubsection{PIScDrawWdg (2D display)}
|
---|
517 | The {\bf PIScDrawWdg} handles a set of of 2-D drawers, managing
|
---|
518 | the 2D coordinate system and interactive zoom. The axes drawing is
|
---|
519 | handled by a specialised drawer, number 0, which also manages various added
|
---|
520 | graphic elements (text \ldots). The list of various mouse and
|
---|
521 | keyboard actions is described in the reference section, under {\bf PIScDrawWdg} \myppageref{PIScDrawWdg} title. In particular, mouse-button-2 can be used
|
---|
522 | to zoom on a particular part, {\tt $<$Alt$>$A} activates the coordinates
|
---|
523 | and axes manipulation window ({\bf PIAxesTools}) and {\tt $<$Alt$>$G}
|
---|
524 | activates the PIDrawer graphic attributes control window ({\bf PIDrawerTools}).
|
---|
525 | %%%
|
---|
526 | \subsubsection{PIDraw3DWdg (3D display)}
|
---|
527 | The {\bf PIDraw3DWdg} handles a set of of 3-D drawers, managing
|
---|
528 | interactive camera/object rotation (mouse-button-2) and zoom (mouse-button-2).
|
---|
529 | {\tt $<$Alt$>$G} to display/activate the PIDrawer graphic attributes
|
---|
530 | control window ({\bf PIDrawerTools}).
|
---|
531 | See {\bf PIDraw3DWdg} \myppageref{PIDraw3DWdg} for a complete list of mouse
|
---|
532 | and keyboard actions.
|
---|
533 | Drawer 0 handles axes drawing and graphic elements.
|
---|
534 | %%%
|
---|
535 | \subsubsection{PIImage (Image Display)}
|
---|
536 | The display of 2-D arrays $A(i,j)$ as an image is managed by
|
---|
537 | the {\bf PIImage} viewer/widget. The PI library interface {\bf P2DArrayAdapter} is used
|
---|
538 | to represent a generic 2-D array. The array values are converted into an index, converted
|
---|
539 | itself into a color by the use of a color-map or color-table {\bf PIColorMap}.
|
---|
540 | $$ \mathrm{LUT:} A(i,j) \longrightarrow idx(i,j) \hspace{5mm} \mathrm{ColorMap:}
|
---|
541 | idx(i,j) \longrightarrow col(i,j) $$
|
---|
542 | Currently index range is 0...255 with color-map having 32 or 128 distinct colors.
|
---|
543 | PIImage viewers controls a zoom widget, as well as a global image view widget, and
|
---|
544 | a color map view widget. A specific image control window can be activated using
|
---|
545 | {\tt $<$Alt$>$O}. See {\bf PIImage} \myppageref{PIImage} for
|
---|
546 | a complete list of mouse and keyboard actions. A base drawer (number 0) can handle
|
---|
547 | axes drawing and added graphic elements.
|
---|
548 | %%%
|
---|
549 | \subsubsection{Windows}
|
---|
550 | The viewers described above are displayed in differnt kind of windows.
|
---|
551 | The graphic option {\tt next,win,same,stack} can be used to control the way the
|
---|
552 | type of windows used. Graphic windows can be divided into several zones
|
---|
553 | (Command {\bf zone} \myppageref{zone}).
|
---|
554 |
|
---|
555 | When an object is diplayed in piapp, a widget (PIWdg) is created which manages
|
---|
556 | the drawer or the 2d-array. The default name for this widget is the displayed
|
---|
557 | object name. However, it is possible to specify a name using the graphic attribute: \\
|
---|
558 | \hspace*{5mm} {\tt wname=WidgetName} \\
|
---|
559 | It is possible to display multiple objects on a single widget, corresponding
|
---|
560 | to the superposition of the different drawers. Displaying an object superimposed
|
---|
561 | on the previously displayed object can be done using the graphic option
|
---|
562 | {\tt same}. It is also possible to specify a target widget by its name, through
|
---|
563 | the graphic option \\
|
---|
564 | \hspace*{5mm} {\tt samew=WidgetName} \\
|
---|
565 | It is also possible to specify the display of the drawer in a specified region
|
---|
566 | of the last displayed widget \\
|
---|
567 | \hspace*{5mm} {\tt same=fx1,fx2,fy1,fy2} \\
|
---|
568 | where {\tt fx1,fx2,fy1,fy2} express X and Y limits, as fraction of widget size.
|
---|
569 |
|
---|
570 | Refer to the command reference section on windows ({\bf Windows}
|
---|
571 | \myppageref{Windows})
|
---|
572 | for information on the different type of windows used by piapp
|
---|
573 | and their properties. \\
|
---|
574 |
|
---|
575 | %%%
|
---|
576 | \subsubsection{Drawers}
|
---|
577 | Graphical representation of most objects in piapp is
|
---|
578 | handled through objects inheriting from the {\bf PIDrawer class}. A base drawer
|
---|
579 | (PIElDrawer, number 0) associated to all three above viewers manages the axes drawing
|
---|
580 | as well as the added graphic elements (text, arrow, \ldots). A drawer management menu
|
---|
581 | can be activated using {\tt $<$Alt$>$D}. This menu can be used to move and resize
|
---|
582 | drawers, or to display a window for changing drawers graphic attributes.
|
---|
583 | %%%
|
---|
584 | \par
|
---|
585 | In addition, a number of control windows can be used to examine and
|
---|
586 | change view properties of differents viewers and drawers.
|
---|
587 | \begin{itemize}
|
---|
588 | \item[] {\bf PIDrawerTools} activated using {\tt $<$Alt$>$G} or
|
---|
589 | \menubar{Tools/Show DrawerTools} on any viewer (see page \myppageref{secdrwtools})
|
---|
590 | \item[] {\bf PIAxesTools} activated using {\tt $<$Alt$>$A} or
|
---|
591 | \menubar{Tools/Show AxeTools} on PIScDrawWdg (see page \myppageref{secaxestools})
|
---|
592 | \item[] {\bf PIImageTools} activated using {\tt $<$Alt$>$O} or
|
---|
593 | \menubar{Tools/Show ImageTools} on PIImage
|
---|
594 | (see page \myppageref{secimagetools})
|
---|
595 | \item[] {\bf PIHisto2DTools} activated using {\tt $<$Alt$>$O} or through the PIDrawerTools
|
---|
596 | for an active PIHisto2D drawer. (see page \myppageref{sech2dtools})
|
---|
597 | \item[] {\bf PIContourTools} activated using {\tt $<$Alt$>$O} or through the PIDrawerTools
|
---|
598 | for an active PIContourDrawer drawer. (see page \myppageref{secconttools})
|
---|
599 | \end{itemize}
|
---|
600 | These control tools are briefly described in appendix.
|
---|
601 |
|
---|
602 | %%%%%%%%%%
|
---|
603 | \subsection{Graphic attributes}
|
---|
604 | Graphic attributes are specified as a set of space separated strings. Use
|
---|
605 | quotes to group them into a single argument parsed by the command
|
---|
606 | interpreter. The options are decoded by the different objects handling the
|
---|
607 | graphic (viewer widget, drawer, axe drawer). \\
|
---|
608 | The complex decoding scheme
|
---|
609 | is usually transparent for piapp users. However, there is an ambiguity when
|
---|
610 | specifying some of the axes attributes, such as color or the font used for
|
---|
611 | drawing the axes. The command {\bf setaxesatt} (\myppageref{setaxesatt})
|
---|
612 | should thus be used to specify generic graphic attributes (color, font, line type). \\
|
---|
613 | for axes.
|
---|
614 | \begin{itemize}
|
---|
615 | \item[\bul] The {\bf PIScDrawWdg} viewer options: \\
|
---|
616 | \begin{verbatim}
|
---|
617 | >> To define the 2D axes limits (in user coordinates)
|
---|
618 | xylimits=xmin,xmax,ymin,ymax
|
---|
619 | >> To define the default drawing rectangle, in fraction of widget size
|
---|
620 | defdrrect=x1,x2,y1,y2 (default: x1=y1=0.1 x2=y2=0.9)
|
---|
621 | >> Axes flags :
|
---|
622 | linx logx liny logy
|
---|
623 | >> To change the background color (default=white)
|
---|
624 | wbgcol=colname
|
---|
625 |
|
---|
626 | \end{verbatim}
|
---|
627 | %%%
|
---|
628 | \item[\bul] The {\bf PIDraw3DWdg} viewer options: \\
|
---|
629 | \begin{verbatim}
|
---|
630 | >> To define the 3D box limits :
|
---|
631 | xyzlimits=xmin,xmax,ymin,ymax,zmin,zmax
|
---|
632 | limit3dbox=xmin,xmax,ymin,ymax,zmin,zmax
|
---|
633 | >> Autoscaling flags (rescaling of X/Y or X/Y/Z axes)
|
---|
634 | autoscale3dbox / noautoscale3dbox
|
---|
635 | autoscalexy3dbox / noautoscalexy3dbox
|
---|
636 | autoscalez3dbox / noautoscalez3dbox
|
---|
637 | >> To change the background color (default=white)
|
---|
638 | wbgcol=colname
|
---|
639 |
|
---|
640 | \end{verbatim}
|
---|
641 | %%%
|
---|
642 | \item[\bul] The {\bf PIImage} viewer options: \\
|
---|
643 | \begin{verbatim}
|
---|
644 | >> Define display zoomfactor
|
---|
645 | zoomxFact (zoomx2 zoomx3 ... zoomx9 ...)
|
---|
646 | zoom/Fact (zoom/2 zoom/3 ... )
|
---|
647 | >> LUT (look-up table) definition (pixel value to index conversion)
|
---|
648 | lut=type,min,max (type=lin/log/sqrt/square)
|
---|
649 | >> AutoLut selector : define the method for automatic determination
|
---|
650 | of LUT limits (min/max)
|
---|
651 | autolut=alt[,ns[,minp,maxp]] (minp<=pixels<=maxp)
|
---|
652 | - autolut=minmax[,Frac] 0<=Frac<=1
|
---|
653 | - autolut=meansig[,ns] --> mean +/- ns*sigma
|
---|
654 | - autolut=hispeak[,ns] --> around the peak of pixel values histogram
|
---|
655 | - autolut=histail[,ns] --> the tail of pixel values histogram
|
---|
656 | >> Define color table and reversing color indexing flag
|
---|
657 | ColTableName revcmap
|
---|
658 | ==> Standard tables with 32 distinct colors:
|
---|
659 | grey32 invgrey32 colrj32 colbr32 colrv32
|
---|
660 | ==> Standard tables with 128 distinct colors:
|
---|
661 | grey128 invgrey128 colrj128 colbr128
|
---|
662 | ==> Shades of red/green/blue ...
|
---|
663 | red32cm green32cm blue32cm yellow32cm
|
---|
664 | orange32cm cyan32cm violet32cm
|
---|
665 | ==> Some of MIDAS color tables :
|
---|
666 | midas_pastel midas_heat midas_rainbow3
|
---|
667 | midas_bluered midas_bluewhite midas_stairs8
|
---|
668 | midas_stairs9 midas_staircase midas_color
|
---|
669 | midas_manycol midas_idl14 midas_idl15
|
---|
670 | ==> Other tables
|
---|
671 | multicol16 multicol64
|
---|
672 | >> Viewed center position (image/array coordinates)
|
---|
673 | imagecenter=xc,yc
|
---|
674 | >> Array axes to window axes mapping flags
|
---|
675 | invx invy exchxy
|
---|
676 | >> To change the background color (default=black)
|
---|
677 | wbgcol=colname
|
---|
678 |
|
---|
679 | \end{verbatim}
|
---|
680 | %%%
|
---|
681 | \item[\bul] The {\bf PIGraphicAtt} Generic graphic attributes (color/font/line \ldots)
|
---|
682 | decoded by all drawers: \\
|
---|
683 | \begin{verbatim}
|
---|
684 | >>> color=ColorName - fgcolor=ColorName - bgcolor=ColorName
|
---|
685 | ColorName: black white grey red blue green yellow
|
---|
686 | magenta cyan turquoise navyblue orange
|
---|
687 | siennared purple limegreen gold violet
|
---|
688 | violetred blueviolet darkviolet skyblue
|
---|
689 | royalblue forestgreen orangered brown
|
---|
690 | >>> line=DashType,LineWidth
|
---|
691 | DashType: solid, dash, dotted, dashdotted Width: 1,2,...
|
---|
692 | >>> font=FontName,FontAtt,FontSize
|
---|
693 | FontName: courier, helvetica, times, symbol
|
---|
694 | FontAtt: roman, bold, italic, bolditalic
|
---|
695 | FontSize: 6,8,10,12... (pts) - integer
|
---|
696 | >>> marker=MarkerType,MarkerSize (MarkerSize: integer 3,5,7...
|
---|
697 | MarkerType: dot, plus, cross, circle, fcircle, box, fbox
|
---|
698 | triangle, ftriangle, star, fstar
|
---|
699 | >>> arrow=ArrowType,ArrowSize (ArrowSize: integer 3,5,7...
|
---|
700 | ArrowType: basic, triangle, ftriangle,
|
---|
701 | arrowshaped, farrowshaped
|
---|
702 | >>> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32
|
---|
703 | grey128 invgrey128 colrj128 colbr128
|
---|
704 | red32cm green32cm blue32cm yellow32cm
|
---|
705 | orange32cm cyan32cm violet32cm
|
---|
706 | midas_pastel midas_heat midas_rainbow3 midas_bluered
|
---|
707 | midas_bluewhite midas_redwhite
|
---|
708 | multicol16 multicol64
|
---|
709 | > revcmap : This flag reverses ColorMap indexing
|
---|
710 | ------- Old style graphic att ----------
|
---|
711 | >> Lines: defline normalline thinline thickline dashedline thindashedline
|
---|
712 | thickdashedline dottedline thindottedline thickdottedline
|
---|
713 | >> Font Att: deffontatt normalfont boldfont italicfont bolditalicfont
|
---|
714 | smallfont smallboldfont smallitalicfont smallbolditalicfont
|
---|
715 | bigfont bigboldfont bigitalicfont bigbolditalicfont
|
---|
716 | hugefont hugeboldfont hugeitalicfont hugebolditalicfont
|
---|
717 | >> Font Names: deffont courierfont helveticafont timesfont symbolfont
|
---|
718 | >> Marker: dotmarker<S> plusmarker<S> crossmarker<S> circlemarker <S>
|
---|
719 | fcirclemarker<S> boxmarker<S> fboxmarker<S> trianglemarker<S>
|
---|
720 | ftrianglemarker<S> starmarker<S> fstarmarker<S>
|
---|
721 | with <S> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ...
|
---|
722 |
|
---|
723 | \end{verbatim}
|
---|
724 | %%%%
|
---|
725 | \item[\bul] The {\bf PIElDrawer} decodes axe drawing attributes: \\
|
---|
726 | \begin{verbatim}
|
---|
727 | >> Axe and grid configuration flags:
|
---|
728 | axesnone stdaxes defaxes
|
---|
729 | boxaxes boxaxesgrid fineaxes fineaxesgrid
|
---|
730 | centeredaxes finecenteredaxes centeredaxesgrid
|
---|
731 | finecenteredaxesgrid grid/nogrid
|
---|
732 | >> Centered axes position: axescenter=xc,yc
|
---|
733 | >> Axe ticks/labels (h=horizontal/x, v=vertical/y):
|
---|
734 | labels/nolabels hlabels/nohlabels vlabels/novlabels
|
---|
735 | ticks/noticks minorticks/nominorticks
|
---|
736 | extticks/intticks/extintticks nbticks=X_NbTicks,Y_NbTicks
|
---|
737 | tickslen=MajorTickLenFrac,MinorTickLenFraC
|
---|
738 | >> Axe label font size:
|
---|
739 | autofontsize=FontSizeFrac fixedfontsize
|
---|
740 | >> Up/Down title: title tit notitle notit
|
---|
741 | ... Color/Font/line attributes :
|
---|
742 |
|
---|
743 | \end{verbatim}
|
---|
744 | \item[\bul] The {\bf PINTuple} handles most 2D plotting : \\
|
---|
745 | \begin{verbatim}
|
---|
746 | sta,stat,stats: activate statistic display
|
---|
747 | nsta,nstat,nostat,nostats: deactivate statistic display
|
---|
748 | statposoff=OffsetX,OffsetY : Position offset for Stats drawing
|
---|
749 | as a fraction of total size
|
---|
750 | connectpoints: The points are connected by a line
|
---|
751 | noconnectpoints (this is the default)
|
---|
752 | colorscale/nocolorscale (Use color scale for weight)
|
---|
753 | sizescale/sizescale=nbins/nosizescale (Use marker size for weight)
|
---|
754 | (and usual color/line/marker/... attribute decoding)
|
---|
755 |
|
---|
756 | \end{verbatim}
|
---|
757 | %%%
|
---|
758 | \item[\bul] {\bf PIHisto} and {\bf PIHisto2D} handle1D and 2D histograms display. \\
|
---|
759 | The following options are recognised by PIHisto: \\
|
---|
760 | \begin{verbatim}
|
---|
761 | ---- PIHisto options help info :
|
---|
762 | sta,stat,stats: activate statistic display
|
---|
763 | nsta,nstat,nostat,nostats: deactivate statistic display
|
---|
764 | err / noerr,nerr : draw, do not draw error bars
|
---|
765 | autoerr : draw error bars if Marker drawing requested OR Profile histo
|
---|
766 | fill / nofill,nfill : fill, do not fill bars with selected color
|
---|
767 | statposoff=OffsetX,OffsetY : Position offset for Stats drawing
|
---|
768 | as a fraction of total size
|
---|
769 | ---- HistoWrapper options :
|
---|
770 | hbincont: select bin content as Y value for display (default)
|
---|
771 | hbinerr: select bin error as Y value for display
|
---|
772 | hbinent: select bin entries as Y value for display
|
---|
773 | hscale=value : multiplicative factor for Y value
|
---|
774 | hoffset=value : additive coefficient for Y value
|
---|
775 | hs1: set hscale=1 hoffset=0 (default)
|
---|
776 | hscale=value : multiplicative factor (in Y)
|
---|
777 |
|
---|
778 | \end{verbatim}
|
---|
779 | The following options are recognised by PIHisto2D: \\
|
---|
780 | \begin{verbatim}
|
---|
781 | - sta,stat,stats: activate statistic display
|
---|
782 | nsta,nstat,nostat,nostats: deactivate statistic display
|
---|
783 | - h2disp=typ[,fracpts]: choose display type
|
---|
784 | typ=var: variable size boxes
|
---|
785 | typ=hbk: "a la hbook2"
|
---|
786 | typ=img: image like (use "h2col" for color map)
|
---|
787 | typ=pts: point clouds (fracpts=max possible fraction
|
---|
788 | of used pixels per bin [0,1])
|
---|
789 | - h2scale=lin/log[,logscale]: choose linear or logarithmic scale
|
---|
790 | - h2dyn=[hmin][,hmax]: choose histogramme range for display
|
---|
791 | - use general key to define color table (ex: grey32,midas_heat,...)
|
---|
792 | (see general graphicatt description)
|
---|
793 | - use key "revcmap" to reverse color table
|
---|
794 | - h2frac=[fmin][,fmax]: choose sub-range display [0,1]
|
---|
795 | ---- HistoWrapper options : (see HistoWrapper above)
|
---|
796 |
|
---|
797 | \end{verbatim}
|
---|
798 | %%%%
|
---|
799 | \item[\bul] The {\bf PINTuple3D} and {\bf PISurfaceDrawer}
|
---|
800 | handles basic 3D plotting and can decode the common 3D box options: \\
|
---|
801 | \begin{verbatim}
|
---|
802 | X/Y,Z axis rescaling option (-> cubic 3D box)
|
---|
803 | rescale=autoscale/ norescale=noautoscale : X/Y and Z axis
|
---|
804 | rescalexy=autoscalexy / norescalexy=noautoscalexy : X/Y axis
|
---|
805 | rescalexy=autoscalexy / norescalexy=noautoscalexy : Z axis
|
---|
806 | \end{verbatim}
|
---|
807 | The PINTuple3D decodes in addition the following options:
|
---|
808 | \begin{verbatim}
|
---|
809 | connectpoints: The points are connected by a line
|
---|
810 | noconnectpoints (this is the default)
|
---|
811 | colorscale/nocolorscale (Use color scale for weight)
|
---|
812 | sizescale/sizescale=nbins/nosizescale (Use marker size for weight)
|
---|
813 |
|
---|
814 | \end{verbatim}
|
---|
815 | \item[\bul] The {\bf (PIContourDrawer)} decodes the following options : \\
|
---|
816 | \begin{verbatim}
|
---|
817 | autolevels : automatic selection of levels and number of contours
|
---|
818 | ncont=nLevel (or nc=NLevel) : sets the number of contour
|
---|
819 | lev=v1,v2,v3... (or niv=v1,v2,v3...) set the number and levels of contours
|
---|
820 | lstep=nLev,start,step : define incremental levels
|
---|
821 | labon/laboff : display of contour level values on/off
|
---|
822 | linear/bspline/cubicspl=3spl : select contour kind
|
---|
823 |
|
---|
824 | \end{verbatim}
|
---|
825 |
|
---|
826 | \item[\bul] {\bf PIBarGraph} options : \\
|
---|
827 | \begin{verbatim}
|
---|
828 | ---- PIBarGraph options help info :
|
---|
829 | fill/nofill: set bar fill option
|
---|
830 | horizontalbars/verticalbars: set bar orientation
|
---|
831 | packfrac=value : set bar packing fraction (0..1)
|
---|
832 | barvaluelabel/nobarvaluelabel: Use/Don't use bar value as labels
|
---|
833 | --- + Usual colr/line/font attribute decoding ...
|
---|
834 | \end{verbatim}
|
---|
835 | \end{itemize}
|
---|
836 |
|
---|
837 |
|
---|
838 | %%%%%%%%%%%%%%% Section 4 : I/O
|
---|
839 | \newpage
|
---|
840 | \section{Data formats and input-output (I/O)}
|
---|
841 | The data file formats recognized by piapp are the ones supported by the
|
---|
842 | SOPHYA library or its extension.
|
---|
843 | \begin{itemize}
|
---|
844 | \item[\bul] ASCII files - Data can be imported from ascii (text) files as
|
---|
845 | datatables or arrays. These objects can also be exported as text files.
|
---|
846 | \item[\bul] FITS files - FITS is a popular format used in particular in astronomy.
|
---|
847 | \href{http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html}
|
---|
848 | Data is usually read from FITS files as vectors, images, cubes or tables.
|
---|
849 | A subset of SOPHYA objects can be exported in FITS format.
|
---|
850 | \item[\bul] PPF (Portable Persistence file Format) is the native SOPHYA
|
---|
851 | data format.
|
---|
852 | \item[\bul] PostScript - All graphic output produced by piapp can be exported
|
---|
853 | as postscript (.ps) or encapsulated postscript (.eps) files.
|
---|
854 | \end{itemize}
|
---|
855 |
|
---|
856 | \subsection{Text files}
|
---|
857 | Text (or ascii) files can be read into array or datatable objects by spiapp.
|
---|
858 |
|
---|
859 | {\bf Arrays :} \\
|
---|
860 | Arrays can be written to to files in text/ascii format using the {\tt arrtoascii}
|
---|
861 | \myppageref{arrtoascii} command. Double precision matrices and vectors
|
---|
862 | can be read from text files using the commands
|
---|
863 | {\tt mtxfrascii} \myppageref{mtxfrascii} and
|
---|
864 | {\tt vecfrascii} \myppageref{vecfrascii} . \\
|
---|
865 | The menu-bar command \menubar{File/Open-ASCII} reads in a text
|
---|
866 | file as a matrix.
|
---|
867 | \begin{verbatim}
|
---|
868 | # Create and initialize a matrix
|
---|
869 | newmtx arr 250 150 x+3*y
|
---|
870 | # Save the file in the text file arr.txt
|
---|
871 | arrtoascii arr arr.txt
|
---|
872 | # Read the previously created file and fill a matrix
|
---|
873 | mtxfrascii mxa arr.txt
|
---|
874 | # Print and display the matrix
|
---|
875 | print mxa
|
---|
876 | disp mxa zoomx2
|
---|
877 | \end{verbatim}
|
---|
878 | It is possible to specify the field separator in the input file, as well as the marker for the comment
|
---|
879 | lines.
|
---|
880 |
|
---|
881 | {\bf DataTable :} \\
|
---|
882 | Text files can also be read as a 2-D table (NTuple or DataTable). The table should be
|
---|
883 | created using the {\tt newnt} \myppageref{newnt} or
|
---|
884 | {\tt newdt} \myppageref{newdt} command.
|
---|
885 | The command {\tt ntfrascii} \myppageref{ntfrascii} can then be used to append
|
---|
886 | data from the file to the datatable.
|
---|
887 |
|
---|
888 | \subsection{PPF}
|
---|
889 | %%%
|
---|
890 | PPF (Portable Persistence file Format) is the the native persistence
|
---|
891 | format of SOPHYA and thus is fully handled by spiapp. PPF files can
|
---|
892 | be opened through the menu-bar \menubar{File/Open-PPF}, or through
|
---|
893 | the {\tt openppf} \myppageref{openppf}.
|
---|
894 |
|
---|
895 | If the PPF file contains NameTags, only the objects marked with nametags are read and given
|
---|
896 | the corresponding names. Otherwise, all objects are red sequentially, with their names
|
---|
897 | formed by the filename followed by a sequence number. It is also possible to force the sequential
|
---|
898 | reading specifying the {\tt -s} flag for openppf.
|
---|
899 |
|
---|
900 | The objects managed in spiapp by the {\bf NamedObjMgr} can be saved to PPF files, with their
|
---|
901 | names as NameTags. The commands {\tt saveppf} \myppageref{saveppf} or
|
---|
902 | {\tt saveall} \myppageref{saveall} can be used to this end.
|
---|
903 |
|
---|
904 | \begin{verbatim}
|
---|
905 | # Create two vectors and two matrices
|
---|
906 | newvec va1 150 sin(sqrt(x))
|
---|
907 | newvec vb2 150 sin(sqrt(x))*sqrt(x*0.1)
|
---|
908 | newmtx mxa 250 150 x+2.*y
|
---|
909 | newmtx mxb 250 150 sin(sqrt(x))*cos(sqrt(y))
|
---|
910 | # List of the objects in memory
|
---|
911 | listobjs
|
---|
912 | # Save the two vectors in the file vecab.ppf
|
---|
913 | saveppf v* vecab.ppf
|
---|
914 | # Save the two matrices in the file mxab.ppf
|
---|
915 | saveppf m* mxab.ppf
|
---|
916 | \end{verbatim}
|
---|
917 |
|
---|
918 | \subsection{FITS}
|
---|
919 | FITS files may contain three types of data structures
|
---|
920 | \begin{enumerate}
|
---|
921 | \item Image or array data structure : {\tt IMAGE\_HDU}
|
---|
922 | \item Binary table : {\tt BINARY\_TBL}
|
---|
923 | \item ascii table : {\tt ASCII\_TBL}
|
---|
924 | \end{enumerate}
|
---|
925 | The {\bf FitsIOServer} module contain FitsHandler classes which
|
---|
926 | can map many SOPHYA classes on FITS data structures.
|
---|
927 | Generic {\tt IMAGE\_HDU} correspond to the SOPHYA \tcls{TArray}
|
---|
928 | class, while {\tt BINARY\_TBL} or {\tt ASCII\_TBL} is mapped
|
---|
929 | to NTuple or DataTable.
|
---|
930 |
|
---|
931 | FITS format files can be read through the menu command \menubar{File/Open-Fits},
|
---|
932 | or using {\tt readfits/openfits} \myppageref{readfits} command.
|
---|
933 | Objects can be exported to FITS using the {\tt writefits/savefits}
|
---|
934 | \myppageref{writefits} command.
|
---|
935 |
|
---|
936 | \begin{verbatim}
|
---|
937 | # Open the PPF file created by the commands above
|
---|
938 | openppf vecab.ppf
|
---|
939 | # Export the two vector objects to file vecab.fits
|
---|
940 | # Note that the '!' forces c-fitsio to overwrite the file, if it exists
|
---|
941 | writefits v?? !vecab.fits
|
---|
942 | \end{verbatim}
|
---|
943 |
|
---|
944 | There are two commands useful
|
---|
945 | when analyzing large catalogs (BINARY\_TBL) in FITS format, which avoid reading the whole
|
---|
946 | table in memory. {\tt swfitstable}\myppageref{swfitstable} reads a specified HDU
|
---|
947 | as a {\bf SwFitsDataTable} object which uses the FITS file as swap space.
|
---|
948 | The {\tt fitsadapt}\myppageref{fitsadapt} can also be used for similar purposes.
|
---|
949 |
|
---|
950 | The following commands shows how to open a FITS file containing a synchrotron map
|
---|
951 | of our galaxy:
|
---|
952 | \begin{verbatim}
|
---|
953 | # Open the fits file : the map is in HEALPix format
|
---|
954 | readfits syncmap.fits
|
---|
955 | # Create a window with the appropriate size
|
---|
956 | newwin 1 1 800 400
|
---|
957 | # Display the map, specifying the colormap
|
---|
958 | disp syncmap 'lut=lin,2,50 midas_bluered'
|
---|
959 | \end{verbatim}
|
---|
960 | \begin{figure}[h]
|
---|
961 | \begin{center}
|
---|
962 | \includegraphics[width=15cm]{syncmap.eps}
|
---|
963 | \caption{Synchron map of our Galaxy, displayed in Molleweide projection}
|
---|
964 | \end{center}
|
---|
965 | \end{figure}
|
---|
966 |
|
---|
967 | \subsection{Graphic export in postscript}
|
---|
968 | %%
|
---|
969 | Postscript a page description language widely used for printing and
|
---|
970 | graphic output, developed by Adobe systems. Refer to
|
---|
971 | \href{http://www.adobe.com/products/postscript/}{Adobe/PostScript3}
|
---|
972 | for more detail.
|
---|
973 |
|
---|
974 | Piapp graphic output can be exported in postscript (level 2) or
|
---|
975 | encapsulated postscript format.
|
---|
976 | Postscript (.ps) files my contain several pages, each vue or window
|
---|
977 | corresponding to one page and are suitable for direct printing.
|
---|
978 | An Encapsulated Postscript (.eps) file contains a single page,
|
---|
979 | corresponding to a window and is suitable for inclusion in
|
---|
980 | other document.
|
---|
981 |
|
---|
982 | Postscript file can easily be converted to other formats,
|
---|
983 | PDF or image formats (jpeg \ldots) using converters like
|
---|
984 | {\bf ps2pdf} or {imagemagick}.
|
---|
985 |
|
---|
986 | The menu items under \menubar{PostScript} can be used to export
|
---|
987 | graphics in postscript. The default file name is {\tt pia.ps}
|
---|
988 | or {\tt pia1.eps} {\tt pia2.eps} \ldots
|
---|
989 | The following commands can also be used to create postscriot file
|
---|
990 | from the display in the current graphic window:
|
---|
991 | \begin{itemize}
|
---|
992 | \item {\tt w2ps} \myppageref{w2ps} to add the current graphic
|
---|
993 | output as a new page to the output postscript file.
|
---|
994 | The current output postscript file (default = w2ps.ps)
|
---|
995 | should be closed before being used. Exiting piapp closes automatically
|
---|
996 | all postscript files.
|
---|
997 | \item {\tt psclosefile} \myppageref{psclosefile} to close the current
|
---|
998 | output postscript file.
|
---|
999 | \item {\tt pssetfilename} \myppageref{pssetfilename} To define
|
---|
1000 | the output postscript file name for the subsequent {\tt w2ps} commands.
|
---|
1001 | \item {\tt w2eps} \myppageref{w2eps} to export the current
|
---|
1002 | graphic display, in Encapsulated Postscript format to the specified file.
|
---|
1003 | \begin{verbatim}
|
---|
1004 | # Open the PPF file created by the commands above
|
---|
1005 | openppf vecab.ppf
|
---|
1006 | # Display one of the vectors
|
---|
1007 | setaxesatt 'font=helvetica,bold,18 fixedfontsize'
|
---|
1008 | disp va1 'blue marker=box,5'
|
---|
1009 | # Export the graphic to file va1.eps
|
---|
1010 | w2eps va1.eps
|
---|
1011 | # The created file can be viewed using gv
|
---|
1012 | \end{verbatim}
|
---|
1013 | \end{itemize}
|
---|
1014 |
|
---|
1015 | %%%%%%%%%%%%%%% Section 5 : analyse a la paw
|
---|
1016 | \newpage
|
---|
1017 | \section{Tables and Expression Plotting}
|
---|
1018 | \label{tableplot}
|
---|
1019 | A powerful data analysis technic available in piapp is
|
---|
1020 | 2D, 3D plot, and histogramming applied to arbitrary analytical
|
---|
1021 | expression of table columns.
|
---|
1022 | This analysis technic has been introduced by the popular
|
---|
1023 | CERN \href{http://paw.web.cern.ch/paw/}{\bf PAW}
|
---|
1024 | ({\bf P}hysics {\bf A}nalysis {\bf Workstation})
|
---|
1025 | \footnote{PAW home page : http://paw.web.cern.ch/paw/ } program
|
---|
1026 | and the underlying HBOOK fortran library.
|
---|
1027 | Compared to PAW, piapp extends in many respects this capability,
|
---|
1028 | piapp offers in particular the possibility to manipulate many
|
---|
1029 | objects as if they where a DataTable, or NTuple.
|
---|
1030 | There are also additional 2D and 3D representations e.g.
|
---|
1031 | {\tt plot2de} \myppageref{plot2de},
|
---|
1032 | {\tt plot2dw} \myppageref{plot2dw},
|
---|
1033 | {\tt plot2dc} \myppageref{plot2dc} and
|
---|
1034 | {\tt plot3dw} \myppageref{plot3dw}.
|
---|
1035 |
|
---|
1036 | \subsection{How does it work ?}
|
---|
1037 |
|
---|
1038 | The Expression.Plotting commands in piapp operate on objects through the
|
---|
1039 | {\bf NTupleInterface} class methods. Some classes like NTuple or BaseDataTable
|
---|
1040 | inherit from NTupleInterface, while for the other classes, the corresponding
|
---|
1041 | NObjMgrAdapter class exposes an object conforming to NTupleInterface through the
|
---|
1042 | method : \\
|
---|
1043 | \hspace*{5mm} {\tt NTupleInterface* NObjMgrAdapter::GetNTupleInterface()} \\
|
---|
1044 | A C file (PIATmp\_xxx/expf\_pia\_dl.c) is created by piapp containing the
|
---|
1045 | specified expressions, which should conform to the C-language syntax.
|
---|
1046 | In addition to the functions in {\tt math.h} (sin, cos, log \ldots),
|
---|
1047 | the following functions are defined by piapp and can be used:
|
---|
1048 | \begin{itemize}
|
---|
1049 | \item Flat random number generators: {\tt drand01() , drandpm1() }
|
---|
1050 | \item Gaussian random number generator: {\tt GauRand() }
|
---|
1051 | \item Angle conversion: {\tt deg2rad(double d), rad2deg(double r) }
|
---|
1052 | \item $(\theta,\varphi)$ to Molleweide X,Y projection: \\
|
---|
1053 | \hspace*{5mm}{\tt double tetphi2mollX(double theta, double phi)} \\
|
---|
1054 | \hspace*{5mm}{\tt double tetphi2mollY(double theta)}
|
---|
1055 | \item Longitude(0..360) deg., Latitude(-90..90) deg. conversion to Molleweide X,Y: \\
|
---|
1056 | \hspace*{5mm}{\tt double longlat2mollX(double longit, double lat) } \\
|
---|
1057 | \hspace*{5mm}{\tt double longlat2mollY(double lat) }
|
---|
1058 | \end{itemize}
|
---|
1059 |
|
---|
1060 | The processing steps for an Expression.Plotting in piapp :
|
---|
1061 | \begin{enumerate}
|
---|
1062 | \item Creation of the C-file.
|
---|
1063 | \item On the fly compilation of the generated file.
|
---|
1064 | \item The resulting shared-object is loaded and linked with the application
|
---|
1065 | \item Loop over the NTupleInterface object rows. The created function is called
|
---|
1066 | with the data from each row
|
---|
1067 | \item The return values are used to fill an histogram, or a matrix/vector or
|
---|
1068 | another NTuple or to produce a 2D or 3D graphic display.
|
---|
1069 | \end{enumerate}
|
---|
1070 |
|
---|
1071 | Although rather complex, the efficiency gain during processing data easily compensates
|
---|
1072 | for the overhead of the compilation step.
|
---|
1073 |
|
---|
1074 | \subsection{Column/variable names}
|
---|
1075 |
|
---|
1076 | When working with real 2-D tables (NTuple, DataTable \ldots), the column names
|
---|
1077 | are the name of the variables which can be used in the C-expressions.
|
---|
1078 | There is an additional variable, called {\tt \_nl}, automatically
|
---|
1079 | provided by piapp, corresponding the table row number, starting from 0.
|
---|
1080 |
|
---|
1081 | For the other objects in piapp, the variable names are listed below:
|
---|
1082 | \begin{itemize}
|
---|
1083 | \item[\rond] For 2D table objects {\bf (NTuple,DataTable,\ldots)}: ColumnNames,\_nl
|
---|
1084 | \item[\rond] For FITS files opened through {\tt fitsadapt} command: FITSColumnNames,\_nl
|
---|
1085 | \item[\rond] For {\bf Histo1D/HProf} objects : i,x,val,err,nb,\_nl
|
---|
1086 | \item[\rond] For {\bf Histo2D} objects : i,j,x,y,val,err,\_nl
|
---|
1087 | \item[\rond] For {\bf HistoErr} objects : i,x,val,err2,nb,\_nl
|
---|
1088 | \item[\rond] For {\bf Histo2DErr} objects : i,j,x,y,val,err2,nb,\_nl
|
---|
1089 | \item[\rond] For {\bf \tcls{TVector}, \tcls{TMatrix} , \tcls{Image} } objects : \\
|
---|
1090 | \hspace*{10mm} n,r,c,val,real,imag,mod,phas,\_nl
|
---|
1091 | \item[\rond] For {\bf \tcls{TArray}} objects : n,x,y,z,t,u,val,real,imag,mod,phas,\_nl
|
---|
1092 | \item[\rond] For {\bf GeneralFitData} objects : x0,ex0 x1,ex1 ... xn,exn y,ey ,ok,\_nl
|
---|
1093 | \item[\rond] For {\bf \tcls{SphereHEALPix} , \tcls{SphereThetaPhi} , \tcls{SphereECP}
|
---|
1094 | \tcls{LocalMap} } objects : \hspace{10mm} i,k,val,real,imag,mod,phas,teta,phi,\_nl
|
---|
1095 | \end{itemize}
|
---|
1096 |
|
---|
1097 | %%%%%%%%%%%%%%% Section 6 : command interpreter
|
---|
1098 | \newpage
|
---|
1099 | \section{Command interpreter}
|
---|
1100 | piapp uses the class {\bf PIACmd} which extends slightly the
|
---|
1101 | SOPHYA class {\bf Commander} as the command interpreter.
|
---|
1102 | {\bf Commander} is a c-shell inspired, string oriented command
|
---|
1103 | interpreter. Although it has many limitations compared to
|
---|
1104 | c-shell, or Tcl , it provides some interesting possibilities:
|
---|
1105 | \begin{itemize}
|
---|
1106 | \item Extended arithmetic operations (c-like and RPN)
|
---|
1107 | \item Simple and vector variables
|
---|
1108 | \item Script definition
|
---|
1109 | \item Command execution in separate threads
|
---|
1110 | \item Dynamic Load
|
---|
1111 | \end{itemize}
|
---|
1112 |
|
---|
1113 | We describe below the {\bf Commander} possibilities,
|
---|
1114 | as well as the few {\bf PIACmd} extensions.
|
---|
1115 |
|
---|
1116 | \subsection{Variables}
|
---|
1117 | The SOPHYA::Commander interpreter manages non typed set of variables.
|
---|
1118 | Environment variables are also accessible through
|
---|
1119 | the usual {\tt \$varenvname}, unless shadowed by a Commander
|
---|
1120 | variable. All Commander variables are vector of strings, and are
|
---|
1121 | extended as necessary. {\tt \$varname} is the string formed by all
|
---|
1122 | the vector elements. Except when performing arithmetic operations,
|
---|
1123 | variables are treated as strings.
|
---|
1124 | \par
|
---|
1125 | An application level set of variables is also managed
|
---|
1126 | by Commander, through redefinition of \\
|
---|
1127 | {\tt Commander::GetVarApp() / GetVarApp() \ldots } methods. \\
|
---|
1128 | The {\bf PIACmd} in piapp redefines the {\tt GetVarApp() }
|
---|
1129 | in order to provide an easy access to some of objects attributes or methods,
|
---|
1130 | managed by {\bf NamedObjMgr} (See below).
|
---|
1131 |
|
---|
1132 | \subsubsection{Interpreter/Commander variables}
|
---|
1133 | \begin{itemize}
|
---|
1134 | \item[\rond] {\bf Definition and initialisation of variables }
|
---|
1135 | \begin{verbatim}
|
---|
1136 | # Notice that the set command has no = sign
|
---|
1137 | Cmd> set sv StringValue
|
---|
1138 | # Clearing/removing of a variable : unset or clearvar
|
---|
1139 | Cmd> unset sv
|
---|
1140 |
|
---|
1141 | # Definition of a multi element variable (vector type)
|
---|
1142 | # Notice that spaces before / after '(' and ')' are mandatory
|
---|
1143 | Cmd> set vecv ( mot1 mot2 mot3 mot4 mot5 )
|
---|
1144 | # Arithmetic expression : C language syntax - spaces
|
---|
1145 | # before/after '=' are mandatory
|
---|
1146 | Cmd> a = 2+3*sqrt(4)
|
---|
1147 | # The '=' operator can also be used to initialize a variable with a string
|
---|
1148 | Cmd> a = 'Bonjour Madame'
|
---|
1149 | # A vector element can be specified in the left hand side
|
---|
1150 | Cmd> vecv[2] = 'coucou'
|
---|
1151 | # Or using an interpreter variable as index :
|
---|
1152 | Cmd> i = 3
|
---|
1153 | Cmd> vecv[i] = 'Ooohhh'
|
---|
1154 | \end{verbatim}
|
---|
1155 |
|
---|
1156 | On the right hand side, the value of a variable should be accessed using
|
---|
1157 | the \$ character. \\
|
---|
1158 | A string can be parsed into words using {\tt var2words}
|
---|
1159 | \begin{verbatim}
|
---|
1160 | Cmd> var2words varname wordvarname [separateur]
|
---|
1161 | \end{verbatim}
|
---|
1162 |
|
---|
1163 | \item[\rond] {\bf Accessing variable contents } \\
|
---|
1164 | The \$ character is used to access the content of a variable {\tt \$varname} .
|
---|
1165 | Substitution rules :
|
---|
1166 | The {\tt \$xxx} is replaced by the value of variable xxx.
|
---|
1167 | No substitution is performed for strings enclosed in simple quotes {\tt ' ... \$xxx '},
|
---|
1168 | but substitution is done in strings enclosed in double quotes.
|
---|
1169 | Parenthesis or brackets can be used to specify the variable name, inside a string
|
---|
1170 | without white space: {\tt \${vname} } ou {\tt \$(vname)}.
|
---|
1171 | \begin{verbatim}
|
---|
1172 | Cmd> x = 'Hello'
|
---|
1173 | Cmd> echo $x
|
---|
1174 | # Size of a vector variable : $#vname
|
---|
1175 | Cmd> set vx ( 111 2222 3333 444444 )
|
---|
1176 | Cmd> echo $#vx
|
---|
1177 | # Accessing vector elements
|
---|
1178 | Cmd> echo $vx[0] $vx[1]
|
---|
1179 | # or using an interpreter variable as index :
|
---|
1180 | Cmd> i = 2
|
---|
1181 | Cmd> echo $vx[i]
|
---|
1182 | # Special syntax: $[vname] is replaced by the content
|
---|
1183 | # of a variable whose name is $vname
|
---|
1184 | Cmd> zzz = 'Commander'
|
---|
1185 | Cmd> xxx = 'zzz'
|
---|
1186 | Cmd> echo '---> $[xxx]= ' $[xxx]
|
---|
1187 | ---> $[xxx]= Commander
|
---|
1188 | \end{verbatim}
|
---|
1189 |
|
---|
1190 | \par
|
---|
1191 | \end{itemize}
|
---|
1192 |
|
---|
1193 | \subsubsection{Special variables}
|
---|
1194 | \begin{itemize}
|
---|
1195 | \item {\tt \$retval} ou {\tt \$retstr} : the string specified in the last {\bf return} statement
|
---|
1196 | \item {\tt \$status} : Return code from the last executed command.
|
---|
1197 | Arguments of scripts (see below) or file executed through {\bf exec} command.
|
---|
1198 | \item {\tt \$\# } : number of arguments, except \$0
|
---|
1199 | \item {\tt \$0} : Script or file name
|
---|
1200 | \item {\tt \$1 \$2 \$3} .... : Arguments (for scripts and .pic files (exec))
|
---|
1201 | \end{itemize}
|
---|
1202 |
|
---|
1203 | \subsubsection{Environment variables}
|
---|
1204 | Environment variables can simply be accessed by {\tt \$varenvname}.
|
---|
1205 | However, the environment variables have the lowest priority during substitution.
|
---|
1206 | Interpreter's variables have the highest priority, followed
|
---|
1207 | by the application level variables.
|
---|
1208 |
|
---|
1209 | \subsubsection{Objects/Application level variables}
|
---|
1210 | For some classes managed by NamedObjMgr,
|
---|
1211 | PIACmd provide acces to some of the attributes of the object by
|
---|
1212 | {\tt \${objname.attname} }. This mechanism has been implemented in particular for
|
---|
1213 | TArrays, TMatrix/TVector, Histograms, NTuples and DataTables.
|
---|
1214 | In addition, when brackets are used ($\${vname}$), the priority level between interpreter variables
|
---|
1215 | and application level variable is changed. If {\tt vname} exist at the application level,
|
---|
1216 | {\tt \${vname} } is replaced by its value, even if an interpreter variable with the
|
---|
1217 | same name has been defined.
|
---|
1218 | \begin{itemize}
|
---|
1219 | \item[\rond] Accessing object attributes
|
---|
1220 | \begin{verbatim}
|
---|
1221 | # -------- Example with a Vector
|
---|
1222 | piapp[1] newvec va 12
|
---|
1223 | piapp[2] echo $va
|
---|
1224 | TVector<d>(12) (nr=12, nc=1)
|
---|
1225 | # ------- An undefined attribute, such as ? might be
|
---|
1226 | # used to get list of valid attributes
|
---|
1227 | piapp[3] echo ${va.?}
|
---|
1228 | TMatrix.Att: rank size/nelts nrow/nrows ncol/ncols sum sumsq norm min ...
|
---|
1229 | # Compound names, in the form name.att must be inclosed in
|
---|
1230 | # braces {name.att}
|
---|
1231 | piapp[4] echo ${va.size}
|
---|
1232 | 12
|
---|
1233 | # -------- Example with an histogram
|
---|
1234 | piapp[8] newh1d his 0. 20. 40
|
---|
1235 | piapp[10] echo ${his.?}
|
---|
1236 | Histo1D: nbin binw mean sigma over under nentries ndata
|
---|
1237 | xmin xmax vmin vmax imin imax
|
---|
1238 | piapp[11] echo ${his.nbin}
|
---|
1239 | 40
|
---|
1240 | \end{verbatim}
|
---|
1241 |
|
---|
1242 | \item[\rond] Accessing object.Info() \\
|
---|
1243 | For objects having an DVList Info() object (TArray/TVector/TMatrix , NTuple, DataTable, SwPPFDataTable, it is possible to access DVList members by the corresponding names : \\
|
---|
1244 | \hspace*{10mm} {\tt \$\{objName.info.varName\} }
|
---|
1245 | \item[\rond] Getting DataTable rows \\
|
---|
1246 | For NTuple and BaseDataTable objects (DataTable, SwPPFDataTable, SwFitsDataTable), it is
|
---|
1247 | possible to get a string representation of a given row, by specifying
|
---|
1248 | \$\{tableName.row\} followed by the row number (starting from 0) : \\
|
---|
1249 | \hspace*{10mm} {\tt \$\{tableName.row.num\} }
|
---|
1250 | \end{itemize}
|
---|
1251 |
|
---|
1252 |
|
---|
1253 |
|
---|
1254 | \subsection{Control structures}
|
---|
1255 |
|
---|
1256 | \begin{itemize}
|
---|
1257 | \item[\rond] Enumerated loop:
|
---|
1258 | \begin{verbatim}
|
---|
1259 | foreach f ( w1 w2 w3 ... )
|
---|
1260 | ...
|
---|
1261 | echo $f
|
---|
1262 | end
|
---|
1263 | \end{verbatim}
|
---|
1264 |
|
---|
1265 | Note that spaces before/after '(' et and ')' are mandatory.
|
---|
1266 | An alternative form uses a vector variable name :
|
---|
1267 | \begin{verbatim}
|
---|
1268 | foreach v vecname
|
---|
1269 | ...
|
---|
1270 | echo $v
|
---|
1271 | end
|
---|
1272 | \end{verbatim}
|
---|
1273 |
|
---|
1274 | \item[\rond] Integer type loop:
|
---|
1275 | \begin{verbatim}
|
---|
1276 | for i startInt:endInt[:stepInt]
|
---|
1277 | ....
|
---|
1278 | echo $i
|
---|
1279 | end
|
---|
1280 | \end{verbatim}
|
---|
1281 |
|
---|
1282 | \item[\rond] Integer type loop:
|
---|
1283 | \begin{verbatim}
|
---|
1284 | for f startFloat:endFloat[:stepFloat]
|
---|
1285 | ....
|
---|
1286 | echo $f
|
---|
1287 | end
|
---|
1288 | \end{verbatim}
|
---|
1289 |
|
---|
1290 | \item[\rond] Loop over lines of a file
|
---|
1291 | \begin{verbatim}
|
---|
1292 | forinfile line FileName
|
---|
1293 | ...
|
---|
1294 | echo $line
|
---|
1295 | end
|
---|
1296 | \end{verbatim}
|
---|
1297 |
|
---|
1298 | \item[\rond] The {\tt break} instruction can be used to exit from a loop
|
---|
1299 |
|
---|
1300 | \item[\rond] {\bf if then else} Conditional execution:
|
---|
1301 | \begin{verbatim}
|
---|
1302 | if ( test ) then
|
---|
1303 | endif
|
---|
1304 |
|
---|
1305 | if ( test ) then
|
---|
1306 | ....
|
---|
1307 | else
|
---|
1308 | ....
|
---|
1309 | endif
|
---|
1310 | \end{verbatim}
|
---|
1311 | Note that spaces before/after '(' et and ')' are mandatory.
|
---|
1312 |
|
---|
1313 | test is in the form {\tt a == b} OR {\tt a != b} OR {\tt a < b} OR {\tt a > b}
|
---|
1314 | OR {\tt a <= b} OR {\tt a >= b}. Comparison operators should be delimited
|
---|
1315 | by spaces.
|
---|
1316 | {\tt ==} et {\tt !=} make a string comparison, while
|
---|
1317 | {\tt < , > , <= , >=} compare the values obtained after string to double conversion.
|
---|
1318 | \end{itemize}
|
---|
1319 |
|
---|
1320 | \subsection{Script definition}
|
---|
1321 | A script is a sequence of commands. It is very similar to the execution of commands
|
---|
1322 | from a file ({\bf exec filename}). Once a script has been defined, it can be called specifying
|
---|
1323 | specifying the script name followed by its arguments.
|
---|
1324 | \begin{verbatim}
|
---|
1325 | # Script definition :
|
---|
1326 | defscript scriptname [description ]
|
---|
1327 | ....
|
---|
1328 | endscript
|
---|
1329 |
|
---|
1330 | # Executing the script
|
---|
1331 | Cmd> scriptname arg1 arg2 arg3 ....
|
---|
1332 | \end{verbatim}
|
---|
1333 |
|
---|
1334 | The {\tt return} instruction stops the execution and returns from a script, or from a command
|
---|
1335 | file called through {\bf exec}. \\
|
---|
1336 | The commands {\bf listscript } and {\bf clearscript scriptname} can be used
|
---|
1337 | to obtain the list of already defined script, or to clear a script definition.
|
---|
1338 |
|
---|
1339 | \subsection{Other built-in commands}
|
---|
1340 | \begin{itemize}
|
---|
1341 | \item[\rond] Instruction {\bf echo } to write the line to cout/stdout
|
---|
1342 | \item[\rond] Instruction {\bf echo2file} to write (append) the line to file ({\tt echo2file filename ....})
|
---|
1343 | \item[\rond] Instruction {\bf sleep nsec} wait for {\tt nsec} seconds
|
---|
1344 | \item[\rond] Instructions {\bf timingon , timingoff , traceon , traceoff } \\
|
---|
1345 | %
|
---|
1346 | \item[\rond] {\bf exec filename [arg1 arg2 ... ] } to execute command from
|
---|
1347 | the file named {\tt filename}. {\tt .pic} is the default extension for the interpreter
|
---|
1348 | command files.
|
---|
1349 | \item[\rond] {\bf help} and {help keyword/commandname }
|
---|
1350 | \item[\rond] {\bf listvars , listcommands } to print the list of defined variables and known
|
---|
1351 | commands
|
---|
1352 | \item[\rond] An alias for a command by {\bf alias aliasname 'string ' }. Alias substitution
|
---|
1353 | occurs for the first word in a command line. {\bf listalias} prints the list of all
|
---|
1354 | defined aliases.
|
---|
1355 | \item[\rond] Execution control (piapp/PIACmd extension):
|
---|
1356 | It is possible to stop the interpreter execution in a loop, a script or
|
---|
1357 | a command file by the {\bf stop} command, or using
|
---|
1358 | {\tt <Cntrl C>} in the piapp console (PIConsole) \\
|
---|
1359 | \end{itemize}
|
---|
1360 |
|
---|
1361 | \subsection {Command execution in separate threads}
|
---|
1362 | It is possible to create new threads to execute commands
|
---|
1363 | ( for non built-in interpreter commands). The syntax is similar
|
---|
1364 | to unix shell background tasks: an {\&} should be added at the end
|
---|
1365 | of the command line. A new thread is then created for the
|
---|
1366 | execution of the command, if declared as thread safe \\
|
---|
1367 | (see {\tt CmdExecutor::IsThreadable() }.
|
---|
1368 | \par
|
---|
1369 | Thread management commands:
|
---|
1370 | \begin{itemize}
|
---|
1371 | \item[\rond] {\bf thrlist }Print current list of threads, with the associated command
|
---|
1372 | the thread identifier (integer ThrId) and its status.
|
---|
1373 | \item[\rond] {\bf cleanthrlist } Removes all finished threads from the list.
|
---|
1374 | An automatic cleanup is performed periodically.
|
---|
1375 | \item[\rond] {\bf cancelthr ThId } / {\bf killthr ThId } Stops/kills the thread with
|
---|
1376 | the identifier ThId. Avoid using theses commands as the cleanup does
|
---|
1377 | not release some resources associated with
|
---|
1378 | the thread (memory, mutex \ldots).
|
---|
1379 | \end{itemize}
|
---|
1380 |
|
---|
1381 | Executing commands in a separate thread is useful for CPU or data intensive
|
---|
1382 | commands. Most {\bf Expr.Plotting}
|
---|
1383 | (plot2d, plot2dw, plot2de, plot3d, ntloop, fillvec, fillmtx \ldots)
|
---|
1384 | and some of the {\bf pawCmd} (n/plot n/proj) are thread safe. However, due to the
|
---|
1385 | current mutex lock management for these Expr.Plotting/pawCmd commands, only one
|
---|
1386 | such command can run concurrently with other piapp threads.
|
---|
1387 | Some of the commands in the {\bf CxxExecutorCmd} (
|
---|
1388 | c++exec, c++execfrf, c++create, c++createfrf, c++compile, c++link) are also thread safe.
|
---|
1389 | The same remark concerning lock management applies to these commands, while
|
---|
1390 | CxxExecutorCmd commands can run in parallel with Expr.Plotting commands.
|
---|
1391 |
|
---|
1392 |
|
---|
1393 | %%%%%%%%%%%%%%% Section 7 : c++ execution
|
---|
1394 | \newpage
|
---|
1395 | \section{On the fly C++ execution}
|
---|
1396 |
|
---|
1397 | %%%%%%%%%%%%%%% Section 8 : command reference
|
---|
1398 | \newpage
|
---|
1399 | \section{piapp command reference}
|
---|
1400 | \label{piappcmdref}
|
---|
1401 | This section contains the description of piapp commands. This information
|
---|
1402 | is available on-line, through the help command, or through a graphic
|
---|
1403 | window, accessible by \menubar{File / Help}.
|
---|
1404 | The help items and command are divided into different sections,
|
---|
1405 | where related commands are grouped. \\[10mm]
|
---|
1406 |
|
---|
1407 | % \include{piahelp}
|
---|
1408 | \input{piahelp.tex}
|
---|
1409 |
|
---|
1410 | % La partie des appendix
|
---|
1411 | \appendix
|
---|
1412 | \newpage
|
---|
1413 | \section{Interactive control windows}
|
---|
1414 | \subsection{DrawerTools} \index{DrawerTools}
|
---|
1415 | \label{secdrwtools}
|
---|
1416 | The {\bf PIDrawerTools}, shown in the figure \ref{figdrwtools} can be
|
---|
1417 | used to change the graphic attributes (color, font, marker, \ldots)
|
---|
1418 | of the Drawers displayed in 2D displays
|
---|
1419 | ({\bf PIScDrawWdg} \myppageref{PIScDrawWdg}) or 3D displays
|
---|
1420 | ({\bf PIDraw3DWdg} \myppageref{PIDraw3DWdg}), as well in image displays
|
---|
1421 | {\bf PIImage} (\myppageref{PIImage}). The PIDrawerTools can be activated
|
---|
1422 | either using {\tt Alt<G>} on a PIScDrawWdg,PIDraw3DWdg,PIImage,
|
---|
1423 | or through the \menubar{Tools/Show DrawerTools}.
|
---|
1424 | A given drawer can be selected through the DrawerId selector (+ / - buttons)
|
---|
1425 |
|
---|
1426 | \vspace*{5mm}
|
---|
1427 | \begin{figure}[ht!]
|
---|
1428 | \begin{center}
|
---|
1429 | \includegraphics[width=8cm]{piapp_drwtools.eps}
|
---|
1430 | \caption{PIDrawerTools}
|
---|
1431 | \label{figdrwtools}
|
---|
1432 | \end{center}
|
---|
1433 | \end{figure}
|
---|
1434 | %%%%
|
---|
1435 | \subsection{AxesTools} \index{AxesTools}
|
---|
1436 | \label{secaxestools}
|
---|
1437 | The {\bf PIAxesTools}, shown in the figure \ref{figaxestools} can be used to
|
---|
1438 | control and change the setting of axes on 2D displays
|
---|
1439 | ({\bf PIScDrawWdg} \myppageref{PIScDrawWdg}).
|
---|
1440 | The PIAxesTools can be activated
|
---|
1441 | either using {\tt Alt<A>} on a PIScDrawWdg or through
|
---|
1442 | the \menubar{Tools/Show AxesTools}.
|
---|
1443 |
|
---|
1444 | \vspace*{5mm}
|
---|
1445 | \begin{figure}[ht!]
|
---|
1446 | \begin{center}
|
---|
1447 | \includegraphics[width=8cm]{piapp_axestools.eps}
|
---|
1448 | \caption{PIAxesTools}
|
---|
1449 | \label{figaxestools}
|
---|
1450 | \end{center}
|
---|
1451 | \end{figure}
|
---|
1452 | %%%%%
|
---|
1453 | \subsection{ImageTools} \index{ImageTools}
|
---|
1454 | \label{secimagetools}
|
---|
1455 | The {\bf PIImageTools}, shown in the figure \ref{figimgtools} can be used to
|
---|
1456 | manipulate a display of type image. Image display are handled by the
|
---|
1457 | {\bf PIImage} (\myppageref{PIImage}). The PIImageTools can be activated
|
---|
1458 | either using {\tt Alt<O>} on a PIImage, or through the
|
---|
1459 | \menubar{Tools/Show ImageTools}.
|
---|
1460 |
|
---|
1461 | \vspace*{5mm}
|
---|
1462 | \begin{figure}[ht!]
|
---|
1463 | \begin{center}
|
---|
1464 | \includegraphics[width=8cm]{piapp_imgtools.eps}
|
---|
1465 | \caption{PIImageTools}
|
---|
1466 | \label{figimgtools}
|
---|
1467 | \end{center}
|
---|
1468 | \end{figure}
|
---|
1469 |
|
---|
1470 | \subsection{Histo2DTools} \index{Histo2DTools}
|
---|
1471 | \label{sech2dtools}
|
---|
1472 | The {\bf PIHisto2DTools}, shown in the figure \ref{figh2dtools} can be
|
---|
1473 | used to control and change the display caracteristics of 2D histograms.
|
---|
1474 | PIHisto2DTools can be activated
|
---|
1475 | either using {\tt Alt<O>} on a PIScDrawWdg, when the active
|
---|
1476 | drawer is a PIHisto2DDrawer, or through the generic drawer tool
|
---|
1477 | PIDrawerTools.
|
---|
1478 |
|
---|
1479 | \vspace*{5mm}
|
---|
1480 | \begin{figure}[ht!]
|
---|
1481 | \begin{center}
|
---|
1482 | \includegraphics[width=8cm]{piapp_h2dtools.eps}
|
---|
1483 | \caption{PIHisto2DTools}
|
---|
1484 | \label{figh2dtools}
|
---|
1485 | \end{center}
|
---|
1486 | \end{figure}
|
---|
1487 |
|
---|
1488 | \subsection{ContourTools} \index{ContourTools}
|
---|
1489 | \label{secconttools}
|
---|
1490 | The {\bf PIContourTools}, shown in the figure \ref{figconttools} can be
|
---|
1491 | used to control and change the caracteristics of contour displays.
|
---|
1492 | PIContourTools can be activated
|
---|
1493 | either using {\tt Alt<O>} on a PIScDrawWdg, when the active
|
---|
1494 | drawer is a PIContDrawer, or through the generic drawer tool
|
---|
1495 | PIDrawerTools.
|
---|
1496 |
|
---|
1497 | \vspace*{10mm}
|
---|
1498 | \begin{figure}[ht!]
|
---|
1499 | \begin{center}
|
---|
1500 | \includegraphics[width=11cm]{piapp_conttools.eps}
|
---|
1501 | \caption{PIContourTools}
|
---|
1502 | \label{figconttools}
|
---|
1503 | \end{center}
|
---|
1504 | \end{figure}
|
---|
1505 |
|
---|
1506 |
|
---|
1507 |
|
---|
1508 | Both drawing options (e.g. color, line type, fonts...) and contour
|
---|
1509 | determination parameters (e.g. contour number and levels) are controlled
|
---|
1510 | by {\bf PIContourTools}.
|
---|
1511 |
|
---|
1512 | \subsubsection{Drawing options}
|
---|
1513 | The top choices in {\bf PIContourTools}
|
---|
1514 | concern the color map (left choice) or color (right choice) of the contours.
|
---|
1515 | If a color map has been chosen, it is used to give each contour a color
|
---|
1516 | (according to its level). If no color map has been chosen, contours may be
|
---|
1517 | given a color using the left choice box.
|
---|
1518 |
|
---|
1519 | Contour are by default traced by lines.
|
---|
1520 | Alternatively (or in addition) the user may ask to trace them by markers
|
---|
1521 | or to put numeric labels (with the contour's level) aside the contour.
|
---|
1522 | These options are enabled/disabled by the {\tt LineON}, {\tt MarkerON} and {\tt LabelON}
|
---|
1523 | buttons from {\bf PIContourTools}.
|
---|
1524 |
|
---|
1525 | Options may be recovered ({\tt GetAtt}) or set ({\tt SetAtt})
|
---|
1526 | from/to a drawer. Setting an option which adds to the screen will be immediately visible
|
---|
1527 | whereas unsetting it requires a {\tt Refresh} to be visible.
|
---|
1528 |
|
---|
1529 |
|
---|
1530 | \subsubsection{Contour options}
|
---|
1531 | The contouring routines in {\tt spiapp} are based on a hack of the {\tt GNUPlot}
|
---|
1532 | routines. Contours are determined from a grid of values
|
---|
1533 | using an interpolation scheme. Three schemes may be used
|
---|
1534 | (selected by the left menu) :
|
---|
1535 | \begin{enumerate}
|
---|
1536 | \item Linear interpolation (default), selected by the {\tt Int. Lin.} option
|
---|
1537 | \item A cubic spline algorithm, selected by the {\tt CubicSpl} option
|
---|
1538 | \item A 2d BSpline algorihm, selected by the {\tt B-Spline} option
|
---|
1539 | \end{enumerate}
|
---|
1540 |
|
---|
1541 | Contour levels and number are automatically
|
---|
1542 | determined by the program. They may be specified differently,
|
---|
1543 | through command-line options
|
---|
1544 | (see section \ref{piappcmdref} for the help of the contour/ntcont commands)
|
---|
1545 | or the lower part of the {\bf PIContourTools} window.
|
---|
1546 |
|
---|
1547 | The user may specify one of the following alternatives :
|
---|
1548 | \begin{enumerate}
|
---|
1549 | \item the number of contour (their level beeing automatically set).
|
---|
1550 | To do this, select {\tt LevelNum} in the right menu and enter the contour number
|
---|
1551 | in the left box below.
|
---|
1552 | \item the levels of the contours, through an array of numerical values
|
---|
1553 | (e.g. 1,4,6,9,27,4.5 will result in 6 contour lines being drawn, if possible and necessary).
|
---|
1554 | To do this, select {\tt LevelDisc} and enter the contour number (left box)
|
---|
1555 | and the values (right box) separated by ``{\tt ,}''.
|
---|
1556 | \item the levels of the contours through an initial (lower) value and an increment.
|
---|
1557 | For this, select {\tt LevelInc} and enter the contour number (left box)
|
---|
1558 | and the initial value and increment in the right box, as above.
|
---|
1559 | \item come back to the default situation, by choosing {\tt LevelAuto}
|
---|
1560 | \end{enumerate}
|
---|
1561 |
|
---|
1562 | Once these options are set, it is necessary the the program recomputes
|
---|
1563 | the contour lines. This is commanded by the {\tt SetParm} button.
|
---|
1564 |
|
---|
1565 |
|
---|
1566 | \newpage
|
---|
1567 | \addcontentsline{toc}{section}{Index}
|
---|
1568 | \printindex
|
---|
1569 |
|
---|
1570 | \end{document}
|
---|