Commit e36f3da251a683ecfd8ec68317b5fbc2b9e4ee68
1 parent
bd7675d0
Update GammaLib user documentation.
Showing
10 changed files
with
72 additions
and
57 deletions
doc/source/coding/design.rst
| ... | ... | @@ -18,9 +18,11 @@ file: |
| 18 | 18 | #include <config.h> |
| 19 | 19 | #endif |
| 20 | 20 | |
| 21 | -Note that **the ``config.h`` file should not be included in header files**, | |
| 22 | -since header files are used by the outside world without any knowledge | |
| 23 | -about ``config.h``. | |
| 21 | +.. warning:: | |
| 22 | + | |
| 23 | + **The config.h file should never be included in header files.** | |
| 24 | + The header files are used by the outside world without any knowledge | |
| 25 | + about ``config.h``. | |
| 24 | 26 | |
| 25 | 27 | One of the most commonly used configuration options used throughout |
| 26 | 28 | GammaLib is related to range checking. Range checks are usually |
| ... | ... | @@ -305,11 +307,13 @@ following guidelines should be respected as far as possible: |
| 305 | 307 | - Avoid as far as possible methods that are only defined in the derived |
| 306 | 308 | class. |
| 307 | 309 | |
| 308 | -Also note that **for a derived class, ``init_members()``, | |
| 309 | -``copy_members(const &A a)`` and ``free_members()`` should only act on derived | |
| 310 | -class members but not on base class members**. Any exception from this | |
| 311 | -rule needs very careful documentation since it can easily be the source | |
| 312 | -of memory leaks. | |
| 310 | +.. warning:: | |
| 311 | + | |
| 312 | + **For a derived class, init_members(), copy_members(const &A a) and | |
| 313 | + free_members() should only act on derived class members but not on base | |
| 314 | + class members**. Any exception to this rule needs very careful | |
| 315 | + documentation since it can easily be the source of memory leaks. | |
| 316 | + | |
| 313 | 317 | |
| 314 | 318 | Method naming conventions |
| 315 | 319 | ^^^^^^^^^^^^^^^^^^^^^^^^^ | ... | ... |
doc/source/coding/rules.rst
| ... | ... | @@ -8,7 +8,7 @@ C++ rules |
| 8 | 8 | --------- |
| 9 | 9 | |
| 10 | 10 | All GammaLib C++ code must be compatible with ISO standard C++98. |
| 11 | -Do not use C++11 features. | |
| 11 | +Do not use C++11 features | |
| 12 | 12 | (see `here <http://en.wikipedia.org/wiki/C%2B%2B#Standardization>`__ |
| 13 | 13 | if you don't know what C++98 and C++11 is and note that C++03 is |
| 14 | 14 | just a minor correction of C++98). |
| ... | ... | @@ -189,16 +189,12 @@ Code semantics |
| 189 | 189 | |
| 190 | 190 | >>> import gammalib |
| 191 | 191 | >>> energy = gammalib.GEnergy(10, 'TeV') |
| 192 | - >>> import numpy as np | |
| 193 | - >>> import matplotlib.pyplot as plt | |
| 194 | 192 | |
| 195 | 193 | In interactive sessions (`IPython <http://ipython.org/>`_ is recommended) to save |
| 196 | 194 | typing you can use ``import *`` to import everything into your local namespace:: |
| 197 | 195 | |
| 198 | 196 | >>> from gammalib import * |
| 199 | 197 | >>> energy = GEnergy(10, 'TeV') |
| 200 | - >>> from numpy import * | |
| 201 | - >>> from matplotlib.pyplot import * | |
| 202 | 198 | |
| 203 | 199 | Using ``import *`` in Python scripts is not recommended. Some reason are given in |
| 204 | 200 | `this section <http://docs.python.org/3/howto/doanddont.html#from-module-import>`__ | ... | ... |
doc/source/download.rst
| ... | ... | @@ -14,10 +14,11 @@ Releases |
| 14 | 14 | -------- |
| 15 | 15 | |
| 16 | 16 | The latest GammaLib release is |
| 17 | -`gammalib-0.11.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-0.11.0.tar.gz>`_ | |
| 18 | -(1 November 2015). | |
| 17 | +`gammalib-1.0.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.0.0.tar.gz>`_ | |
| 18 | +(12 December 2015). | |
| 19 | 19 | |
| 20 | 20 | To download an older release, click on the corresponding release number: |
| 21 | +`0.11.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-0.11.0.tar.gz>`_ | |
| 21 | 22 | `0.10.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-0.10.0.tar.gz>`_ |
| 22 | 23 | `0.9.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-09-01.tar.gz>`_ |
| 23 | 24 | `0.9.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-00-09-00.tar.gz>`_ | ... | ... |
doc/source/installation.rst
| ... | ... | @@ -5,8 +5,8 @@ Installation |
| 5 | 5 | |
| 6 | 6 | .. note :: |
| 7 | 7 | |
| 8 | - These installation instructions apply to gammalib-0.11.0 and | |
| 9 | - later. gammalib-0.11.0 has been built, installed and tested | |
| 8 | + These installation instructions apply to gammalib-1.0.0 and | |
| 9 | + later. gammalib-1.0.0 has been built, installed and tested | |
| 10 | 10 | successfully on Debian, Ubuntu, Mandriva, OpenSUSE, Scientific Linux, |
| 11 | 11 | CentOS, Mac OS X, FreeBSD, and OpenSolaris (using gcc), so |
| 12 | 12 | hopefully it also installs on your distribution. In case you encounter |
| ... | ... | @@ -51,7 +51,7 @@ shared library by typing :: |
| 51 | 51 | |
| 52 | 52 | GammaLib can also benefit from the presence of the readline library that |
| 53 | 53 | provides line-editing and history capabilities for text input (GammaLib |
| 54 | -offers however also full functionality without having readline | |
| 54 | +offers however full functionality without having readline | |
| 55 | 55 | installed). readline (which depends on ncurses) is available on most |
| 56 | 56 | system as a prebuilt library, so also here we recommend to use your |
| 57 | 57 | package manager to install the libraries if they are not already there. |
| ... | ... | @@ -83,7 +83,7 @@ Building GammaLib |
| 83 | 83 | If you need the latest source code from the git repository that has not |
| 84 | 84 | yet been released you may also clone the gammalib git repository using :: |
| 85 | 85 | |
| 86 | - $ git clone https://cta-git.irap.omp.eu/gammalib | |
| 86 | + $ git clone https://cta-gitlab.irap.omp.eu/gammalib/gammalib.git | |
| 87 | 87 | |
| 88 | 88 | In case you encounter an SSL certificat problem, type :: |
| 89 | 89 | |
| ... | ... | @@ -95,7 +95,7 @@ Building GammaLib |
| 95 | 95 | $ git checkout devel |
| 96 | 96 | $ ./autogen.sh |
| 97 | 97 | |
| 98 | - This will make sure that you use the validated development trunk and | |
| 98 | + This will make sure that you use the development trunk. It also | |
| 99 | 99 | creates the configuration file that is needed to configure |
| 100 | 100 | GammaLib before compilation. Continue then with the procedure below |
| 101 | 101 | starting with ``./configure``. |
| ... | ... | @@ -122,19 +122,19 @@ source files and builds the C++ library and Python module. Type |
| 122 | 122 | ``./configure`` and not simply ``configure`` to ensure that the configuration |
| 123 | 123 | script in the current directory is used and not some other system-wide |
| 124 | 124 | configuration script. By default, the install directory is set to |
| 125 | -``/usr/local/gamma``. To change the install directory an optional | |
| 126 | -``--prefix`` argument should be given, for example :: | |
| 125 | +``/usr/local/gamma``. To change the install directory, provide an optional | |
| 126 | +``--prefix`` argument, for example :: | |
| 127 | 127 | |
| 128 | 128 | $ ./configure --prefix=/usr/local |
| 129 | 129 | |
| 130 | 130 | If cfitsio and/or readline is not installed in a standard location for |
| 131 | -libraries (such as ``/usr/lib`` or ``/usr/local/lib``), the appropriate | |
| 132 | -location(s) can be specified using the ``LDFLAGS`` (for the library | |
| 131 | +libraries (such as ``/usr/lib`` or ``/usr/local/lib``), you can specify | |
| 132 | +the appropriate location(s) using the ``LDFLAGS`` (for the library | |
| 133 | 133 | directory) and ``CPPFLAGS`` (for the include directory) options:: |
| 134 | 134 | |
| 135 | 135 | $ ./configure LDFLAGS='-L/opt/local/lib' CPPFLAGS='-I/opt/local/include' |
| 136 | 136 | |
| 137 | -A full list of configuration options can be found using :: | |
| 137 | +You can find a full list of configuration options using :: | |
| 138 | 138 | |
| 139 | 139 | $ ./configure --help |
| 140 | 140 | ... | ... |
doc/source/user_manual/getting.rst
| ... | ... | @@ -148,15 +148,15 @@ from this site by selection the gammalib package from the table. |
| 148 | 148 | Alternatively, the code can be downloaded and unpacked from the UNIX prompt |
| 149 | 149 | using:: |
| 150 | 150 | |
| 151 | - $ wget --no-check-certificate http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-0.11.0.tar.gz | |
| 152 | - $ tar xfz gammalib-0.11.0.tar.gz | |
| 151 | + $ wget --no-check-certificate http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.0.0.tar.gz | |
| 152 | + $ tar xfz gammalib-1.0.0.tar.gz | |
| 153 | 153 | |
| 154 | 154 | The GammaLib source code can also be cloned using git. This method is |
| 155 | 155 | recommended if you plan to contribute to the development of the GammaLib |
| 156 | 156 | library. Assuming that git is installed on your system, you may clone |
| 157 | 157 | GammaLib using:: |
| 158 | 158 | |
| 159 | - $ git clone https://cta-git.irap.omp.eu/gammalib | |
| 159 | + $ git clone https://cta-gitlab.irap.omp.eu/gammalib/gammalib.git | |
| 160 | 160 | |
| 161 | 161 | In case that you get: |
| 162 | 162 | ... | ... |
doc/source/user_manual/index.rst
doc/source/user_manual/introduction.rst
| ... | ... | @@ -43,7 +43,7 @@ are: |
| 43 | 43 | * Issue tracker: https://cta-redmine.irap.omp.eu/projects/gammalib/issues |
| 44 | 44 | * Documentation: http://cta.irap.omp.eu/gammalib/ |
| 45 | 45 | |
| 46 | -The present document applies to GammaLib version 0.11. | |
| 46 | +The present document applies to GammaLib version 1.0. | |
| 47 | 47 | |
| 48 | 48 | GammaLib is designed to compile on any POSIX compliant platform. So far, |
| 49 | 49 | GammaLib has been successfully compiled and tested on Mac OS X, OpenBSD, OpenSolaris | ... | ... |
doc/source/user_manual/modules/support.rst
| ... | ... | @@ -38,10 +38,17 @@ and a string storage, respectively. As most of the classes are unrelated, |
| 38 | 38 | they will be described individually in the following sections. |
| 39 | 39 | |
| 40 | 40 | |
| 41 | -Column Separated Value tables | |
| 41 | +Bilinear interpolation | |
| 42 | +~~~~~~~~~~~~~~~~~~~~~~ | |
| 43 | + | |
| 44 | +The :doxy:`GBilinear` class handles bilinear interpolation of values in a | |
| 45 | +two-dimensional table. | |
| 46 | + | |
| 47 | + | |
| 48 | +Comma-Separated Value tables | |
| 42 | 49 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 43 | 50 | |
| 44 | -The :doxy:`GCsv` class handles column separated value tables. Column separated | |
| 51 | +The :doxy:`GCsv` class handles comma-separated value tables. Comma-separated | |
| 45 | 52 | value tables are ASCII files representing a table, where individual table |
| 46 | 53 | columns a separated by a specific character (for example a whitespace or a |
| 47 | 54 | comma). |
| ... | ... | @@ -113,6 +120,37 @@ Runtime exceptions Usage |
| 113 | 120 | =============================== ===== |
| 114 | 121 | |
| 115 | 122 | |
| 123 | +Filename handling | |
| 124 | +~~~~~~~~~~~~~~~~~ | |
| 125 | + | |
| 126 | +The :doxy:`GFilename` class handles file names in GammaLib, including | |
| 127 | +extensions for FITS files in the cfitsio format. The following file name | |
| 128 | +formats are supported :: | |
| 129 | + | |
| 130 | + myfile.fits | |
| 131 | + myfile.fits[EVENTS] | |
| 132 | + myfile.fits[EVENTS,2] | |
| 133 | + myfile.fits[3,2] | |
| 134 | + | |
| 135 | +The class decomposes the input string into the filename and the extension. | |
| 136 | +The filename can be access using the :doxy:`GFilename::filename` | |
| 137 | +method, the extension name using the :doxy:`GFilename::extname` method, | |
| 138 | +the extension number using the :doxy:`GFilename::extno` method and the | |
| 139 | +extension version using the :doxy:`GFilename::extver` method. The latter | |
| 140 | +three methods take an argument that specifies the default value that | |
| 141 | +should be used in case that no extension information is specified. Below | |
| 142 | +a usage example that extracts by default the ``EBOUNDS`` table from a | |
| 143 | +FITS file: | |
| 144 | + | |
| 145 | +.. code-block:: cpp | |
| 146 | + :linenos: | |
| 147 | + | |
| 148 | + GFits file; | |
| 149 | + GFilename fname(filename); | |
| 150 | + file.open(fname.filename()); | |
| 151 | + const GFitsTable& table = *file.table(fname.extname("EBOUNDS")); | |
| 152 | + | |
| 153 | + | |
| 116 | 154 | Linear interpolation |
| 117 | 155 | ~~~~~~~~~~~~~~~~~~~~ |
| 118 | 156 | |
| ... | ... | @@ -279,9 +317,11 @@ Function Description |
| 279 | 317 | ``gammalib::plaw_energy_flux`` Compute energy flux under a power law. |
| 280 | 318 | ``gammalib::elogmean`` Computes geometric mean of energy. |
| 281 | 319 | ``gammalib::file_exists`` Check whether a file exists. |
| 320 | +``gammalib::file_exists_gzip`` Check whether a file (or a gzipped version of it) exists. | |
| 282 | 321 | ``gammalib::dir_exists`` Check whether a directory exists. |
| 283 | 322 | ``gammalib::is_infinite`` Check whether a double precision value is infinite. |
| 284 | 323 | ``gammalib::is_notanumber`` Check whether a double precision value is not a number. |
| 324 | +``gammalib::is_fits`` Check whether a file is a FITS file. | |
| 285 | 325 | ``gammalib::contains`` Check whether a string contains a sub-string. |
| 286 | 326 | ``gammalib::warning`` Dump warning in console. |
| 287 | 327 | ``gammalib::xml2str`` Converts XML to string. | ... | ... |
doc/source/user_manual/modules/uml_support.png
doc/source/user_manual/quickstart.rst deleted
| 1 | -Getting started with GammaLib | |
| 2 | -============================= | |
| 3 | - | |
| 4 | -A quick GammaLib tutorial | |
| 5 | -------------------------- | |
| 6 | - | |
| 7 | -To be written ... | |
| 8 | - | |
| 9 | - | |
| 10 | -Using GammaLib from Python | |
| 11 | --------------------------- | |
| 12 | - | |
| 13 | -To be written ... | |
| 14 | - | |
| 15 | - | |
| 16 | -Programming guidelines | |
| 17 | ----------------------- | |
| 18 | - | |
| 19 | -To be written ... | |
| 20 | - | |
| 21 | - | |
| 22 | -Frequently asked questions | |
| 23 | --------------------------- | |
| 24 | - | |
| 25 | -To be written ... |