Commit 0e1a15f51e54833152782aa91610c75b9508aec7

Authored by Jürgen Knödlseder
1 parent d6d38e42

Add documentation

inst/cta/test/README.md
... ... @@ -3,19 +3,20 @@ CTA module unit tests
3 3 This folder contains scripts and executables that are used for CTA
4 4 module unit testing.
5 5  
6   -benchmark_irf_computing.py
7   - This script performs a benchmark of the response computation for all
8   - different analysis methods (unbinned, binned, stacked). Specifically it
9   - compares the total number of modelled counts to the expected number from
10   - Monte-Carlo simulations. This script is used to validate the absolute
11   - normalization of the CTA response computations.
  6 +`benchmark_irf_computing.py`
12 7  
13   -benchmark_ml_fitting.py
14   - This script performs a benchmark for maximum likelihood fitting of CTA
15   - data.
  8 +> This script performs a benchmark of the response computation for all
  9 +> different analysis methods (unbinned, binned, stacked). Specifically it
  10 +> compares the total number of modelled counts to the expected number from
  11 +> Monte-Carlo simulations. This script is used to validate the absolute
  12 +> normalization of the CTA response computations.
16 13  
17   -test_CTA.cpp
18   - Unit test C++ file for CTA specific GammaLib components.
  14 +`benchmark_ml_fitting.py`
  15 +> This script performs a benchmark for maximum likelihood fitting of CTA
  16 +> data.
19 17  
20   -test_CTA.py
21   - Unit test Python script for CTA specific GammaLib components.
  18 +`test_CTA.cpp`
  19 +> Unit test C++ file for CTA specific GammaLib components.
  20 +
  21 +`test_CTA.py`
  22 +> Unit test Python script for CTA specific GammaLib components.
... ...
inst/cta/test/dev/README.md
... ... @@ -5,51 +5,51 @@ during code development. None of the scripts actually needs to work, they
5 5 may actually be outdated, but could still be useful for further testing
6 6 if needed.
7 7  
8   -example_binned_ml_fit.py
9   - Illustrates a binned maximum likelihood fit of CTA data.
10   - This script implements a full analysis chain, and computes
11   - also the TS statistics value that estimates the significance
12   - of the source detection.
  8 +`example_binned_ml_fit.py`
  9 +> Illustrates a binned maximum likelihood fit of CTA data.
  10 +> This script implements a full analysis chain, and computes
  11 +> also the TS statistics value that estimates the significance
  12 +> of the source detection.
13 13  
14   -example_make_model.py
15   - Illustrates how to make a model in counts space for a counts
16   - map given a specific model in XML format.
  14 +`example_make_model.py`
  15 +> Illustrates how to make a model in counts space for a counts
  16 +> map given a specific model in XML format.
17 17  
18   -example_sim_photons.py
19   - Illustrates how photons are simulated from a source model. If
20   - matplotlib is installed, the simulated photons are shown as
21   - a spectrum.
  18 +`example_sim_photons.py`
  19 +> Illustrates how photons are simulated from a source model. If
  20 +> matplotlib is installed, the simulated photons are shown as
  21 +> a spectrum.
22 22  
23   -test_gauss.py
24   - Test Gaussian.
  23 +`test_gauss.py`
  24 +> Test Gaussian.
25 25  
26   -test_irf_offset.py
27   - Creates images of source models for various offset angles. This
28   - tests the IRF variation with offset angle.
  26 +`test_irf_offset.py`
  27 +> Creates images of source models for various offset angles. This
  28 +> tests the IRF variation with offset angle.
29 29  
30   -test_irf_trafo.py
31   - Test coordinate transformations for IRF computation.
  30 +`test_irf_trafo.py`
  31 +> Test coordinate transformations for IRF computation.
32 32  
33   -test_model.py
34   - Creates images of sources models convolved with the CTA instrument
35   - response function. Also allows the creation of gradient images.
  33 +`test_model.py`
  34 +> Creates images of sources models convolved with the CTA instrument
  35 +> response function. Also allows the creation of gradient images.
36 36  
37   -test_npred_computation.py
38   - Test the Npred computation of the CTA response.
  37 +`test_npred_computation.py`
  38 +> Test the Npred computation of the CTA response.
39 39  
40   -test_npred_integration.py
41   - Compare numerical to analytical Npred computation for CTA response.
  40 +`test_npred_integration.py`
  41 +> Compare numerical to analytical Npred computation for CTA response.
42 42  
43   -test_radial_acceptance.py
44   - Displays the various radial acceptance models.
  43 +`test_radial_acceptance.py`
  44 +> Displays the various radial acceptance models.
45 45  
46   -test_response_table.py
47   - Display CTA response table.
  46 +`test_response_table.py`
  47 +> Display CTA response table.
