Commit ba0f65c1bdfa59c7c9708adbb6f0e329d8578b84

Authored by Jürgen Knödlseder
2 parents e948b1d5 1dd298a9

Merge branch 'master' into update-1dc-doc

# Conflicts:
#	ChangeLog
#	NEWS
#	README.md
#	configure.ac
#	ctools.pc.in
#	doc/Doxyfile
#	doc/source/admin/release_history/1.3.1.rst
#	doc/source/conf.py
#	sonar-project.properties
#	src/ctmodel/ctmodel.cpp
Showing 33 changed files with 434 additions and 83 deletions
ChangeLog
... ... @@ -12,6 +12,7 @@
12 12 * Bug fix version 1.3.1 released
13 13 ================================
14 14  
  15 + ctbkgcube creates XML files compliant with non-CTA instruments (#2140)
15 16 Reduce computation time of ctmodel and parallelize using OpenMP (#2147)
16 17 Fix csresmap significance computation error (#2136)
17 18 Use MigMatrixNoTheta2cut_offaxis and AngularPSF2DEtrue_offaxis histograms to
... ...
cscripts/cscaldb.py
... ... @@ -204,6 +204,9 @@ class cscaldb(ctools.cscript):
204 204 # Open logfile
205 205 self.logFileOpen()
206 206  
  207 + # Read ahead output parameters
  208 + self._read_ahead(True)
  209 +
207 210 # Run the script
208 211 self.run()
209 212  
... ...
cscripts/csebins.py
... ... @@ -272,25 +272,6 @@ class csebins(ctools.cscript):
272 272 # Return
273 273 return
274 274  
275   - def execute(self):
276   - """
277   - Execute the script
278   - """
279   - # Open logfile
280   - self.logFileOpen()
281   -
282   - # Read ahead output parameters
283   - self._read_ahead(True)
284   -
285   - # Run the scrip
286   - self.run()
287   -
288   - # Save energy boundaries
289   - self.save()
290   -
291   - # Return
292   - return
293   -
294 275 def save(self):
295 276 """
296 277 Save energy boundaries
... ... @@ -322,6 +303,25 @@ class csebins(ctools.cscript):
322 303 # Return
323 304 return self._ebounds
324 305  
  306 + def execute(self):
  307 + """
  308 + Execute the script
  309 + """
  310 + # Open logfile
  311 + self.logFileOpen()
  312 +
  313 + # Read ahead output parameters
  314 + self._read_ahead(True)
  315 +
  316 + # Run the scrip
  317 + self.run()
  318 +
  319 + # Save energy boundaries
  320 + self.save()
  321 +
  322 + # Return
  323 + return
  324 +
325 325  
326 326 # ======================== #
327 327 # Main routine entry point #
... ...
cscripts/csiactcopy.py
... ... @@ -743,6 +743,9 @@ class csiactcopy(ctools.cscript):
743 743 # Open logfile
744 744 self.logFileOpen()
745 745  
  746 + # Read ahead output parameters
  747 + self._read_ahead(True)
  748 +
746 749 # Run the script
747 750 self.run()
748 751  
... ...
cscripts/csiactdata.py
... ... @@ -184,6 +184,9 @@ class csiactdata(ctools.cscript):
184 184 # Open logfile
185 185 self.logFileOpen()
186 186  
  187 + # Read ahead output parameters
  188 + self._read_ahead(True)
  189 +
187 190 # Run the script
188 191 self.run()
189 192  
... ...
cscripts/csobs2caldb.py
... ... @@ -400,6 +400,9 @@ class csobs2caldb(ctools.cscript):
400 400 # Open logfile
401 401 self.logFileOpen()
402 402  
  403 + # Read ahead output parameters
  404 + self._read_ahead(True)
  405 +
403 406 # Run the script
404 407 self.run()
405 408  
... ...
cscripts/cspull.py
... ... @@ -329,6 +329,9 @@ class cspull(ctools.cscript):
329 329 # Open logfile
330 330 self.logFileOpen()
331 331  
  332 + # Read ahead output parameters
  333 + self._read_ahead(True)
  334 +
332 335 # Run the script
333 336 self.run()
334 337  
... ...
cscripts/csresmap.py
... ... @@ -246,21 +246,33 @@ class csresmap(ctools.cscript):
246 246 # Compute sign map
247 247 signmap = (self._resmap - modelmap).sign()
248 248  
249   - # Compute logarithm of map. For that we mask pixels
250   - #logmap = self._resmap/modelmap
251   - logmap = self._resmap.copy() # Python 3.x kluge
252   - logmap /= modelmap
253   - for i in range(logmap.npix()):
254   - if logmap[i] > 0.0:
255   - logmap[i] = math.log(logmap[i])
  249 + # Loop over every bin in the map
  250 + for i in range(self._resmap.npix()):
  251 +
  252 + # If the model value > 0.0 do the computation as normal ...
  253 + model_val = modelmap[i]
  254 + if model_val > 0.0:
  255 +
  256 + # If the data value is also > 0 then compute the
  257 + # significance^2 and save it to the map ...
  258 + data_val = self._resmap[i]
  259 + if data_val > 0.0:
  260 + log_val = math.log(data_val/model_val)
  261 + self._resmap[i] = (data_val*log_val) + model_val - data_val
  262 +
  263 + # ... otherwise compute the reduced value of the above
  264 + # expression. This is necessary to avoid computing log(0).
  265 + else:
  266 + self._resmap[i] = model_val
  267 +
  268 + # ... otherwise hard-code the significance to 0
256 269 else:
257   - logmap[i] = 0.0
258   -
  270 + self._resmap[i] = 0.0
  271 +
259 272 # Compute significance map
260   - signif_squared_map = (self._resmap*logmap) + modelmap - self._resmap
261   - signif_squared_map *= 2.0
262   - unsigned_resmap = signif_squared_map.sqrt()
263   - self._resmap = unsigned_resmap * signmap
  273 + self._resmap *= 2.0
  274 + self._resmap = self._resmap.sqrt()
  275 + self._resmap = self._resmap * signmap
264 276  
265 277 # Raise exception if algorithm is unknown
266 278 else:
... ...
cscripts/csroot2caldb.py
... ... @@ -29,7 +29,7 @@ from cscripts import calutils
29 29  
30 30 # Optional ROOT import
31 31 try:
32   - from ROOT import TFile
  32 + from ROOT import TFile, TH2F, TH3F
33 33 _has_root = True
34 34 except ImportError:
35 35 _has_root = False
... ... @@ -651,6 +651,78 @@ class csroot2caldb(ctools.cscript):
651 651 # Return
652 652 return
653 653  
  654 + def _root2psf_get_r68_and_r80(self, tfile):
  655 + """
  656 + Generates 68% and 80% containment radii histograms from
  657 + AngularPSF2DEtrue_offaxis histogram
  658 +
  659 + Parameters
  660 + ----------
  661 + tfile : `~ROOT.TFile`
  662 + ROOT file
  663 +
  664 + Returns
  665 + -------
  666 + r68, r80 : Tuple of `~ROOT.THF2`
  667 + 68% and 80% containment radius ROOT histograms
  668 + """
  669 + # Get relevant ROOT histograms
  670 + psf = tfile.Get('AngularPSF2DEtrue_offaxis')
  671 +
  672 + # Extract axes
  673 + energies = psf.GetXaxis()
  674 + dists = psf.GetYaxis()
  675 + offsets = psf.GetZaxis()
  676 +
  677 + # Extract number of bins in histogram
  678 + neng = energies.GetNbins()
  679 + ndist = dists.GetNbins()
  680 + noffset = offsets.GetNbins()
  681 +
  682 + # Create r68 and r80 histograms
  683 + r68 = TH2F('AngRes68Etrue_offaxis',
  684 + 'Angular resolution (68% containment)',
  685 + neng, energies.GetBinLowEdge(1), energies.GetBinUpEdge(neng),
  686 + noffset, offsets.GetBinLowEdge(1), offsets.GetBinUpEdge(noffset))
  687 + r80 = TH2F('AngRes80Etrue_offaxis',
  688 + 'Angular resolution (80% containment)',
  689 + neng, energies.GetBinLowEdge(1), energies.GetBinUpEdge(neng),
  690 + noffset, offsets.GetBinLowEdge(1), offsets.GetBinUpEdge(noffset))
  691 +
  692 + # Loop over all energy and offset angle bins
  693 + for ieng in range(neng):
  694 + for ioff in range(noffset):
  695 +
  696 + # Compute PDF integral
  697 + pdf_integral = 0.0
  698 + for idist in range(ndist):
  699 + pdf_integral += psf.GetBinContent(ieng+1,idist+1,ioff+1)
  700 +
  701 + # Compute 68% containment radius
  702 + pdf_68 = 0.0
  703 + r68_angle = 0.0
  704 + for idist in range(ndist):
  705 + pdf_68 += psf.GetBinContent(ieng+1,idist+1,ioff+1)
  706 + if pdf_68 > 0.68*pdf_integral:
  707 + r68_angle = dists.GetBinLowEdge(idist+1)
  708 + break
  709 +
  710 + # Compute 80% containment radius
  711 + pdf_80 = 0.0
  712 + r80_angle = 0.0
  713 + for idist in range(ndist):
  714 + pdf_80 += psf.GetBinContent(ieng+1,idist+1,ioff+1)
  715 + if pdf_80 > 0.80*pdf_integral:
  716 + r80_angle = dists.GetBinLowEdge(idist+1)
  717 + break
  718 +
  719 + # Set histogram values
  720 + r68.SetBinContent(ieng+1,ioff+1,r68_angle)
  721 + r80.SetBinContent(ieng+1,ioff+1,r80_angle)
  722 +
  723 + # Return
  724 + return r68, r80
  725 +
654 726 def _root2psf_gauss(self, tfile, irf, ds):
655 727 """
656 728 Translate ROOT to CALDB point spread function extension
... ... @@ -677,7 +749,8 @@ class csroot2caldb(ctools.cscript):
677 749 'Generate Gaussian point spread function extension')
678 750  
679 751 # Get relevant ROOT histograms
680   - r68 = tfile.Get('AngRes_offaxis')
  752 + #r68 = tfile.Get('AngRes_offaxis')
  753 + r68, _ = self._root2psf_get_r68_and_r80(tfile)
681 754  
682 755 # Extract number of bins in histogram
683 756 neng = r68.GetXaxis().GetNbins()
... ... @@ -757,8 +830,9 @@ class csroot2caldb(ctools.cscript):
757 830 'Generate King point spread function extension')
758 831  
759 832 # Get relevant ROOT histograms
760   - r68 = tfile.Get('AngRes_offaxis')
761   - r80 = tfile.Get('AngRes80_offaxis')
  833 + #r68 = tfile.Get('AngRes_offaxis')
  834 + #r80 = tfile.Get('AngRes80_offaxis')
  835 + r68, r80 = self._root2psf_get_r68_and_r80(tfile)
762 836  
763 837 # Extract number of bins in histogram
764 838 neng = r68.GetXaxis().GetNbins()
... ... @@ -869,6 +943,80 @@ class csroot2caldb(ctools.cscript):
869 943 # Return
870 944 return
871 945  
  946 + def _root2edisp_get_migra(self, tfile):
  947 + """
  948 + Generates migration matrix histogram from AngularPSF2DEtrue_offaxis
  949 + histogram
  950 +
  951 + Parameters
  952 + ----------
  953 + tfile : `~ROOT.TFile`
  954 + ROOT file
  955 +
  956 + Returns
  957 + -------
  958 + migra : `~ROOT.TH3F`
  959 + Migration matrix
  960 + """
  961 + # Get relevant ROOT histograms
  962 + matrix = tfile.Get('MigMatrixNoTheta2cut_offaxis')
  963 +
  964 + # Extract axes
  965 + ereco = matrix.GetXaxis()
  966 + etrue = matrix.GetYaxis()
  967 + offsets = matrix.GetZaxis()
  968 +
  969 + # Extract number of bins in histogram
  970 + nereco = ereco.GetNbins()
  971 + netrue = etrue.GetNbins()
  972 + noffset = offsets.GetNbins()
  973 +
  974 + # Set number of migration bins
  975 + nmigra = 300
  976 +
  977 + # Create migra histograms
  978 + migra = TH3F('EestOverEtrue_offaxis',
  979 + 'Migration',
  980 + netrue, etrue.GetBinLowEdge(1), etrue.GetBinUpEdge(netrue),
  981 + nmigra, 0.0, 3.0,
  982 + noffset, offsets.GetBinLowEdge(1), offsets.GetBinUpEdge(noffset))
  983 +
  984 + # Loop over true energies
  985 + for ietrue in range(netrue):
  986 +
  987 + # Get true energy in TeV
  988 + e_true = math.pow(10.0, migra.GetXaxis().GetBinCenter(ietrue+1))
  989 +
  990 + # Loop over migration values
  991 + for imigra in range(nmigra):
  992 +
  993 + # Get migration value
  994 + migration = migra.GetYaxis().GetBinCenter(imigra+1)
  995 +
  996 + # Compute reconstructed energy in TeV
  997 + e_reco = e_true * migration
  998 +
  999 + # Continue only if reconstructed energy is positive
  1000 + if e_reco > 0.0:
  1001 +
  1002 + # Get reconstructed bin
  1003 + ireco = ereco.FindFixBin(math.log10(e_reco))
  1004 +
  1005 + # Continue only if bin is valid
  1006 + if ireco > 0 and ireco <= nereco:
  1007 +
  1008 + # Loop over offset angles
  1009 + for ioff in range(noffset):
  1010 +
  1011 + # Get bin value
  1012 + value = matrix.GetBinContent(ireco,ietrue+1,ioff+1)
  1013 +
  1014 + # Set bin value
  1015 + migra.SetBinContent(ietrue+1,imigra+1,ioff+1,value)
  1016 +
  1017 + # Return
  1018 + return migra
  1019 +
872 1020 def _root2edisp(self, tfile, irf, ds):
873 1021 """
874 1022 Translate ROOT to CALDB energy dispersion extension
... ... @@ -889,7 +1037,8 @@ class csroot2caldb(ctools.cscript):
889 1037 self._log_header1(gammalib.TERSE, 'Generate energy dispersion extension')
890 1038  
891 1039 # Get relevant ROOT histograms
892   - matrix = tfile.Get('EestOverEtrue_offaxis')
  1040 + matrix = self._root2edisp_get_migra(tfile)
  1041 + #matrix = tfile.Get('EestOverEtrue_offaxis')
893 1042  
894 1043 # Write boundary keywords
895 1044 self._set_cif_keywords(ds['HDU_EDISP'], irf['EDISP_NAME'],
... ... @@ -1635,6 +1784,9 @@ class csroot2caldb(ctools.cscript):
1635 1784 # Open logfile
1636 1785 self.logFileOpen()
1637 1786  
  1787 + # Read ahead output parameters
  1788 + self._read_ahead(True)
  1789 +
1638 1790 # Run the script
1639 1791 self.run()
1640 1792  
... ...
cscripts/cssens.py
... ... @@ -649,6 +649,9 @@ class cssens(ctools.cscript):
649 649 # Open logfile
650 650 self.logFileOpen()
651 651  
  652 + # Read ahead output parameters
  653 + self._read_ahead(True)
  654 +
652 655 # Run the script
653 656 self.run()
654 657  
... ...
cscripts/cstsdist.py
... ... @@ -295,6 +295,9 @@ class cstsdist(ctools.cscript):
295 295 # Open logfile
296 296 self.logFileOpen()
297 297  
  298 + # Read ahead output parameters
  299 + self._read_ahead(True)
  300 +
298 301 # Run the script
299 302 self.run()
300 303  
... ...
cscripts/cstsmapsplit.py
... ... @@ -255,19 +255,6 @@ class cstsmapsplit(ctools.cscript):
255 255 # Return
256 256 return
257 257  
258   - def execute(self):
259   - """
260   - Execute the script
261   - """
262   - # Run the script
263   - self.run()
264   -
265   - # Save results
266   - self.save()
267   -
268   - # Return
269   - return
270   -
271 258 def save(self):
272 259 """
273 260 Save commands to ASCII file
... ... @@ -291,6 +278,25 @@ class cstsmapsplit(ctools.cscript):
291 278 # Return
292 279 return
293 280  
  281 + def execute(self):
  282 + """
  283 + Execute the script
  284 + """
  285 + # Open logfile
  286 + self.logFileOpen()
  287 +
  288 + # Read ahead output parameters
  289 + self._read_ahead(True)
  290 +
  291 + # Run the script
  292 + self.run()
  293 +
  294 + # Save results
  295 + self.save()
  296 +
  297 + # Return
  298 + return
  299 +
294 300  
295 301 # ======================== #
296 302 # Main routine entry point #
... ...
cscripts/csviscube.py
... ... @@ -519,6 +519,9 @@ class csviscube(ctools.cscript):
519 519 # Open logfile
520 520 self.logFileOpen()
521 521  
  522 + # Read ahead output parameters
  523 + self._read_ahead(True)
  524 +
522 525 # Run the script
523 526 self.run()
524 527  
... ...
cscripts/csworkflow.py
... ... @@ -360,6 +360,9 @@ class csworkflow(ctools.cscript):
360 360 # Open logfile
361 361 self.logFileOpen()
362 362  
  363 + # Read ahead output parameters
  364 + self._read_ahead(True)
  365 +
363 366 # Run the script
364 367 self.run()
365 368  
... ...
dev/make_root_irf.py 0 → 100755
  1 +#! /usr/bin/env python
  2 +# ==========================================================================
  3 +# Generates ROOT IRF test file
  4 +#
  5 +# Copyright (C) 2017 Juergen Knoedlseder
  6 +#
  7 +# This program is free software: you can redistribute it and/or modify
  8 +# it under the terms of the GNU General Public License as published by
  9 +# the Free Software Foundation, either version 3 of the License, or
  10 +# (at your option) any later version.
  11 +#
  12 +# This program is distributed in the hope that it will be useful,
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15 +# GNU General Public License for more details.
  16 +#
  17 +# You should have received a copy of the GNU General Public License
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
  19 +#
  20 +# ==========================================================================
  21 +from ROOT import TFile
  22 +
  23 +# Open input file
  24 +filename = '/project-data/cta/performance/prod3b/CTA-Performance-North-E-20170502/CTA-Performance-North-20deg-average-50h_20170502.root'
  25 +infile = TFile(filename)
  26 +
  27 +# Open output file
  28 +outfile = TFile('irf.root', 'RECREATE')
  29 +
  30 +# Open histograms
  31 +aeff1 = infile.Get('EffectiveAreaEtrueNoTheta2cut_offaxis')
  32 +aeff2 = infile.Get('EffectiveAreaEtrueNoTheta2cut')
  33 +psf1 = infile.Get('AngRes_offaxis')
  34 +psf2 = infile.Get('AngRes80_offaxis')
  35 +psf3 = infile.Get('AngularPSF2DEtrue_offaxis')
  36 +edisp1 = infile.Get('EestOverEtrue_offaxis')
  37 +edisp2 = infile.Get('MigMatrixNoTheta2cut_offaxis')
  38 +bkg1 = infile.Get('BGRatePerSqDeg_offaxis')
  39 +bkg2 = infile.Get('BGRatePerSqDeg')
  40 +
  41 +# Write histograms
  42 +infile.GetList().Write()
  43 +
  44 +# Close output file
  45 +outfile.Close()
... ...
doc/source/admin/download.rst
... ... @@ -13,7 +13,7 @@ bugs.
13 13 Releases
14 14 --------
15 15  
16   -The latest ctools release is ``ctools-1.3.0`` (7 June 2017).
  16 +The latest ctools release is ``ctools-1.3.1`` (20 July 2017).
17 17  
18 18 Below a table of ctools releases. Please read the :ref:`sec_release` to
19 19 learn more about new features and corrected bugs in a given release.
... ... @@ -31,6 +31,9 @@ learn more about new features and corrected bugs in a given release.
31 31 * - ctools
32 32 - gammalib
33 33 - Mac OS X package
  34 + * - `1.3.1 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.1.tar.gz>`_
  35 + - `1.3.1 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.3.1.tar.gz>`_
  36 + - `ctools-1.3.1-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.1-macosx10.7.dmg>`_
34 37 * - `1.3.0 <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.0.tar.gz>`_
35 38 - `1.3.0 <http://cta.irap.omp.eu/ctools/releases/gammalib/gammalib-1.3.0.tar.gz>`_
36 39 - `ctools-1.3.0-macosx10.7.dmg <http://cta.irap.omp.eu/ctools/releases/ctools/ctools-1.3.0-macosx10.7.dmg>`_
... ...
doc/source/admin/release_history/1.3.1.rst
1 1 .. _1.3.1:
2 2  
3   -ctools 1.3.1 release
4   -====================
  3 +ctools 1.3.1 release (20 July 2017)
  4 +===================================
5 5  
6 6 Overview
7 7 --------
... ...
doc/source/develop/index.rst
... ... @@ -45,7 +45,7 @@ Links:
45 45 * `GitHub <https://github.com/ctools/ctools>`_
46 46 * `Redmine <https://cta-redmine.irap.omp.eu/projects/ctools>`_
47 47 * `Open HUB <https://www.openhub.net/p/ctools_>`_
48   -* `Source code documentation (Doxygen) <doxygen/index.html>`_
  48 +* `Source code documentation (Doxygen) <../doxygen/index.html>`_
49 49  
50 50 And here some status shields:
51 51  
... ...
doc/source/users/reference_manual/csroot2caldb.rst 0 → 100644
  1 +.. _csroot2caldb:
  2 +
  3 +csroot2caldb
  4 +============
  5 +
  6 +Creates a caldb entry from a ROOT performance file.
  7 +
  8 +
  9 +Synopsis
  10 +--------
  11 +
  12 +This script creates an entry in the local calibration database from a ROOT
  13 +performance file.
  14 +
  15 +
  16 +General parameters
  17 +------------------
  18 +
  19 +``infile [file]``
  20 + Input ROOT performance file file.
  21 +
  22 +``(outdir = ) [string]``
  23 + Output CALDB directory.
  24 +
  25 +``inst [string]``
  26 + Instrument name.
  27 +
  28 +``id [string]``
  29 + Instrument Response Function identifier.
  30 +
  31 +``version [string]``
  32 + Instrument Response Function version.
  33 +
  34 +``analysis [string]``
  35 + Instrument Response Function analysis.
  36 +
  37 +``zenith [real]``
  38 + Zenith angle (in degrees).
  39 +
  40 +``azimuth [real]``
  41 + Azimuth angle (in degrees).
  42 +
  43 +``(emin = UNDEF) [real]``
  44 + Minimum energy threshold (TeV).
  45 +
  46 +``(emax = UNDEF) [real]``
  47 + Maximum energy threshold (TeV).
  48 +
  49 +``(psftype = Gauss) [string]``
  50 + Point spread function type.
  51 +
  52 +``(split = no) [boolean]``
  53 + Split IRF components into different files.
  54 +
  55 +``(norm1d = no) [boolean]``
  56 + Normalize on 1D histograms.
  57 +
  58 +``(rebin = no) [boolean]``
  59 + Rebin.
  60 +
  61 +``(eascale = 1.0) [real]``
  62 + Scaling factor for effective areas.
  63 +
  64 +``(bgdscale = 1.0) [real]``
  65 + Scaling factor for background rates.
  66 +
  67 +``(bgdoversample = 1) [integer]``
  68 + Spatial oversampling factor for background template.
  69 +
  70 +``(bgdethres = 1000.0) [real]``
  71 + Energy above which to replace background by power law (TeV).
  72 +
  73 +``(bgdinfill = no) [boolean]``
  74 + Infill of background template?.
  75 +
  76 +
  77 +Standard parameters
  78 +-------------------
  79 +
  80 +``(chatter = 2) [integer]``
  81 + Verbosity of the executable:
  82 + ``chatter = 0``: no information will be logged
  83 +
  84 + ``chatter = 1``: only errors will be logged
  85 +
  86 + ``chatter = 2``: errors and actions will be logged
  87 +
  88 + ``chatter = 3``: report about the task execution
  89 +
  90 + ``chatter = 4``: detailed report about the task execution
  91 +
  92 +``(clobber = yes) [boolean]``
  93 + Specifies whether an existing output file should be overwritten.
  94 +
  95 +``(debug = no) [boolean]``
  96 + Enables debug mode. In debug mode the executable will dump any log file output to the console.
  97 +
  98 +``(mode = ql) [string]``
  99 + Mode of automatic parameters (default is "ql", i.e. "query and learn").
  100 +
  101 +``(logfile = csroot2caldb.log) [filename]``
  102 + Log filename.
  103 +
  104 +
  105 +Related tools or scripts
  106 +------------------------
  107 +
  108 +:doc:`cscaldb`
... ...
doc/source/users/reference_manual/index.rst
... ... @@ -53,6 +53,7 @@ cscripts
53 53 csphasecrv --- Computes phase curve <csphasecrv>
54 54 cspull --- Generates pull distribution <cspull>
55 55 csresmap --- Generates residual map <csresmap>
  56 + csroot2caldb --- Creates a caldb entry from a ROOT file <csroot2caldb>
56 57 cssens --- Computes CTA sensitivity <cssens>
57 58 csspec --- Computes spectral points <csspec>
58 59 cssrcdetect --- Detects sources in sky map <cssrcdetect>
... ...
doc/source/users/user_manual/getting_started/index.rst deleted
1   -.. _sec_using:
2   -
3   -Using ctools
4   -============
5   -
6   -.. toctree::
7   - :maxdepth: 1
8   -
9   - python
10   - models
11   - response
12   -
doc/source/users/user_manual/index.rst
1   -===========
  1 +.. _sec_user_manual:
  2 +
2 3 User Manual
3 4 ===========
4 5  
... ... @@ -6,6 +7,7 @@ User Manual
6 7 :maxdepth: 1
7 8  
8 9 introduction
9   - getting_started/index
  10 + response
  11 + models
10 12 plotting
11   -
  13 + python
... ...
doc/source/users/user_manual/introduction.rst
... ... @@ -53,8 +53,7 @@ command line or used as Python classes, as illustrated below:
53 53 >>> import cscripts
54 54 >>> pull = cscripts.cspull()
55 55  
56   -In this User Manual you will now learn how to install and use the ctools
57   -package.
  56 +In this User Manual you will now learn how to use the ctools package.
58 57 If you encounter any problems, please read the :ref:`sec_help` section.
59 58 And you should read the :ref:`sec_develop` section if you would like to
60 59 contribute to the ctools developments.
... ...
doc/source/users/user_manual/getting_started/irf-aeff.png renamed to doc/source/users/user_manual/irf-aeff.png

3.24 KB

doc/source/users/user_manual/getting_started/irf-file.png renamed to doc/source/users/user_manual/irf-file.png

7.1 KB

doc/source/users/user_manual/getting_started/irfs.jpg renamed to doc/source/users/user_manual/irfs.jpg

27.6 KB

doc/source/users/user_manual/getting_started/model_lightcurve.png renamed to doc/source/users/user_manual/model_lightcurve.png

65.4 KB

doc/source/users/user_manual/getting_started/model_phasecurve.png renamed to doc/source/users/user_manual/model_phasecurve.png

26.9 KB

doc/source/users/user_manual/getting_started/models.rst renamed to doc/source/users/user_manual/models.rst
doc/source/users/user_manual/getting_started/python.rst renamed to doc/source/users/user_manual/python.rst
... ... @@ -303,8 +303,9 @@ Here an example of how to use ``obsutils``:
303 303 Number of predicted events : 0
304 304 >>> obs.models(gammalib.GModels("${CTOOLS}/share/models/crab.xml"))
305 305 >>> obs = obsutils.sim(obs)
306   - >>> like = obsutils.fit(obs)
307   - >>> print(like.obs().models())
  306 + >>> like = ctools.ctlike(obs)
  307 + >>> like.run()
  308 + >>> print(like.obs().models())
308 309 === GModels ===
309 310 Number of models ..........: 2
310 311 Number of parameters ......: 10
... ... @@ -320,13 +321,10 @@ cover the 0.1-100 TeV energy range and a field of view of 5°.
320 321 The ``South_0.5h`` IRF from the Prod2 calibration database will be used.
321 322 A model is then appended to the observation container using the
322 323 ``obs.models()`` method.
323   -The ``obsutils.sim()`` function then simulates the event data, the
324   -``obsutils.fit()`` function performs a maximum likelihood fit.
325   -
326   -.. note::
327   -
328   - The ``obsutils`` module is not yet fully developed and more convenience
329   - functions will be added in the future.
  324 +The ``obsutils.sim()`` function then simulates the event data and returns
  325 +an observation container with the simulated observations.
  326 +The observation container is then passed to ``ctlike`` for maximum likelihood
  327 +fitting.
330 328  
331 329  
332 330 Access analysis results
... ... @@ -365,13 +363,21 @@ In the following it is assumed that you have a ctlike object called
365 363  
366 364 .. code-block:: python
367 365  
368   - like.opt().value() # Returns likelihood value
  366 + logL = like.opt().value() # Returns log-likelihood value
  367 + print(logL)
  368 +
  369 + or alternatively
  370 +
  371 + .. code-block:: python
  372 +
  373 + logL = like.obs().function().value() # Returns log-likelihood value
  374 + print(logL)
369 375  
370 376 * Curvature Matrix (aka Hessian)
371 377  
372 378 .. code-block:: python
373 379  
374   - curvature = like.opt().curvature().invert() # Return GMatrix object
  380 + curvature = like.obs().function().curvature() # Return GMatrixSparse object
375 381 print(curvature)
376 382  
377 383 To get the covariance matrix, the curvature matrix needs to be
... ...
doc/source/users/user_manual/getting_started/response.rst renamed to doc/source/users/user_manual/response.rst
src/ctbkgcube/ctbkgcube.cpp
... ... @@ -315,7 +315,8 @@ void ctbkgcube::run(void)
315 315 model.name("BackgroundModel");
316 316  
317 317 // Set model instruments
318   - model.instruments(instruments);
  318 + //model.instruments(instruments);
  319 + model.instruments("CTA,HESS,MAGIC,VERITAS"); // Temporary fix for #2140
319 320  
320 321 // Append model to output container
321 322 m_outmdl.append(model);
... ...
test/data/irf.root
No preview for this file type