[3041] | 1 | \documentclass[twoside,10pt]{article}
|
---|
[2384] | 2 | % \usepackage[latin1]{inputenc}
|
---|
| 3 | % \usepackage[T1]{fontenc}
|
---|
[2171] | 4 | \usepackage[francais]{babel}
|
---|
| 5 | \usepackage{graphicx}
|
---|
| 6 |
|
---|
[2384] | 7 | \usepackage{amsmath}
|
---|
| 8 | \usepackage{amssymb}
|
---|
| 9 | \usepackage{latexsym}
|
---|
| 10 |
|
---|
[2171] | 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 |
|
---|
[3429] | 24 | \setlength{\textwidth}{15cm}
|
---|
| 25 | \setlength{\textheight}{20.5cm}
|
---|
| 26 | \setlength{\topmargin}{0.cm}
|
---|
[2171] | 27 | \setlength{\oddsidemargin}{0.cm}
|
---|
| 28 | \setlength{\evensidemargin}{0.cm}
|
---|
| 29 | \setlength{\unitlength}{1mm}
|
---|
| 30 |
|
---|
[2384] | 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 |
|
---|
[3041] | 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
|
---|
[2171] | 44 | \newcommand{\piacommand}[1]{
|
---|
[2384] | 45 | $\blacksquare$ \hspace{3mm} {\bf \Large #1 } \index{#1} % (Command)
|
---|
[2171] | 46 | }
|
---|
| 47 | \newcommand{\piahelpitem}[1]{
|
---|
[2384] | 48 | $\square$ \hspace{3mm} {\bf \Large #1 } \index{#1} (Help item)
|
---|
[2171] | 49 | }
|
---|
| 50 |
|
---|
[3041] | 51 | \newcommand{\menubar}[1]{\hspace{1mm} \framebox{\it MenuBar::#1} \hspace{1mm}}
|
---|
| 52 |
|
---|
[2171] | 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}
|
---|
[3429] | 74 | {\bf \Large piapp Version: 4.1 (V\_Nov2007) }
|
---|
[2171] | 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
|
---|
[3041] | 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 | %%%
|
---|
[3429] | 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}
|
---|
[3041] | 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
|
---|
[2171] | 136 | arguments. Xtoolkit options can also be specified as command line
|
---|
[3041] | 137 | arguments. {\bf spiapp} is the name of SOPHYA/piapp executable,
|
---|
| 138 | in order to distinguish it from PEIDA/piapp.
|
---|
[2171] | 139 | \begin{verbatim}
|
---|
| 140 | csh> spiapp -h
|
---|
[3041] | 141 | SophyaInitiator::SophyaInitiator() BaseTools Init
|
---|
| 142 | PIOPersist::Initialize() Starting Sophya Persistence management service
|
---|
[3429] | 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)
|
---|
[3041] | 145 | piapp: Interactive data analysis and visualisation program
|
---|
[3429] | 146 | Usage: piapp [-nored] [-doublered] [-termread] [-term]
|
---|
| 147 | [-hidezswin] [-small] [-nosig] [-nosigfpe] [-nosigsegv]
|
---|
[3041] | 148 | [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]]
|
---|
| 149 | -nored : Don't redirect stdout/stderr to piapp console
|
---|
[3429] | 150 | -doublered : Redirect stdout/stderr to piapp console AND the terminal
|
---|
[3041] | 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
|
---|
[2171] | 158 | -help2tex: Create a LaTeX help file (piahelp.tex)
|
---|
[3041] | 159 | -exec file [args] : Execute command file (last option)
|
---|
[2171] | 160 | \end{verbatim}
|
---|
[3041] | 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}
|
---|
[2171] | 166 | shows an image of the piapp main window.
|
---|
[3041] | 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
|
---|
[3429] | 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
|
---|
[2171] | 177 |
|
---|
[3041] | 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.
|
---|
[2171] | 185 |
|
---|
| 186 |
|
---|
| 187 | \newpage
|
---|
| 188 | \section{A Tour of piapp}
|
---|
[3041] | 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 |
|
---|
[2171] | 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
|
---|
[3041] | 232 | execute simple operations on objects. \\
|
---|
| 233 | This window can be displayed using the menu command
|
---|
| 234 | \menubar{Objects / ObjectManager}.
|
---|
[2171] | 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}
|
---|
[3041] | 251 | A basic command interpreter ({\bf PIACmd/Commander}) is included in {\bf piapp} and
|
---|
[2171] | 252 | other command interpreters can be inserted in the application
|
---|
| 253 | framework.
|
---|
[3041] | 254 | This interpreter ({\bf Commander} \myppageref{Commander})
|
---|
[2171] | 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
|
---|
[2253] | 285 | # Contour representation of a matrix
|
---|
| 286 | contour mtx1 'colrj32 normalline ncont=7'
|
---|
[2171] | 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); \
|
---|
[3041] | 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);
|
---|
[2171] | 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); \
|
---|
[3041] | 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);
|
---|
[2171] | 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 |
|
---|
[3041] | 385 | %%%%%%%%%% Section 3: Graphiques
|
---|
[2171] | 386 | \newpage
|
---|
[3043] | 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}
|
---|
[3429] | 393 | or {\bf contour} \myppageref{contour} will try to force a given graphic representation.
|
---|
| 394 |
|
---|
[3043] | 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
|
---|
[3429] | 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 |
|
---|
[3043] | 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
|
---|
[3429] | 410 | be used to export graphics. \\[2mm]
|
---|
| 411 | The examples in the followwing pages illustrates the usage of some piapp graphic commands.
|
---|
| 412 | \newpage
|
---|
[3043] | 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}
|
---|
[2171] | 426 |
|
---|
[3043] | 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 | %%
|
---|
[3429] | 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
|
---|
[3043] | 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 | %%%
|
---|
[3429] | 502 | \subsubsection{PIDraw3DWdg (3D display)}
|
---|
| 503 | The {\bf PIDraw3DWdg} handles a set of of 3-D drawers, managing
|
---|
[3043] | 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 | %%%
|
---|
[3429] | 511 | \subsubsection{PIImage (Image Display)}
|
---|
| 512 | The display of 2-D arrays $A(i,j)$ as an image is managed by
|
---|
[3043] | 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 | %%%
|
---|
[3429] | 525 | \subsubsection{Windows}
|
---|
[3043] | 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
|
---|
[3429] | 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 |
|
---|
[2172] | 546 | Refer to the command reference section on windows ({\bf Windows}
|
---|
| 547 | \myppageref{Windows})
|
---|
[2171] | 548 | for information on the different type of windows used by piapp
|
---|
[3429] | 549 | and their properties. \\
|
---|
| 550 |
|
---|
[3043] | 551 | %%%
|
---|
[3429] | 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
|
---|
[3043] | 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.
|
---|
[3429] | 559 | %%%
|
---|
[2172] | 560 | \par
|
---|
[2171] | 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}
|
---|
[3043] | 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})
|
---|
[2171] | 575 | \end{itemize}
|
---|
[3043] | 576 | These control tools are briefly described in appendix.
|
---|
[2171] | 577 |
|
---|
[3043] | 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)
|
---|
[3294] | 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
|
---|
[3043] | 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}
|
---|
[3138] | 737 | ---- PIHisto options help info :
|
---|
[3043] | 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
|
---|
[3151] | 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)
|
---|
[3138] | 753 |
|
---|
[3043] | 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]
|
---|
[3151] | 771 | ---- HistoWrapper options : (see HistoWrapper above)
|
---|
[3043] | 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}
|
---|
[3429] | 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 |
|
---|
[3043] | 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 |
|
---|
[3041] | 814 | %%%%%%%%%%%%%%% Section 4 : I/O
|
---|
| 815 | \newpage
|
---|
[3302] | 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.
|
---|
[3041] | 819 | \begin{itemize}
|
---|
[3302] | 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 |
|
---|
[3429] | 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 |
|
---|
[3437] | 920 | There are two commands useful
|
---|
| 921 | when analyzing large catalogs (BINARY\_TBL) in FITS format, which avoid reading the whole
|
---|
| 922 | table in memory. {\tt swfitstable}\myppageref{swfitstable} reads a specified HDU
|
---|
| 923 | as a {\bf SwFitsDataTable} object which uses the FITS file as swap space.
|
---|
| 924 | The {\tt fitsadapt}\myppageref{fitsadapt} can also be used for similar purposes.
|
---|
| 925 |
|
---|
| 926 | The following commands shows how to open a FITS file containing a synchrotron map
|
---|
| 927 | of our galaxy:
|
---|
| 928 | \begin{verbatim}
|
---|
| 929 | # Open the fits file : the map is in HEALPix format
|
---|
| 930 | readfits syncmap.fits
|
---|
| 931 | # Create a window with the appropriate size
|
---|
| 932 | newwin 1 1 800 400
|
---|
| 933 | # Display the map, specifying the colormap
|
---|
| 934 | disp syncmap 'lut=lin,2,50 midas_bluered'
|
---|
| 935 | \end{verbatim}
|
---|
| 936 | \begin{figure}[h]
|
---|
| 937 | \begin{center}
|
---|
| 938 | \includegraphics[width=15cm]{syncmap.eps}
|
---|
| 939 | \caption{Synchron map of our Galaxy, displayed in Molleweide projection}
|
---|
| 940 | \end{center}
|
---|
| 941 | \end{figure}
|
---|
| 942 |
|
---|
[3302] | 943 | \subsection{Graphic export in postscript}
|
---|
[3429] | 944 | %%
|
---|
| 945 | Postscript a page description language widely used for printing and
|
---|
| 946 | graphic output, developed by Adobe systems. Refer to
|
---|
| 947 | \href{http://www.adobe.com/products/postscript/}{Adobe/PostScript3}
|
---|
| 948 | for more detail.
|
---|
[2171] | 949 |
|
---|
[3429] | 950 | Piapp graphic output can be exported in postscript (level 2) or
|
---|
| 951 | encapsulated postscript format.
|
---|
| 952 | Postscript (.ps) files my contain several pages, each vue or window
|
---|
| 953 | corresponding to one page and are suitable for direct printing.
|
---|
| 954 | An Encapsulated Postscript (.eps) file contains a single page,
|
---|
| 955 | corresponding to a window and is suitable for inclusion in
|
---|
| 956 | other document.
|
---|
| 957 |
|
---|
| 958 | Postscript file can easily be converted to other formats,
|
---|
| 959 | PDF or image formats (jpeg \ldots) using converters like
|
---|
| 960 | {\bf ps2pdf} or {imagemagick}.
|
---|
| 961 |
|
---|
| 962 | The menu items under \menubar{PostScript} can be used to export
|
---|
| 963 | graphics in postscript. The default file name is {\tt pia.ps}
|
---|
| 964 | or {\tt pia1.eps} {\tt pia2.eps} \ldots
|
---|
| 965 | The following commands can also be used to create postscriot file
|
---|
| 966 | from the display in the current graphic window:
|
---|
| 967 | \begin{itemize}
|
---|
| 968 | \item {\tt w2ps} \myppageref{w2ps} to add the current graphic
|
---|
| 969 | output as a new page to the output postscript file.
|
---|
| 970 | The current output postscript file (default = w2ps.ps)
|
---|
| 971 | should be closed before being used. Exiting piapp closes automatically
|
---|
| 972 | all postscript files.
|
---|
| 973 | \item {\tt psclosefile} \myppageref{psclosefile} to close the current
|
---|
| 974 | output postscript file.
|
---|
| 975 | \item {\tt pssetfilename} \myppageref{pssetfilename} To define
|
---|
| 976 | the output postscript file name for the subsequent {\tt w2ps} commands.
|
---|
| 977 | \item {\tt w2eps} \myppageref{w2eps} to export the current
|
---|
| 978 | graphic display, in Encapsulated Postscript format to the specified file.
|
---|
| 979 | \begin{verbatim}
|
---|
| 980 | # Open the PPF file created by the commands above
|
---|
| 981 | openppf vecab.ppf
|
---|
| 982 | # Display one of the vectors
|
---|
| 983 | setaxesatt 'font=helvetica,bold,18 fixedfontsize'
|
---|
| 984 | disp va1 'blue marker=box,5'
|
---|
| 985 | # Export the graphic to file va1.eps
|
---|
| 986 | w2eps va1.eps
|
---|
| 987 | # The created file can be viewed using gv
|
---|
| 988 | \end{verbatim}
|
---|
| 989 | \end{itemize}
|
---|
| 990 |
|
---|
[3041] | 991 | %%%%%%%%%%%%%%% Section 5 : analyse a la paw
|
---|
[2171] | 992 | \newpage
|
---|
[3041] | 993 | \section{Tables and interactive analysis}
|
---|
[3043] | 994 | \label{tableplot}
|
---|
[3041] | 995 |
|
---|
| 996 | %%%%%%%%%%%%%%% Section 6 : command interpreter
|
---|
| 997 | \newpage
|
---|
| 998 | \section{Command interpreter}
|
---|
| 999 | piapp uses the class {\bf PIACmd} which extends slightly the
|
---|
| 1000 | SOPHYA class {\bf Commander} as the command interpreter.
|
---|
| 1001 | {\bf Commander} is a c-shell inspired, string oriented command
|
---|
| 1002 | interpreter. Although it has many limitations compared to
|
---|
| 1003 | c-shell, or Tcl , it provides some interesting possibilities:
|
---|
| 1004 | \begin{itemize}
|
---|
| 1005 | \item Extended arithmetic operations (c-like and RPN)
|
---|
| 1006 | \item Simple and vector variables
|
---|
| 1007 | \item Script definition
|
---|
| 1008 | \item Command execution in separate threads
|
---|
| 1009 | \item Dynamic Load
|
---|
| 1010 | \end{itemize}
|
---|
| 1011 |
|
---|
| 1012 | We describe below the {\bf Commander} possibilities,
|
---|
| 1013 | as well as the few {\bf PIACmd} extensions.
|
---|
| 1014 |
|
---|
| 1015 | \subsection{Variables}
|
---|
| 1016 | The SOPHYA::Commander interpreter manages non typed set of variables.
|
---|
| 1017 | Environment variables are also accessible through
|
---|
| 1018 | the usual {\tt \$varenvname}, unless shadowed by a Commander
|
---|
| 1019 | variable. All Commander variables are vector of strings, and are
|
---|
| 1020 | extended as necessary. {\tt \$varname} is the string formed by all
|
---|
| 1021 | the vector elements. Except when performing arithmetic operations,
|
---|
| 1022 | variables are treated as strings.
|
---|
| 1023 | \par
|
---|
| 1024 | An application level set of variables is also managed
|
---|
| 1025 | by Commander, through redefinition of \\
|
---|
[3043] | 1026 | {\tt Commander::GetVarApp() / GetVarApp() \ldots } methods. \\
|
---|
[3041] | 1027 | The {\bf PIACmd} in piapp redefines the {\tt GetVarApp() }
|
---|
| 1028 | in order to provide an easy access to some of objects attributes or methods,
|
---|
[3043] | 1029 | managed by {\bf NamedObjMgr} (See below).
|
---|
[3041] | 1030 |
|
---|
| 1031 | \begin{itemize}
|
---|
| 1032 | \item[\rond] {\bf Definition and initialisation of variables }
|
---|
| 1033 | \begin{verbatim}
|
---|
| 1034 | # Notice that the set command has no = sign
|
---|
| 1035 | Cmd> set sv StringValue
|
---|
| 1036 | # Clearing/removing of a variable : unset or clearvar
|
---|
| 1037 | Cmd> unset sv
|
---|
| 1038 |
|
---|
| 1039 | # Definition of a multi element variable (vector type)
|
---|
| 1040 | # Notice that spaces before / after '(' and ')' are mandatory
|
---|
| 1041 | Cmd> set vecv ( mot1 mot2 mot3 mot4 mot5 )
|
---|
[3429] | 1042 | # Arithmetic expression : C language syntax - spaces
|
---|
| 1043 | # before/after '=' are mandatory
|
---|
[3046] | 1044 | Cmd> a = 2+3*sqrt(4)
|
---|
[3041] | 1045 | # The '=' operator can also be used to initialize a variable with a string
|
---|
| 1046 | Cmd> a = 'Bonjour Madame'
|
---|
| 1047 | # A vector element can be specified in the left hand side
|
---|
| 1048 | Cmd> vecv[2] = 'coucou'
|
---|
| 1049 | # Or using an interpreter variable as index :
|
---|
| 1050 | Cmd> i = 3
|
---|
| 1051 | Cmd> vecv[i] = 'Ooohhh'
|
---|
| 1052 | \end{verbatim}
|
---|
| 1053 |
|
---|
| 1054 | On the right hand side, the value of a variable should be accessed using
|
---|
| 1055 | the \$ character. \\
|
---|
| 1056 | A string can be parsed into words using {\tt var2words}
|
---|
| 1057 | \begin{verbatim}
|
---|
| 1058 | Cmd> var2words varname wordvarname [separateur]
|
---|
| 1059 | \end{verbatim}
|
---|
| 1060 |
|
---|
| 1061 | \item[\rond] {\bf Accessing variable contents } \\
|
---|
| 1062 | The \$ character is used to access the content of a variable {\tt \$varname} .
|
---|
| 1063 | Substitution rules :
|
---|
| 1064 | The {\tt \$xxx} is replaced by the value of variable xxx.
|
---|
| 1065 | No substitution is performed for strings enclosed in simple quotes {\tt ' ... \$xxx '},
|
---|
| 1066 | but substitution is done in strings enclosed in double quotes.
|
---|
| 1067 | Parenthesis or brackets can be used to specify the variable name, inside a string
|
---|
| 1068 | without white space: {\tt \${vname} } ou {\tt \$(vname)}.
|
---|
| 1069 | \begin{verbatim}
|
---|
| 1070 | Cmd> x = 'Hello'
|
---|
| 1071 | Cmd> echo $x
|
---|
| 1072 | # Size of a vector variable : $#vname
|
---|
| 1073 | Cmd> set vx ( 111 2222 3333 444444 )
|
---|
| 1074 | Cmd> echo $#vx
|
---|
| 1075 | # Accessing vector elements
|
---|
| 1076 | Cmd> echo $vx[0] $vx[1]
|
---|
| 1077 | # or using an interpreter variable as index :
|
---|
| 1078 | Cmd> i = 2
|
---|
| 1079 | Cmd> echo $vx[i]
|
---|
| 1080 | # Special syntax: $[vname] is replaced by the content
|
---|
| 1081 | # of a variable whose name is $vname
|
---|
| 1082 | Cmd> zzz = 'Commander'
|
---|
| 1083 | Cmd> xxx = 'zzz'
|
---|
| 1084 | Cmd> echo '---> $[xxx]= ' $[xxx]
|
---|
| 1085 | ---> $[xxx]= Commander
|
---|
| 1086 | \end{verbatim}
|
---|
| 1087 |
|
---|
| 1088 | \par
|
---|
| 1089 |
|
---|
| 1090 | \item[\rond] {\bf Special variables }
|
---|
| 1091 | \begin{itemize}
|
---|
| 1092 | \item {\tt \$retval} ou {\tt \$retstr} : the string specified in the last {\bf return} statement
|
---|
| 1093 | \item {\tt \$status} : Return code from the last executed command.
|
---|
| 1094 | Arguments of scripts (see below) or file executed through {\bf exec} command.
|
---|
| 1095 | \item {\tt \$\# } : number of arguments, except \$0
|
---|
| 1096 | \item {\tt \$0} : Script or file name
|
---|
| 1097 | \item {\tt \$1 \$2 \$3} .... : Arguments (for scripts and .pic files (exec))
|
---|
| 1098 | \end{itemize}
|
---|
[3043] | 1099 |
|
---|
| 1100 | \item[\rond] {\bf Objects/Application level variables} \\
|
---|
| 1101 | For some classes managed by NamedObjMgr,
|
---|
| 1102 | PIACmd provide acces to some of the attributes of the object by
|
---|
| 1103 | {\tt \${objname.attname} }. This mechanism has been implemented in particular for
|
---|
| 1104 | TArrays, TMatrix/TVector, Histograms, NTuples and DataTables.
|
---|
| 1105 | In addition, when brackets are used ($\${vname}$), the priority level between interpreter variables
|
---|
| 1106 | and application level variable is changed. If {\tt vname} exist at the application level,
|
---|
| 1107 | {\tt \${vname} } is replaced by its value, even if an interpreter variable with the
|
---|
| 1108 | same name has been defined.
|
---|
| 1109 | \begin{verbatim}
|
---|
| 1110 | # -------- Example with a Vector
|
---|
| 1111 | piapp[1] newvec va 12
|
---|
| 1112 | piapp[2] echo $va
|
---|
| 1113 | TVector<d>(12) (nr=12, nc=1)
|
---|
| 1114 | # ------- An undefined attribute, such as ? might be
|
---|
| 1115 | # used to get list of valid attributes
|
---|
| 1116 | piapp[3] echo ${va.?}
|
---|
| 1117 | TMatrix.Att: rank size/nelts nrow/nrows ncol/ncols sum
|
---|
[3429] | 1118 | # Compound names, in the form name.att must be inclosed in
|
---|
| 1119 | # braces {name.att}
|
---|
[3043] | 1120 | piapp[4] echo ${va.size}
|
---|
| 1121 | 12
|
---|
| 1122 | # -------- Example with an histogram
|
---|
| 1123 | piapp[8] newh1d his 0. 20. 40
|
---|
| 1124 | piapp[10] echo ${his.?}
|
---|
| 1125 | Histo1D: nbin binw mean sigma over under nentries ndata
|
---|
| 1126 | xmin xmax vmin vmax imin imax
|
---|
| 1127 | piapp[11] echo ${his.nbin}
|
---|
| 1128 | 40
|
---|
| 1129 | \end{verbatim}
|
---|
| 1130 |
|
---|
| 1131 | \item[\rond] {\bf Environment variables} can simply be accessed by {\tt \$varenvname}.
|
---|
| 1132 | However, the environment variables have the lowest priority during substitution.
|
---|
| 1133 | Interpreter's variables have the highest priority, followed
|
---|
| 1134 | by the application level variables.
|
---|
| 1135 |
|
---|
[3041] | 1136 | \end{itemize}
|
---|
| 1137 |
|
---|
[3043] | 1138 |
|
---|
[3041] | 1139 | \subsection{Control structures}
|
---|
| 1140 |
|
---|
| 1141 | \begin{itemize}
|
---|
| 1142 | \item[\rond] Enumerated loop:
|
---|
| 1143 | \begin{verbatim}
|
---|
| 1144 | foreach f ( w1 w2 w3 ... )
|
---|
| 1145 | ...
|
---|
| 1146 | echo $f
|
---|
| 1147 | end
|
---|
| 1148 | \end{verbatim}
|
---|
| 1149 |
|
---|
| 1150 | Note that spaces before/after '(' et and ')' are mandatory.
|
---|
| 1151 | An alternative form uses a vector variable name :
|
---|
| 1152 | \begin{verbatim}
|
---|
| 1153 | foreach v vecname
|
---|
| 1154 | ...
|
---|
| 1155 | echo $v
|
---|
| 1156 | end
|
---|
| 1157 | \end{verbatim}
|
---|
| 1158 |
|
---|
| 1159 | \item[\rond] Integer type loop:
|
---|
| 1160 | \begin{verbatim}
|
---|
| 1161 | for i startInt:endInt[:stepInt]
|
---|
| 1162 | ....
|
---|
| 1163 | echo $i
|
---|
| 1164 | end
|
---|
| 1165 | \end{verbatim}
|
---|
| 1166 |
|
---|
| 1167 | \item[\rond] Integer type loop:
|
---|
| 1168 | \begin{verbatim}
|
---|
| 1169 | for f startFloat:endFloat[:stepFloat]
|
---|
| 1170 | ....
|
---|
| 1171 | echo $f
|
---|
| 1172 | end
|
---|
| 1173 | \end{verbatim}
|
---|
| 1174 |
|
---|
| 1175 | \item[\rond] Loop over lines of a file
|
---|
| 1176 | \begin{verbatim}
|
---|
| 1177 | forinfile line FileName
|
---|
| 1178 | ...
|
---|
| 1179 | echo $line
|
---|
| 1180 | end
|
---|
| 1181 | \end{verbatim}
|
---|
| 1182 |
|
---|
| 1183 | \item[\rond] The {\tt break} instruction can be used to exit from a loop
|
---|
| 1184 |
|
---|
| 1185 | \item[\rond] {\bf if then else} Conditional execution:
|
---|
| 1186 | \begin{verbatim}
|
---|
| 1187 | if ( test ) then
|
---|
| 1188 | endif
|
---|
| 1189 |
|
---|
| 1190 | if ( test ) then
|
---|
| 1191 | ....
|
---|
| 1192 | else
|
---|
| 1193 | ....
|
---|
| 1194 | endif
|
---|
| 1195 | \end{verbatim}
|
---|
| 1196 | Note that spaces before/after '(' et and ')' are mandatory.
|
---|
| 1197 |
|
---|
| 1198 | test is in the form {\tt a == b} OR {\tt a != b} OR {\tt a < b} OR {\tt a > b}
|
---|
| 1199 | OR {\tt a <= b} OR {\tt a >= b}. Comparison operators should be delimited
|
---|
| 1200 | by spaces.
|
---|
| 1201 | {\tt ==} et {\tt !=} make a string comparison, while
|
---|
| 1202 | {\tt < , > , <= , >=} compare the values obtained after string to double conversion.
|
---|
| 1203 | \end{itemize}
|
---|
| 1204 |
|
---|
| 1205 | \subsection{Script definition}
|
---|
| 1206 | A script is a sequence of commands. It is very similar to the execution of commands
|
---|
| 1207 | from a file ({\bf exec filename}). Once a script has been defined, it can be called specifying
|
---|
| 1208 | specifying the script name followed by its arguments.
|
---|
| 1209 | \begin{verbatim}
|
---|
| 1210 | # Script definition :
|
---|
| 1211 | defscript scriptname [description ]
|
---|
| 1212 | ....
|
---|
| 1213 | endscript
|
---|
| 1214 |
|
---|
| 1215 | # Executing the script
|
---|
| 1216 | Cmd> scriptname arg1 arg2 arg3 ....
|
---|
| 1217 | \end{verbatim}
|
---|
| 1218 |
|
---|
| 1219 | The {\tt return} instruction stops the execution and returns from a script, or from a command
|
---|
| 1220 | file called through {\bf exec}. \\
|
---|
| 1221 | The commands {\bf listscript } and {\bf clearscript scriptname} can be used
|
---|
| 1222 | to obtain the list of already defined script, or to clear a script definition.
|
---|
| 1223 |
|
---|
| 1224 | \subsection{Other built-in commands}
|
---|
| 1225 | \begin{itemize}
|
---|
| 1226 | \item[\rond] Instruction {\bf echo } to write the line to cout/stdout
|
---|
| 1227 | \item[\rond] Instruction {\bf echo2file} to write (append) the line to file ({\tt echo2file filename ....})
|
---|
| 1228 | \item[\rond] Instruction {\bf sleep nsec} wait for {\tt nsec} seconds
|
---|
| 1229 | \item[\rond] Instructions {\bf timingon , timingoff , traceon , traceoff } \\
|
---|
| 1230 | %
|
---|
| 1231 | \item[\rond] {\bf exec filename [arg1 arg2 ... ] } to execute command from
|
---|
| 1232 | the file named {\tt filename}. {\tt .pic} is the default extension for the interpreter
|
---|
| 1233 | command files.
|
---|
| 1234 | \item[\rond] {\bf help} and {help keyword/commandname }
|
---|
| 1235 | \item[\rond] {\bf listvars , listcommands } to print the list of defined variables and known
|
---|
| 1236 | commands
|
---|
| 1237 | \item[\rond] An alias for a command by {\bf alias aliasname 'string ' }. Alias substitution
|
---|
| 1238 | occurs for the first word in a command line. {\bf listalias} prints the list of all
|
---|
| 1239 | defined aliases.
|
---|
| 1240 | \item[\rond] Execution control (piapp/PIACmd extension):
|
---|
| 1241 | It is possible to stop the interpreter execution in a loop, a script or
|
---|
| 1242 | a command file by the {\bf stop} command, or using
|
---|
| 1243 | {\tt <Cntrl C>} in the piapp console (PIConsole) \\
|
---|
| 1244 | \end{itemize}
|
---|
| 1245 |
|
---|
| 1246 | \subsection {Command execution in separate threads}
|
---|
| 1247 | It is possible to create new threads to execute commands
|
---|
| 1248 | ( for non built-in interpreter commands). The syntax is similar
|
---|
| 1249 | to unix shell background tasks: an {\&} should be added at the end
|
---|
| 1250 | of the command line. A new thread is then created for the
|
---|
| 1251 | execution of the command, if declared as thread safe \\
|
---|
| 1252 | (see {\tt CmdExecutor::IsThreadable() }.
|
---|
| 1253 | \par
|
---|
| 1254 | Thread management commands:
|
---|
| 1255 | \begin{itemize}
|
---|
| 1256 | \item[\rond] {\bf thrlist }Print current list of threads, with the associated command
|
---|
| 1257 | the thread identifier (integer ThrId) and its status.
|
---|
| 1258 | \item[\rond] {\bf cleanthrlist } Removes all finished threads from the list.
|
---|
| 1259 | An automatic cleanup is performed periodically.
|
---|
| 1260 | \item[\rond] {\bf cancelthr ThId } / {\bf killthr ThId } Stops/kills the thread with
|
---|
| 1261 | the identifier ThId. Avoid using theses commands as the cleanup does
|
---|
| 1262 | not release some resources associated with
|
---|
| 1263 | the thread (memory, mutex \ldots).
|
---|
| 1264 | \end{itemize}
|
---|
| 1265 |
|
---|
| 1266 | %%%%%%%%%%%%%%% Section 7 : c++ execution
|
---|
| 1267 | \newpage
|
---|
| 1268 | \section{On the fly C++ execution}
|
---|
| 1269 |
|
---|
| 1270 | %%%%%%%%%%%%%%% Section 8 : command reference
|
---|
| 1271 | \newpage
|
---|
[2171] | 1272 | \section{piapp command reference}
|
---|
[2253] | 1273 | \label{piappcmdref}
|
---|
[2171] | 1274 | This section contains the description of piapp commands. This information
|
---|
| 1275 | is available on-line, through the help command, or through a graphic
|
---|
[3041] | 1276 | window, accessible by \menubar{File / Help}.
|
---|
[2171] | 1277 | The help items and command are divided into different sections,
|
---|
| 1278 | where related commands are grouped. \\[10mm]
|
---|
| 1279 |
|
---|
| 1280 | % \include{piahelp}
|
---|
| 1281 | \input{piahelp.tex}
|
---|
| 1282 |
|
---|
| 1283 | % La partie des appendix
|
---|
| 1284 | \appendix
|
---|
| 1285 | \newpage
|
---|
[3041] | 1286 | \section{Interactive control windows}
|
---|
| 1287 | \subsection{DrawerTools} \index{DrawerTools}
|
---|
[2171] | 1288 | \label{secdrwtools}
|
---|
| 1289 | The {\bf PIDrawerTools}, shown in the figure \ref{figdrwtools} can be
|
---|
| 1290 | used to change the graphic attributes (color, font, marker, \ldots)
|
---|
| 1291 | of the Drawers displayed in 2D displays
|
---|
| 1292 | ({\bf PIScDrawWdg} \myppageref{PIScDrawWdg}) or 3D displays
|
---|
| 1293 | ({\bf PIDraw3DWdg} \myppageref{PIDraw3DWdg}), as well in image displays
|
---|
| 1294 | {\bf PIImage} (\myppageref{PIImage}). The PIDrawerTools can be activated
|
---|
| 1295 | either using {\tt Alt<G>} on a PIScDrawWdg,PIDraw3DWdg,PIImage,
|
---|
[3043] | 1296 | or through the \menubar{Tools/Show DrawerTools}.
|
---|
| 1297 | A given drawer can be selected through the DrawerId selector (+ / - buttons)
|
---|
[2171] | 1298 |
|
---|
[3041] | 1299 | \vspace*{5mm}
|
---|
[2171] | 1300 | \begin{figure}[ht!]
|
---|
| 1301 | \begin{center}
|
---|
[3043] | 1302 | \includegraphics[width=8cm]{piapp_drwtools.eps}
|
---|
[2171] | 1303 | \caption{PIDrawerTools}
|
---|
| 1304 | \label{figdrwtools}
|
---|
| 1305 | \end{center}
|
---|
| 1306 | \end{figure}
|
---|
[3041] | 1307 | %%%%
|
---|
| 1308 | \subsection{AxesTools} \index{AxesTools}
|
---|
[2171] | 1309 | \label{secaxestools}
|
---|
| 1310 | The {\bf PIAxesTools}, shown in the figure \ref{figaxestools} can be used to
|
---|
| 1311 | control and change the setting of axes on 2D displays
|
---|
| 1312 | ({\bf PIScDrawWdg} \myppageref{PIScDrawWdg}).
|
---|
| 1313 | The PIAxesTools can be activated
|
---|
| 1314 | either using {\tt Alt<A>} on a PIScDrawWdg or through
|
---|
[3043] | 1315 | the \menubar{Tools/Show AxesTools}.
|
---|
[2171] | 1316 |
|
---|
[3041] | 1317 | \vspace*{5mm}
|
---|
[2171] | 1318 | \begin{figure}[ht!]
|
---|
| 1319 | \begin{center}
|
---|
| 1320 | \includegraphics[width=8cm]{piapp_axestools.eps}
|
---|
| 1321 | \caption{PIAxesTools}
|
---|
| 1322 | \label{figaxestools}
|
---|
| 1323 | \end{center}
|
---|
| 1324 | \end{figure}
|
---|
[3041] | 1325 | %%%%%
|
---|
[3043] | 1326 | \subsection{ImageTools} \index{ImageTools}
|
---|
[2171] | 1327 | \label{secimagetools}
|
---|
| 1328 | The {\bf PIImageTools}, shown in the figure \ref{figimgtools} can be used to
|
---|
| 1329 | manipulate a display of type image. Image display are handled by the
|
---|
| 1330 | {\bf PIImage} (\myppageref{PIImage}). The PIImageTools can be activated
|
---|
[3043] | 1331 | either using {\tt Alt<O>} on a PIImage, or through the
|
---|
| 1332 | \menubar{Tools/Show ImageTools}.
|
---|
[2171] | 1333 |
|
---|
[3041] | 1334 | \vspace*{5mm}
|
---|
[2171] | 1335 | \begin{figure}[ht!]
|
---|
| 1336 | \begin{center}
|
---|
| 1337 | \includegraphics[width=8cm]{piapp_imgtools.eps}
|
---|
| 1338 | \caption{PIImageTools}
|
---|
| 1339 | \label{figimgtools}
|
---|
| 1340 | \end{center}
|
---|
| 1341 | \end{figure}
|
---|
| 1342 |
|
---|
[3041] | 1343 | \subsection{Histo2DTools} \index{Histo2DTools}
|
---|
[2171] | 1344 | \label{sech2dtools}
|
---|
| 1345 | The {\bf PIHisto2DTools}, shown in the figure \ref{figh2dtools} can be
|
---|
| 1346 | used to control and change the display caracteristics of 2D histograms.
|
---|
[2253] | 1347 | PIHisto2DTools can be activated
|
---|
[2171] | 1348 | either using {\tt Alt<O>} on a PIScDrawWdg, when the active
|
---|
| 1349 | drawer is a PIHisto2DDrawer, or through the generic drawer tool
|
---|
| 1350 | PIDrawerTools.
|
---|
| 1351 |
|
---|
[3041] | 1352 | \vspace*{5mm}
|
---|
[2171] | 1353 | \begin{figure}[ht!]
|
---|
| 1354 | \begin{center}
|
---|
| 1355 | \includegraphics[width=8cm]{piapp_h2dtools.eps}
|
---|
| 1356 | \caption{PIHisto2DTools}
|
---|
| 1357 | \label{figh2dtools}
|
---|
| 1358 | \end{center}
|
---|
| 1359 | \end{figure}
|
---|
| 1360 |
|
---|
[3041] | 1361 | \subsection{ContourTools} \index{ContourTools}
|
---|
[2171] | 1362 | \label{secconttools}
|
---|
| 1363 | The {\bf PIContourTools}, shown in the figure \ref{figconttools} can be
|
---|
| 1364 | used to control and change the caracteristics of contour displays.
|
---|
[2253] | 1365 | PIContourTools can be activated
|
---|
[2171] | 1366 | either using {\tt Alt<O>} on a PIScDrawWdg, when the active
|
---|
| 1367 | drawer is a PIContDrawer, or through the generic drawer tool
|
---|
| 1368 | PIDrawerTools.
|
---|
| 1369 |
|
---|
| 1370 | \vspace*{10mm}
|
---|
| 1371 | \begin{figure}[ht!]
|
---|
| 1372 | \begin{center}
|
---|
| 1373 | \includegraphics[width=11cm]{piapp_conttools.eps}
|
---|
| 1374 | \caption{PIContourTools}
|
---|
| 1375 | \label{figconttools}
|
---|
| 1376 | \end{center}
|
---|
| 1377 | \end{figure}
|
---|
| 1378 |
|
---|
| 1379 |
|
---|
[2253] | 1380 |
|
---|
| 1381 | Both drawing options (e.g. color, line type, fonts...) and contour
|
---|
| 1382 | determination parameters (e.g. contour number and levels) are controlled
|
---|
| 1383 | by {\bf PIContourTools}.
|
---|
| 1384 |
|
---|
[3041] | 1385 | \subsubsection{Drawing options}
|
---|
[2253] | 1386 | The top choices in {\bf PIContourTools}
|
---|
| 1387 | concern the color map (left choice) or color (right choice) of the contours.
|
---|
| 1388 | If a color map has been chosen, it is used to give each contour a color
|
---|
| 1389 | (according to its level). If no color map has been chosen, contours may be
|
---|
| 1390 | given a color using the left choice box.
|
---|
| 1391 |
|
---|
| 1392 | Contour are by default traced by lines.
|
---|
| 1393 | Alternatively (or in addition) the user may ask to trace them by markers
|
---|
| 1394 | or to put numeric labels (with the contour's level) aside the contour.
|
---|
| 1395 | These options are enabled/disabled by the {\tt LineON}, {\tt MarkerON} and {\tt LabelON}
|
---|
| 1396 | buttons from {\bf PIContourTools}.
|
---|
| 1397 |
|
---|
| 1398 | Options may be recovered ({\tt GetAtt}) or set ({\tt SetAtt})
|
---|
| 1399 | from/to a drawer. Setting an option which adds to the screen will be immediately visible
|
---|
| 1400 | whereas unsetting it requires a {\tt Refresh} to be visible.
|
---|
| 1401 |
|
---|
| 1402 |
|
---|
[3041] | 1403 | \subsubsection{Contour options}
|
---|
[2253] | 1404 | The contouring routines in {\tt spiapp} are based on a hack of the {\tt GNUPlot}
|
---|
| 1405 | routines. Contours are determined from a grid of values
|
---|
| 1406 | using an interpolation scheme. Three schemes may be used
|
---|
| 1407 | (selected by the left menu) :
|
---|
| 1408 | \begin{enumerate}
|
---|
| 1409 | \item Linear interpolation (default), selected by the {\tt Int. Lin.} option
|
---|
| 1410 | \item A cubic spline algorithm, selected by the {\tt CubicSpl} option
|
---|
| 1411 | \item A 2d BSpline algorihm, selected by the {\tt B-Spline} option
|
---|
| 1412 | \end{enumerate}
|
---|
| 1413 |
|
---|
| 1414 | Contour levels and number are automatically
|
---|
| 1415 | determined by the program. They may be specified differently,
|
---|
| 1416 | through command-line options
|
---|
| 1417 | (see section \ref{piappcmdref} for the help of the contour/ntcont commands)
|
---|
| 1418 | or the lower part of the {\bf PIContourTools} window.
|
---|
| 1419 |
|
---|
| 1420 | The user may specify one of the following alternatives :
|
---|
| 1421 | \begin{enumerate}
|
---|
| 1422 | \item the number of contour (their level beeing automatically set).
|
---|
| 1423 | To do this, select {\tt LevelNum} in the right menu and enter the contour number
|
---|
| 1424 | in the left box below.
|
---|
| 1425 | \item the levels of the contours, through an array of numerical values
|
---|
| 1426 | (e.g. 1,4,6,9,27,4.5 will result in 6 contour lines being drawn, if possible and necessary).
|
---|
| 1427 | To do this, select {\tt LevelDisc} and enter the contour number (left box)
|
---|
| 1428 | and the values (right box) separated by ``{\tt ,}''.
|
---|
| 1429 | \item the levels of the contours through an initial (lower) value and an increment.
|
---|
| 1430 | For this, select {\tt LevelInc} and enter the contour number (left box)
|
---|
| 1431 | and the initial value and increment in the right box, as above.
|
---|
| 1432 | \item come back to the default situation, by choosing {\tt LevelAuto}
|
---|
| 1433 | \end{enumerate}
|
---|
| 1434 |
|
---|
| 1435 | Once these options are set, it is necessary the the program recomputes
|
---|
| 1436 | the contour lines. This is commanded by the {\tt SetParm} button.
|
---|
| 1437 |
|
---|
| 1438 |
|
---|
[2171] | 1439 | \newpage
|
---|
| 1440 | \addcontentsline{toc}{section}{Index}
|
---|
| 1441 | \printindex
|
---|
| 1442 |
|
---|
| 1443 | \end{document}
|
---|