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