48 48  
49   -test_sim_edisp.py
50   - Compares energy dispersion simulation to energy dispersion
51   - model.
  49 +`test_sim_edisp.py`
  50 +> Compares energy dispersion simulation to energy dispersion
  51 +> model.
52 52  
53   -test_sim_psf.py
54   - Compares Point Spread function simulation to Point Spread function
55   - model.
  53 +`test_sim_psf.py`
  54 +> Compares Point Spread function simulation to Point Spread function
  55 +> model.
... ...
test/README deleted
1   -This folder contains files used for GammaLib unit testing. More unit tests files can be found in the instrument specific test folders inst/xxx/test.
test/README.md 0 → 100644
  1 +GammaLib unit tests
  2 +===================
  3 +
  4 +This folder contains files used for GammaLib unit testing. More unit tests are
  5 +located in the instrument specific test folders inst/<INSTRUMENT>/test.
... ...
test/test_python.py
... ... @@ -73,7 +73,7 @@ def test(installed=False):
73 73 Perform unit testing for Python interface.
74 74 """
75 75 # Allocate test suites
76   - suites = gammalib.GTestSuites("Python interface testing")
  76 + suites = gammalib.GTestSuites('Python interface testing')
77 77  
78 78 # Allocate test suites and append them to the container
79 79 suite1 = test_GApplication.Test()
... ... @@ -131,7 +131,7 @@ def test(installed=False):
131 131 suite_cta = test_CTA.Test()
132 132 suite_cta.set()
133 133 if installed:
134   - suite_cta.caldb_path("cta/caldb")
  134 + suite_cta.caldb_path('cta/caldb')
135 135 suites.append(suite_cta)
136 136  
137 137 # Optionally handle LAT suite
... ... @@ -161,43 +161,43 @@ def test(installed=False):
161 161 head, tail = os.path.split(testdir)
162 162  
163 163 # Copy over test data
164   - os.system("cp -r %s %s" % (head+"/data", "data"))
165   - os.system("cp -r %s %s" % (head+"/cta", "cta"))
  164 + os.system('cp -r %s %s' % (head+'/data', 'data'))
  165 + os.system('cp -r %s %s' % (head+'/cta', 'cta'))
166 166  
167 167 # Special post processing for CTA files. This is needed because
168 168 # the XML files contain absolute PATH information. This is a kluge
169 169 # that works for now, but it's not a very maintainable way to
170 170 # handle this
171 171 if has_cta:
172   - xml = gammalib.GXml("cta/data/irf_unbinned.xml")
173   - elements = xml.element("observation_list").element("observation")
  172 + xml = gammalib.GXml('cta/data/irf_unbinned.xml')
  173 + elements = xml.element('observation_list').element('observation')
174 174 for element in elements:
175   - filename = element.attribute("file")
  175 + filename = element.attribute('file')
176 176 head, tail = os.path.split(filename)
177 177 head, dir = os.path.split(head)
178 178 if len(dir) > 0:
179   - filename = "cta/"+dir+"/"+tail
180   - element.attribute("file", filename)
181   - xml.save("cta/data/irf_unbinned.xml")
182   - xml = gammalib.GXml("cta/data/irf_1dc.xml")
183   - elements = xml.element("observation_list").element("observation")
  179 + filename = 'cta/'+dir+'/'+tail
  180 + element.attribute('file', filename)
  181 + xml.save('cta/data/irf_unbinned.xml')
  182 + xml = gammalib.GXml('cta/data/irf_1dc.xml')
  183 + elements = xml.element('observation_list').element('observation')
184 184 for element in elements:
185   - filename = element.attribute("file")
  185 + filename = element.attribute('file')
186 186 head, tail = os.path.split(filename)
187 187 head, dir = os.path.split(head)
188   - if dir == "dc1":
189   - dir = "caldb/dc1"
  188 + if dir == 'dc1':
  189 + dir = 'caldb/dc1'
190 190 if len(dir) > 0:
191   - filename = "cta/"+dir+"/"+tail
192   - element.attribute("file", filename)
193   - xml.save("cta/data/irf_1dc.xml")
  191 + filename = 'cta/'+dir+'/'+tail
  192 + element.attribute('file', filename)
  193 + xml.save('cta/data/irf_1dc.xml')
194 194  
195 195 # Run test suite
196 196 success = suites.run()
197 197  
198 198 # If we have a non-installed version then save test results
199 199 if not installed:
200   - suites.save("reports/python.xml")
  200 + suites.save('reports/python.xml')
201 201  
202 202 # Set return code
203 203 if success:
... ... @@ -213,8 +213,6 @@ def test(installed=False):
213 213 # Main routine entry point #
214 214 # ======================== #
215 215 if __name__ == '__main__':
216   - """
217   - Perform unit testing for Python interface.
218   - """
  216 +
219 217 # Run tests
220 218 test()
... ...