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