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