28 ctbin Generates counts cube
29 ctbkgcube Generates background cube
30 ctbutterfly Compute butterfly
31 ctcubemask Filter counts cube
32 ctedispcube Generates energy dispersion cube
33 cterror Calculates likelihood profile errors
34 ctexpcube Generates exposure cube
35 ctfindvar Search for source variability
36 ctlike Performs maximum likelihood fitting
37 ctmapcube Generates a map cube
38 ctmodel Computes model counts cube
39 ctobssim Simulate CTA observations
40 ctphase Computes the phase of each event
41 ctprob Computes event probability for a given model
42 ctpsfcube Generates point spread function cube
43 ctselect Selects event data
44 ctskymap Generates sky map
45 cttsmap Generates Test Statistics map
46 ctulimit Calculates upper limit
53 csbkgmodel Generates background model for 3D analysis
54 cscaldb Lists available instrument response functions
55 csebins Generates energy boundaries for stacked analysis
56 csfootprint Generates carbon footprint report
57 cslightcrv Computes lightcurve
58 csinfo Checks ctools and GammaLib installations
59 csmodelinfo Shows model container content
60 csmodelmerge Merges several model containers into one file
61 csmodelselect Select models from model definition file
62 csmodelsois Generate map cube from subset of models
63 csobsdef Generates observation definition file
64 csobsinfo Shows observation container content
65 csobsselect Select observations from observation definition file
66 csphagen Generates PHA, ARF, RMF files based on source/background regions
67 csphasecrv Computes phase curve
68 cspull Generates pull distribution
69 csresmap Generates residual map
70 csresspec Generates residual spectrum
71 csscs Performs spectral component separation
72 cssens Computes CTA sensitivity
73 csspec Computes spectral points
74 cssrcdetect Detects sources in sky map
75 cstsdist Generates TS distribution
76 cstsmapmerge Merges slices from Test Statistic map computations
77 cstsmapsplit Creates commands to split the Test Statistic map computations
78 csviscube Computes visibility cube\n
79 csadd2caldb Adds CTA response function to calibration database
80 csobs2caldb Creates a caldb entry from an input observation
81 csroot2caldb Creates a caldb entry from a ROOT performance file
82 csiactdata Shows information about IACT data available on the user machine
83 csiactobs Generates observation definition file for IACT data from observation IDs
84 csfindobs Generates a list of IACT observation IDs
85 csiactcopy Copies IACT data from one location to another
92 comgendb Generate COMPTEL database
93 comlixfit Fit model to data using SRCLIX algorithm
94 comlixmap Create TS map using SRCLIX algorithm
95 comobsadd Combine observations
96 comobsback Generate background model for COMPTEL observations
97 comobsbin Bin COMPTEL observations
98 comobsmodel Generate model for binned COMPTEL observations
99 comobsres Generate residuals of COMPTEL observations
100 comobsselect Select observations from COMPTEL database
101 comobssim Simulate COMPTEL observations
102 compulbin Generate pulse profiles for pulsars
103 comsrcdetect Detect source in TS map
112 Utility function to get command output on old and new Python versions
127 from subprocess
import getoutput
129 from commands
import getoutput
132 return getoutput(cmd)
140 Print available ctools with one-line description to the console
143 print(
'\nAvailable ctools:')
147 print(
'Available cscripts:')
151 print(
'Available comscripts:')
152 print(COMSCRIPT_LIST)
163 Print check information
166 print(
'\nGammalib / ctools setup check:\n')
169 sys.stdout.write(
' GAMMALIB environment variable ... ')
170 gammalib_environ =
'GAMMALIB' in os.environ
177 sys.stdout.write(
' CTOOLS environment variable ... ')
178 ctools_environ =
'CTOOLS' in os.environ
185 sys.stdout.write(
' gammalib Python import .......... ')
189 gammalib_python =
True
192 gammalib_python =
False
195 sys.stdout.write(
' ctools Python import .......... ')
202 ctools_python =
False
205 sys.stdout.write(
' cscripts Python import .......... ')
209 cscripts_python =
True
212 cscripts_python =
False
215 all_ok = gammalib_environ
and ctools_environ
and gammalib_python
and \
216 ctools_python
and cscripts_python
221 print(
'\n ===> Your Gammalib / ctools setup is OK.')
223 print(
'\n ===> WARNING: Your Gammalib / ctools setup is NOT OK!\n')
224 if not gammalib_environ:
225 print(
' - Have you set the GAMMALIB environment variable?')
226 if not ctools_environ:
227 print(
' - Have you set the CTOOLS environment variable?')
228 if not gammalib_python
or not ctools_python
or not cscripts_python:
229 print(
' - Did you source gammalib-init.sh?')
230 print(
' - Did you source ctools-init.sh ?')
231 print(
' - Are you using the correct Python ?')
233 print(
' Gammalib: http://cta.irap.omp.eu/gammalib/')
234 print(
' ctools: http://cta.irap.omp.eu/ctools/')
246 Print setup information
251 gammalib_path = gammalib.__path__[0]
252 gammalib_version = gammalib.__version__
254 gammalib_path =
'Not found'
255 gammalib_version =
'Unknown'
260 ctools_path = ctools.__path__[0]
261 ctools_version = ctools.__version__
263 ctools_path =
'Not found'
264 ctools_version =
'Unknown'
269 cscripts_path = cscripts.__path__[0]
270 cscripts_version = cscripts.__version__
272 cscripts_path =
'Not found'
273 cscripts_version =
'Unknown'
276 gammalib_env = os.environ.get(
'GAMMALIB',
'Not found')
277 ctools_env = os.environ.get(
'CTOOLS',
'Not found')
280 print(
'\nGammalib / ctools setup info:\n')
281 print(
' Gammalib version ................ %s' % gammalib_version)
282 print(
' ctools version ................ %s' % ctools_version)
283 print(
' cscripts version ................ %s' % cscripts_version)
284 print(
' $GAMMALIB environment variable ... %s' % gammalib_env)
285 print(
' $CTOOLS environment variable ... %s' % ctools_env)
286 print(
' Python executable ................ %s' % sys.executable)
287 print(
' gammalib Python module .......... %s' % gammalib_path)
288 print(
' ctools Python module .......... %s' % ctools_path)
289 print(
' cscripts Python module .......... %s' % cscripts_path)
305 Get information from pkg-config
310 Information to extract
312 Library name for which information is to be extracted
317 Information string, 'Not available' if pkg-config is not installed
320 cmd =
'pkg-config --%s %s' % (info, library)
326 if 'not found' in out:
327 out =
'Not available'
338 Print help text into console
341 print(
'\nPrint info about Gammalib and ctools to the console.\n')
342 print(
'Available commands:')
343 print(
' csinfo list List available ctools and cscripts')
344 print(
' csinfo check Check Gammalib / ctools setup')
345 print(
' csinfo info Print Gammalib / ctools setup info')
357 Print information about Gammalib and ctools to the console
374 print(
'\nERROR: invalid command: "%s"' % cmd)
385 if __name__ ==
'__main__':