Commit d46008b15a39effb2748fd93ceba6390c0ddb01e

Authored by Christoph Deil
1 parent 45cc2f23

Misc Python formatting / import fixes in examples

cscripts/cshessobs.py
... ... @@ -374,8 +374,8 @@ class cshessobs(ctools.cscript):
374 374  
375 375 # Initialise empty xml file and append an observation list
376 376 self.xml = gammalib.GXml()
377   - self.xml.append(gammalib.GXmlElement("observation_list title=\"observation list\""));
378   - lib = self.xml.element("observation_list", 0);
  377 + self.xml.append(gammalib.GXmlElement("observation_list title=\"observation list\""))
  378 + lib = self.xml.element("observation_list", 0)
379 379  
380 380 # Read runlist from file
381 381 runlist = []
... ...
cscripts/cspull.py
... ... @@ -337,16 +337,16 @@ class cspull(ctools.cscript):
337 337 """
338 338  
339 339 # Setup observation definition list
340   - obsdeflist = obsutils.set_obs_patterns(self.m_pattern, \
341   - ra=self["ra"].real(), dec=self["dec"].real(), \
  340 + obsdeflist = obsutils.set_obs_patterns(self.m_pattern,
  341 + ra=self["ra"].real(), dec=self["dec"].real(),
342 342 offset=self["offset"].real())
343 343  
344 344 # Create list of observations
345   - obs = obsutils.set_obs_list(obsdeflist, \
346   - tstart=self["tmin"].real(), duration=self["tmax"].real()-self["tmin"].real(), \
347   - deadc=self["deadc"].real(), \
348   - emin=self["emin"].real(), emax=self["emax"].real(), \
349   - rad=self["rad"].real(), \
  345 + obs = obsutils.set_obs_list(obsdeflist,
  346 + tstart=self["tmin"].real(), duration=self["tmax"].real()-self["tmin"].real(),
  347 + deadc=self["deadc"].real(),
  348 + emin=self["emin"].real(), emax=self["emax"].real(),
  349 + rad=self["rad"].real(),
350 350 irf=self["irf"].string(), caldb=self["caldb"].string())
351 351  
352 352 # Return observation container
... ... @@ -366,14 +366,14 @@ class cspull(ctools.cscript):
366 366 self.log.header2("Trial "+str(seed+1))
367 367  
368 368 # Simulate events
369   - obs = obsutils.sim(self.obs, \
370   - nbins=self.m_enumbins, \
371   - seed=seed, \
372   - binsz=self.m_binsz, \
373   - npix=self.m_npix, \
374   - edisp=self.m_edisp, \
375   - log=self.m_log, \
376   - debug=self.m_debug, \
  369 + obs = obsutils.sim(self.obs,
  370 + nbins=self.m_enumbins,
  371 + seed=seed,
  372 + binsz=self.m_binsz,
  373 + npix=self.m_npix,
  374 + edisp=self.m_edisp,
  375 + log=self.m_log,
  376 + debug=self.m_debug,
377 377 chatter=self.m_chatter)
378 378  
379 379 # If stacked, add stacked responses and model
... ... @@ -398,14 +398,14 @@ class cspull(ctools.cscript):
398 398 models = obs.models()
399 399 for i in range(models.size()):
400 400 model_name = models[i].name()
401   - like = obsutils.cterror(obs, model_name, \
402   - log=self.m_log, \
  401 + like = obsutils.cterror(obs, model_name,
  402 + log=self.m_log,
403 403 debug=self.m_debug,
404 404 chatter=self.m_chatter)
405 405 else:
406   - like = obsutils.fit(obs, edisp=self.m_edisp, \
407   - log=self.m_log, \
408   - debug=self.m_debug, \
  406 + like = obsutils.fit(obs, edisp=self.m_edisp,
  407 + log=self.m_log,
  408 + debug=self.m_debug,
409 409 chatter=self.m_chatter)
410 410  
411 411 # Store results
... ...
cscripts/cssens.py
... ... @@ -166,8 +166,8 @@ class cssens(ctools.cscript):
166 166 self.m_debug = self["debug"].boolean() # Debugging in client tools
167 167  
168 168 # Derive some parameters
169   - self.m_ebounds = gammalib.GEbounds(self.m_bins, \
170   - gammalib.GEnergy(self.m_emin, "TeV"), \
  169 + self.m_ebounds = gammalib.GEbounds(self.m_bins,
  170 + gammalib.GEnergy(self.m_emin, "TeV"),
171 171 gammalib.GEnergy(self.m_emax, "TeV"))
172 172  
173 173 # Return
... ... @@ -200,7 +200,7 @@ class cssens(ctools.cscript):
200 200 self.log("\n")
201 201  
202 202 # Initialise script
203   - colnames = ['loge', 'emin', 'emax', 'crab_flux', 'photon_flux', \
  203 + colnames = ['loge', 'emin', 'emax', 'crab_flux', 'photon_flux',
204 204 'energy_flux', 'sensitivity']
205 205 results = []
206 206  
... ... @@ -242,7 +242,7 @@ class cssens(ctools.cscript):
242 242 raise gammalib.GException.invalid_value("cssens", msg)
243 243  
244 244 # Determine sensitivity
245   - result = self.get_sensitivity(self.obs, emin, emax, \
  245 + result = self.get_sensitivity(self.obs, emin, emax,
246 246 bkg_model, full_model)
247 247  
248 248 # Write results
... ... @@ -297,8 +297,8 @@ class cssens(ctools.cscript):
297 297 pntdir.lb_deg(lpnt, bpnt)
298 298  
299 299 # Create CTA observation
300   - run = obsutils.set_obs(pntdir, caldb=caldb, irf=irf, \
301   - duration=duration, deadc=deadc, \
  300 + run = obsutils.set_obs(pntdir, caldb=caldb, irf=irf,
  301 + duration=duration, deadc=deadc,
302 302 emin=emin, emax=emax, rad=rad)
303 303  
304 304 # Append observation to container
... ... @@ -464,8 +464,8 @@ class cssens(ctools.cscript):
464 464 obs.models(src_model)
465 465  
466 466 # Simulate events
467   - sim = obsutils.sim(obs, nbins=self.m_enumbins, seed=iter, \
468   - binsz=self.m_binsz, npix=self.m_npix, \
  467 + sim = obsutils.sim(obs, nbins=self.m_enumbins, seed=iter,
  468 + binsz=self.m_binsz, npix=self.m_npix,
469 469 log=self.m_log, debug=self.m_debug)
470 470  
471 471 # Determine number of events in simulation
... ...
cscripts/cstsdist.py
... ... @@ -328,16 +328,19 @@ class cstsdist(ctools.cscript):
328 328 """
329 329  
330 330 # Setup observation definition list
331   - obsdeflist = obsutils.set_obs_patterns(self.m_pattern, \
332   - ra=self["ra"].real(), dec=self["dec"].real(), \
  331 + obsdeflist = obsutils.set_obs_patterns(self.m_pattern,
  332 + ra=self["ra"].real(),
  333 + dec=self["dec"].real(),
333 334 offset=self["offset"].real())
334 335  
335 336 # Create list of observations
336   - obs = obsutils.set_obs_list(obsdeflist, \
337   - tstart=self["tmin"].real(), duration=self["tmax"].real()-self["tmin"].real(), \
338   - deadc=self["deadc"].real(), \
339   - emin=self["emin"].real(), emax=self["emax"].real(), \
340   - rad=self["rad"].real(), \
  337 + obs = obsutils.set_obs_list(obsdeflist,
  338 + tstart=self["tmin"].real(),
  339 + duration=self["tmax"].real()-self["tmin"].real(),
  340 + deadc=self["deadc"].real(),
  341 + emin=self["emin"].real(),
  342 + emax=self["emax"].real(),
  343 + rad=self["rad"].real(),
341 344 irf=self["irf"].string(), caldb=self["caldb"].string())
342 345  
343 346 # Return observation container
... ... @@ -355,11 +358,11 @@ class cstsdist(ctools.cscript):
355 358 self.log.header2("Trial "+str(seed+1))
356 359  
357 360 # Simulate events
358   - sim = obsutils.sim(self.obs, \
359   - nbins=self.m_enumbins, \
360   - seed=seed, \
361   - binsz=self.m_binsz, \
362   - npix=self.m_npix, \
  361 + sim = obsutils.sim(self.obs,
  362 + nbins=self.m_enumbins,
  363 + seed=seed,
  364 + binsz=self.m_binsz,
  365 + npix=self.m_npix,
363 366 log=self.m_log, debug=self.m_debug)
364 367  
365 368 # Determine number of events in simulation
... ...
examples/benchmark_cta_analysis.py
... ... @@ -20,7 +20,6 @@
20 20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 21 #
22 22 # ==========================================================================
23   -import gammalib
24 23 import ctools
25 24 import time
26 25 try:
... ...
examples/check_models.py
... ... @@ -24,114 +24,113 @@
24 24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 25 #
26 26 # ==========================================================================
27   -import gammalib
28   -import ctools
29 27 import sys
  28 +import ctools
30 29  
31 30  
32 31 # ================= #
33 32 # Analysis pipeline #
34 33 # ================= #
35 34 def pipeline(model_name):
36   - """
37   - Unbinned analysis pipeline - keep intermediate results in memory.
38   -
  35 + """
  36 + Unbinned analysis pipeline - keep intermediate results in memory.
  37 +
39 38 This function implements an analysis pipeline that successively calls
40 39 ctobssim, ctselect and ctlike without saving the intermediate results as
41   - FITS files on disk. All data is only hold in memory.
42   - """
43   - # Set script parameters
44   - caldb = "prod2"
45   - irf = "South_50h"
46   - ra = 83.63
47   - dec = 22.01
48   - rad_sim = 10.0
49   - tstart = 0.0
50   - tstop = 1800.0
51   - emin = 0.1
52   - emax = 100.0
53   - rad_select = 3.0
54   -
55   - # Write model name
56   - print("*** Model: "+model_name+" ************************************")
57   -
58   - # Initialise timing
59   - wall_seconds = 0.0
60   - cpu_seconds = 0.0
61   -
62   - # Simulate events
63   - sim = ctools.ctobssim()
64   - sim["inmodel"] = model_name
65   - sim["caldb"] = caldb
66   - sim["irf"] = irf
67   - sim["ra"] = ra
68   - sim["dec"] = dec
69   - sim["rad"] = rad_sim
70   - sim["tmin"] = tstart
71   - sim["tmax"] = tstop
72   - sim["emin"] = emin
73   - sim["emax"] = emax
74   - sim.run()
75   -
76   - # Select events
77   - select = ctools.ctselect(sim.obs())
78   - select["ra"] = ra
79   - select["dec"] = dec
80   - select["rad"] = rad_select
81   - select["tmin"] = tstart
82   - select["tmax"] = tstop
83   - select["emin"] = emin
84   - select["emax"] = emax
85   - select.run()
86   -
87   - # Perform maximum likelihood fitting
88   - like = ctools.ctlike(select.obs())
89   - like.run()
90   -
91   - # Show model fitting results
92   - print(like.obs().models()[0])
93   -
94   - # Return
95   - return
  40 + FITS files on disk. All data is only hold in memory.
  41 + """
  42 + # Set script parameters
  43 + caldb = "prod2"
  44 + irf = "South_50h"
  45 + ra = 83.63
  46 + dec = 22.01
  47 + rad_sim = 10.0
  48 + tstart = 0.0
  49 + tstop = 1800.0
  50 + emin = 0.1
  51 + emax = 100.0
  52 + rad_select = 3.0
  53 +
  54 + # Write model name
  55 + print("*** Model: "+model_name+" ************************************")
  56 +
  57 + # Initialise timing
  58 + wall_seconds = 0.0
  59 + cpu_seconds = 0.0
  60 +
  61 + # Simulate events
  62 + sim = ctools.ctobssim()
  63 + sim["inmodel"] = model_name
  64 + sim["caldb"] = caldb
  65 + sim["irf"] = irf
  66 + sim["ra"] = ra
  67 + sim["dec"] = dec
  68 + sim["rad"] = rad_sim
  69 + sim["tmin"] = tstart
  70 + sim["tmax"] = tstop
  71 + sim["emin"] = emin
  72 + sim["emax"] = emax
  73 + sim.run()
  74 +
  75 + # Select events
  76 + select = ctools.ctselect(sim.obs())
  77 + select["ra"] = ra
  78 + select["dec"] = dec
  79 + select["rad"] = rad_select
  80 + select["tmin"] = tstart
  81 + select["tmax"] = tstop
  82 + select["emin"] = emin
  83 + select["emax"] = emax
  84 + select.run()
  85 +
  86 + # Perform maximum likelihood fitting
  87 + like = ctools.ctlike(select.obs())
  88 + like.run()
  89 +
  90 + # Show model fitting results
  91 + print(like.obs().models()[0])
  92 +
  93 + # Return
  94 + return
96 95  
97 96  
98 97 #==========================#
99 98 # Main routine entry point #
100 99 #==========================#
101 100 if __name__ == '__main__':
102   - """
103   - Perform unbinned analyses for various models.
104   - """
105   - # Initialise flags
106   - need_help = False
107   -
108   - # Test for command line arguments
109   - print(sys.argv[0])
110   - if (len(sys.argv) > 1):
111   - if sys.argv[1] == "-h":
112   - need_help = True
113   - else:
114   - need_help = True
115   -
116   - # Print help if needed and exit
117   - if need_help:
118   - print("Usage: check_models.py [OPTIONS]")
119   - print(" -h Display this usage message")
120   - sys.exit()
121   -
122   - # Dump header
123   - print("*******************************************")
124   - print("* Check models using an unbinned analysis *")
125   - print("*******************************************")
126   -
127   - # Perform analysis for Crab model
128   - pipeline("$CTOOLS/share/models/crab.xml")
129   -
130   - # Perform analysis for disk model
131   - pipeline("$CTOOLS/share/models/disk.xml")
132   -
133   - # Perform analysis for Gaussian model
134   - pipeline("$CTOOLS/share/models/gauss.xml")
135   -
136   - # Perform analysis for shell model
137   - pipeline("$CTOOLS/share/models/shell.xml")
  101 + """
  102 + Perform unbinned analyses for various models.
  103 + """
  104 + # Initialise flags
  105 + need_help = False
  106 +
  107 + # Test for command line arguments
  108 + print(sys.argv[0])
  109 + if (len(sys.argv) > 1):
  110 + if sys.argv[1] == "-h":
  111 + need_help = True
  112 + else:
  113 + need_help = True
  114 +
  115 + # Print help if needed and exit
  116 + if need_help:
  117 + print("Usage: check_models.py [OPTIONS]")
  118 + print(" -h Display this usage message")
  119 + sys.exit()
  120 +
  121 + # Dump header
  122 + print("*******************************************")
  123 + print("* Check models using an unbinned analysis *")
  124 + print("*******************************************")
  125 +
  126 + # Perform analysis for Crab model
  127 + pipeline("$CTOOLS/share/models/crab.xml")
  128 +
  129 + # Perform analysis for disk model
  130 + pipeline("$CTOOLS/share/models/disk.xml")
  131 +
  132 + # Perform analysis for Gaussian model
  133 + pipeline("$CTOOLS/share/models/gauss.xml")
  134 +
  135 + # Perform analysis for shell model
  136 + pipeline("$CTOOLS/share/models/shell.xml")
... ...
examples/make_pointings.py
... ... @@ -23,9 +23,9 @@
23 23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 24 #
25 25 # ==========================================================================
26   -import gammalib
27 26 import sys
28 27 import math
  28 +import gammalib
29 29  
30 30  
31 31 # ============================================================ #
... ... @@ -82,8 +82,8 @@ def get_positions(xmin, xmax, ymin, ymax, step):
82 82 # ====================== #
83 83 # Setup patch on the sky #
84 84 # ====================== #
85   -def set_patch(lmin=-30.0, lmax=30.0, bmin=-1.5, bmax=+1.5, \
86   - separation=3.0, hours=100.0, \
  85 +def set_patch(lmin=-30.0, lmax=30.0, bmin=-1.5, bmax=+1.5,
  86 + separation=3.0, hours=100.0,
87 87 site=None, lst=True, autodec=0.0):
88 88 """
89 89 Setup pointing patch on the sky.
... ... @@ -147,11 +147,11 @@ def set_patch(lmin=-30.0, lmax=30.0, bmin=-1.5, bmax=+1.5, \
147 147  
148 148 # Dump statistics
149 149 print("Number of pointings: %d (%.2f sec)" % (n_pnt,duration))
150   - print("South array .......: %.2f hours (%.2f%%)" % \
151   - (exposure_south/3600.0, \
  150 + print("South array .......: %.2f hours (%.2f%%)" %
  151 + (exposure_south/3600.0,
152 152 100.0*exposure_south/(exposure_south+exposure_north)))
153   - print("North array .......: %.2f hours (%.2f%%)" % \
154   - (exposure_north/3600.0, \
  153 + print("North array .......: %.2f hours (%.2f%%)" %
  154 + (exposure_north/3600.0,
155 155 100.0*exposure_north/(exposure_south+exposure_north)))
156 156  
157 157 # Return observation definition
... ... @@ -169,28 +169,28 @@ def set_gps(separation=3.0, bmin=-1.3, bmax=1.3, lst=True):
169 169 obsdef = []
170 170  
171 171 # Add inner region South
172   - obsdef.extend(set_patch(lmin=-60.0, lmax=60.0, bmin=bmin, bmax=bmax, \
173   - separation=separation, hours=780, \
  172 + obsdef.extend(set_patch(lmin=-60.0, lmax=60.0, bmin=bmin, bmax=bmax,
  173 + separation=separation, hours=780,
174 174 site="South", lst=lst))
175 175  
176 176 # Add Vela & Carina region
177   - obsdef.extend(set_patch(lmin=240.0, lmax=300.0, bmin=bmin, bmax=bmax, \
178   - separation=separation, hours=180, \
  177 + obsdef.extend(set_patch(lmin=240.0, lmax=300.0, bmin=bmin, bmax=bmax,
  178 + separation=separation, hours=180,
179 179 site="South", lst=lst))
180 180  
181 181 # Add 210-240 region
182   - obsdef.extend(set_patch(lmin=210.0, lmax=240.0, bmin=bmin, bmax=bmax, \
183   - separation=separation, hours=60, \
  182 + obsdef.extend(set_patch(lmin=210.0, lmax=240.0, bmin=bmin, bmax=bmax,
  183 + separation=separation, hours=60,
184 184 site="South", lst=lst))
185 185  
186 186 # Add Cygnus, Perseus
187   - obsdef.extend(set_patch(lmin=60.0, lmax=150.0, bmin=bmin, bmax=bmax, \
188   - separation=separation, hours=450, \
  187 + obsdef.extend(set_patch(lmin=60.0, lmax=150.0, bmin=bmin, bmax=bmax,
  188 + separation=separation, hours=450,
189 189 site="North", lst=lst))
190 190  
191 191 # Add Anticentre
192   - obsdef.extend(set_patch(lmin=150.0, lmax=210.0, bmin=bmin, bmax=bmax, \
193   - separation=separation, hours=150, \
  192 + obsdef.extend(set_patch(lmin=150.0, lmax=210.0, bmin=bmin, bmax=bmax,
  193 + separation=separation, hours=150,
194 194 site="North", lst=lst))
195 195  
196 196 # Return observation definition
... ... @@ -208,8 +208,8 @@ def set_extgal(separation=3.0, lst=True):
208 208 obsdef = []
209 209  
210 210 # Set patch
211   - obsdef.extend(set_patch(lmin=-90.0, lmax=90.0, bmin=+5.0, bmax=+88.0, \
212   - separation=separation, hours=1000, \
  211 + obsdef.extend(set_patch(lmin=-90.0, lmax=90.0, bmin=+5.0, bmax=+88.0,
  212 + separation=separation, hours=1000,
213 213 site="Automatic", lst=lst, autodec=10.0))
214 214  
215 215 # Return observation definition
... ... @@ -227,13 +227,13 @@ def set_gc(lst=True):
227 227 obsdef = []
228 228  
229 229 # Central wobble
230   - obsdef.extend(set_patch(lmin=-0.5, lmax=0.5, bmin=-0.5, bmax=0.5, \
231   - separation=0.1, hours=525, \
  230 + obsdef.extend(set_patch(lmin=-0.5, lmax=0.5, bmin=-0.5, bmax=0.5,
  231 + separation=0.1, hours=525,
232 232 site="South", lst=lst))
233 233  
234 234 # Extended region
235   - obsdef.extend(set_patch(lmin=-10.0, lmax=10.0, bmin=-10.0, bmax=10.0, \
236   - separation=1.5, hours=300, \
  235 + obsdef.extend(set_patch(lmin=-10.0, lmax=10.0, bmin=-10.0, bmax=10.0,
  236 + separation=1.5, hours=300,
237 237 site="South", lst=lst))
238 238  
239 239 # Return observation definition
... ... @@ -322,7 +322,7 @@ def write_obsdef(filename, obsdef):
322 322 dec = obs["dec"]
323 323  
324 324 # Write information
325   - file.write("%8.4f,%8.4f,%.4f,%s,%s\n" % \
  325 + file.write("%8.4f,%8.4f,%.4f,%s,%s\n" %
326 326 (ra, dec, obs['duration'], obs['caldb'], obs['irf']))
327 327  
328 328 # Close file
... ... @@ -387,5 +387,4 @@ if __name__ == &#39;__main__&#39;:
387 387  
388 388 # Invalid pattern
389 389 else:
390   - print("Unknown option \""+obsname+"\"")
391   -
  390 + print('Unknown option "' + obsname + '"')
... ...
examples/make_pull_at_sensitivity_limit.py
... ... @@ -24,11 +24,11 @@
24 24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 25 #
26 26 # ==========================================================================
27   -from ctools import *
28   -from gammalib import *
29   -from cspull import *
30 27 import sys
31 28 import time
  29 +import csv
  30 +import gammalib
  31 +from cscripts import cspull
32 32  
33 33 # Try importing processing module
34 34 has_processing = False
... ... @@ -42,7 +42,7 @@ except:
42 42 # ======================== #
43 43 # Create pull distribution #
44 44 # ======================== #
45   -def create_pull(loge, emin, emax, models, ntrials=100, duration=180000.0, \
  45 +def create_pull(loge, emin, emax, models, ntrials=100, duration=180000.0,
46 46 enumbins=0, log=False):
47 47 """
48 48 Create pull distribution
... ... @@ -94,8 +94,8 @@ def create_model(flux, index=-2.48, fitidx=False):
94 94 flux - Flux in Crab units
95 95 """
96 96 # Define background model
97   - bgd_radial = GCTAModelRadialGauss(3.0)
98   - bgd_spectrum = GModelSpectralPlaw(61.8, -1.85)
  97 + bgd_radial = gammalib.GCTAModelRadialGauss(3.0)
  98 + bgd_spectrum = gammalib.GModelSpectralPlaw(61.8, -1.85)
99 99 bgd_spectrum["Prefactor"].scale(1.0e-6)
100 100 bgd_spectrum["PivotEnergy"].value(1.0)
101 101 bgd_spectrum["PivotEnergy"].scale(1.0e6)
... ... @@ -103,15 +103,15 @@ def create_model(flux, index=-2.48, fitidx=False):
103 103 bgd_spectrum["Index"].free()
104 104 else:
105 105 bgd_spectrum["Index"].fix()
106   - bgd_model = GCTAModelRadialAcceptance(bgd_radial, bgd_spectrum)
  106 + bgd_model = gammalib.GCTAModelRadialAcceptance(bgd_radial, bgd_spectrum)
107 107 bgd_model.name("Background")
108 108 bgd_model.instruments("CTA")
109 109  
110 110 # Define source spectrum
111   - location = GSkyDir()
  111 + location = gammalib.GSkyDir()
112 112 location.radec_deg(83.6331, 22.0145)
113   - src_spatial = GModelSpatialPtsrc(location)
114   - src_spectrum = GModelSpectralPlaw(flux, index)
  113 + src_spatial = gammalib.GModelSpatialPtsrc(location)
  114 + src_spectrum = gammalib.GModelSpectralPlaw(flux, index)
115 115 src_spectrum["Prefactor"].scale(5.7e-16)
116 116 src_spectrum["PivotEnergy"].value(0.3)
117 117 src_spectrum["PivotEnergy"].scale(1.0e6)
... ... @@ -119,11 +119,11 @@ def create_model(flux, index=-2.48, fitidx=False):
119 119 src_spectrum["Index"].free()
120 120 else:
121 121 src_spectrum["Index"].fix()
122   - src_model = GModelPointSource(src_spatial, src_spectrum)
  122 + src_model = gammalib.GModelPointSource(src_spatial, src_spectrum)
123 123 src_model.name("Test")
124 124  
125 125 # Add models to container
126   - models = GModels()
  126 + models = gammalib.GModels()
127 127 models.append(bgd_model)
128 128 models.append(src_model)
129 129  
... ... @@ -141,7 +141,11 @@ if __name__ == &#39;__main__&#39;:
141 141 cssens script.
142 142 """
143 143 # Get input arguments
144   - usage = "make_pull_at_sensitivity_limit filename [max_threads]"
  144 + usage = """
  145 + make_pull_at_sensitivity_limit filename [max_threads]
  146 +
  147 + Run cssens to create the input file.
  148 + """
145 149 if len(sys.argv) < 2 or len(sys.argv) > 3:
146 150 print(usage)
147 151 sys.exit()
... ...
examples/make_spectrum.py
... ... @@ -20,7 +20,7 @@
20 20 # ==========================================================================
21 21 import gammalib
22 22 import ctools
23   -from ctools import obsutils
  23 +from cscripts import obsutils
24 24 try:
25 25 import matplotlib.pyplot as plt
26 26 has_matplotlib = True
... ... @@ -84,10 +84,10 @@ def plot_spectrum(spectrum):
84 84 plt.title("Crab spectrum")
85 85  
86 86 # Plot spectrum
87   - plt.loglog(spectrum['energy']['value'], \
  87 + plt.loglog(spectrum['energy']['value'],
88 88 spectrum['flux']['value'], 'ro', label='Crab')
89   - plt.errorbar(spectrum['energy']['value'], \
90   - spectrum['flux']['value'], \
  89 + plt.errorbar(spectrum['energy']['value'],
  90 + spectrum['flux']['value'],
91 91 spectrum['flux']['ed_value'], ecolor='r')
92 92  
93 93 # Put labels
... ... @@ -115,4 +115,3 @@ if __name__ == &#39;__main__&#39;:
115 115 # Plot spectrum
116 116 if has_matplotlib:
117 117 plot_spectrum(spectrum)
118   -
119 118 \ No newline at end of file
... ...
examples/make_survey.py
... ... @@ -23,11 +23,12 @@
23 23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 24 #
25 25 # ==========================================================================
26   -import gammalib
27   -from ctools import obsutils
28 26 import os
29 27 import glob
30 28 import sys
  29 +import math
  30 +import gammalib
  31 +from cscripts import obsutils
31 32  
32 33  
33 34 # =========== #
... ... @@ -86,7 +87,7 @@ def plot_counts(obs):
86 87 counts[index] = counts[index] + 1.0
87 88  
88 89 # Create error bars
89   - error = [sqrt(c) for c in counts]
  90 + error = [math.sqrt(c) for c in counts]
90 91  
91 92 # Plot spectrum
92 93 plt.loglog(energy, counts, 'ro', label='data')
... ... @@ -140,7 +141,7 @@ def plot_counts(obs):
140 141 counts[index] = counts[index] + 1.0
141 142  
142 143 # Create error bars
143   - error = [sqrt(c) for c in counts]
  144 + error = [math.sqrt(c) for c in counts]
144 145  
145 146 # Plot distribution
146 147 #plt.semilogy(offset2, counts, 'ro', label='data')
... ...
examples/make_ts_distributions.py
... ... @@ -28,9 +28,9 @@
28 28 # along with this program. If not, see <http://www.gnu.org/licenses/>.
29 29 #
30 30 # ==========================================================================
31   -from ctools.cstsdist import *
32 31 import sys
33 32 import time
  33 +from cscripts import cstsdist
34 34  
35 35 # Try importing processing module
36 36 has_processing = False
... ... @@ -44,7 +44,7 @@ except:
44 44 # ====================== #
45 45 # Create TS distribution #
46 46 # ====================== #
47   -def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \
  47 +def create_ts(loge, emin, emax, ntrials=100, duration=180000.0,
48 48 enumbins=0, log=False):
49 49 """
50 50 Create TS distribution.
... ... @@ -110,9 +110,9 @@ if __name__ == &#39;__main__&#39;:
110 110 max_threads = 1
111 111  
112 112 # Parameter dictionnary
113   - pars = [{'option': '-n', 'value': ntrials}, \
114   - {'option': '-e', 'value': enumbins}, \
115   - {'option': '-d', 'value': duration}, \
  113 + pars = [{'option': '-n', 'value': ntrials},
  114 + {'option': '-e', 'value': enumbins},
  115 + {'option': '-d', 'value': duration},
116 116 {'option': '-m', 'value': max_threads}]
117 117  
118 118 # Gather parameters from command line
... ... @@ -165,7 +165,7 @@ if __name__ == &#39;__main__&#39;:
165 165  
166 166 # Set arguments
167 167 args = (loge, emin, emax)
168   - kwargs = {'ntrials': ntrials, 'enumbins': enumbins, \
  168 + kwargs = {'ntrials': ntrials, 'enumbins': enumbins,
169 169 'duration': duration}
170 170  
171 171 # Generate pull distribution
... ... @@ -178,7 +178,7 @@ if __name__ == &#39;__main__&#39;:
178 178  
179 179 # ... no
180 180 else:
181   - create_ts(loge, emin, emax, ntrials=ntrials, enumbins=enumbins, \
  181 + create_ts(loge, emin, emax, ntrials=ntrials, enumbins=enumbins,
182 182 duration=duration)
183 183  
184 184 # Processing support
... ...
examples/pipeline_binned_disk.py
... ... @@ -27,15 +27,15 @@
27 27 # ==========================================================================
28 28 import gammalib
29 29 import ctools
30   -from ctools import obsutils
  30 +from cscripts import obsutils
31 31  
32 32  
33 33 # ================== #
34 34 # Setup observations #
35 35 # ================== #
36   -def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \
37   - emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \
38   - deadc=0.95, \
  36 +def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5,
  37 + emin=0.1, emax=100.0, rad=5.0, duration=1800.0,
  38 + deadc=0.95,
39 39 caldb="prod2", irf="South_50h"):
40 40 """
41 41 Returns an observation container.
... ... @@ -54,18 +54,18 @@ def setup_observations(pattern=&quot;four&quot;, ra=83.63, dec=22.01, offset=1.5, \
54 54 irf - Instrument response function (default: cta_dummy_irf)
55 55 """
56 56 # Set list of observations
57   - obs_def_list = obsutils.set_obs_patterns(pattern, \
58   - ra=ra, \
59   - dec=dec, \
  57 + obs_def_list = obsutils.set_obs_patterns(pattern,
  58 + ra=ra,
  59 + dec=dec,
60 60 offset=offset)
61 61  
62 62 # Get observation container
63   - obs = obsutils.set_obs_list(obs_def_list, \
64   - duration=duration, \
65   - emin=emin, \
66   - emax=emax, \
67   - rad=rad, \
68   - caldb=caldb, \
  63 + obs = obsutils.set_obs_list(obs_def_list,
  64 + duration=duration,
  65 + emin=emin,
  66 + emax=emax,
  67 + rad=rad,
  68 + caldb=caldb,
69 69 irf=irf)
70 70  
71 71 # Return observation container
... ... @@ -92,11 +92,11 @@ def setup_model(obs, model=&quot;${CTOOLS}/share/models/crab.xml&quot;):
92 92 # ================================ #
93 93 # Simulation and analysis pipeline #
94 94 # ================================ #
95   -def run_pipeline(obs, emin=0.1, emax=100.0, \
96   - enumbins=20, nxpix=200, nypix=200, binsz=0.02, \
97   - coordsys="CEL", proj="CAR", \
98   - model="${CTOOLS}/share/models/crab.xml", \
99   - caldb="prod2", irf="South_50h", \
  95 +def run_pipeline(obs, emin=0.1, emax=100.0,
  96 + enumbins=20, nxpix=200, nypix=200, binsz=0.02,
  97 + coordsys="CEL", proj="CAR",
  98 + model="${CTOOLS}/share/models/crab.xml",
  99 + caldb="prod2", irf="South_50h",
100 100 debug=False):
101 101 """
102 102 Simulation and binned analysis pipeline.
... ...
examples/pipeline_binned_mem.py
... ... @@ -27,15 +27,15 @@
27 27 # ==========================================================================
28 28 import gammalib
29 29 import ctools
30   -from ctools import obsutils
  30 +from cscripts import obsutils
31 31  
32 32  
33 33 # ================== #
34 34 # Setup observations #
35 35 # ================== #
36   -def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \
37   - emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \
38   - deadc=0.95, \
  36 +def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5,
  37 + emin=0.1, emax=100.0, rad=5.0, duration=1800.0,
  38 + deadc=0.95,
39 39 caldb="prod2", irf="South_50h"):
40 40 """
41 41 Returns an observation container.
... ... @@ -54,18 +54,18 @@ def setup_observations(pattern=&quot;four&quot;, ra=83.63, dec=22.01, offset=1.5, \
54 54 irf - Instrument response function (default: cta_dummy_irf)
55 55 """
56 56 # Set list of observations
57   - obs_def_list = obsutils.set_obs_patterns(pattern, \
58   - ra=ra, \
59   - dec=dec, \
  57 + obs_def_list = obsutils.set_obs_patterns(pattern,
  58 + ra=ra,
  59 + dec=dec,
60 60 offset=offset)
61 61  
62 62 # Get observation container
63   - obs = obsutils.set_obs_list(obs_def_list, \
64   - duration=duration, \
65   - emin=emin, \
66   - emax=emax, \
67   - rad=rad, \
68   - caldb=caldb, \
  63 + obs = obsutils.set_obs_list(obs_def_list,
  64 + duration=duration,
  65 + emin=emin,
  66 + emax=emax,
  67 + rad=rad,
  68 + caldb=caldb,
69 69 irf=irf)
70 70  
71 71 # Return observation container
... ... @@ -92,8 +92,8 @@ def setup_model(obs, model=&quot;${CTOOLS}/share/models/crab.xml&quot;):
92 92 # ================================ #
93 93 # Simulation and analysis pipeline #
94 94 # ================================ #
95   -def run_pipeline(obs, emin=0.1, emax=100.0, \
96   - enumbins=20, nxpix=200, nypix=200, binsz=0.02, \
  95 +def run_pipeline(obs, emin=0.1, emax=100.0,
  96 + enumbins=20, nxpix=200, nypix=200, binsz=0.02,
97 97 coordsys="CEL", proj="CAR", debug=False):
98 98 """
99 99 Simulation and binned analysis pipeline.
... ...
examples/pipeline_stacked_disk.py
... ... @@ -27,15 +27,15 @@
27 27 # ==========================================================================
28 28 import gammalib
29 29 import ctools
30   -from ctools import obsutils
  30 +from cscripts import obsutils
31 31  
32 32  
33 33 # ================== #
34 34 # Setup observations #
35 35 # ================== #
36   -def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \
37   - emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \
38   - deadc=0.95, \
  36 +def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5,
  37 + emin=0.1, emax=100.0, rad=5.0, duration=1800.0,
  38 + deadc=0.95,
39 39 caldb="prod2", irf="South_50h"):
40 40 """
41 41 Returns an observation container.
... ... @@ -54,18 +54,18 @@ def setup_observations(pattern=&quot;four&quot;, ra=83.63, dec=22.01, offset=1.5, \
54 54 irf - Instrument response function (default: cta_dummy_irf)
55 55 """
56 56 # Set list of observations
57   - obs_def_list = obsutils.set_obs_patterns(pattern, \
58   - ra=ra, \
59   - dec=dec, \
  57 + obs_def_list = obsutils.set_obs_patterns(pattern,
  58 + ra=ra,
  59 + dec=dec,
60 60 offset=offset)
61 61  
62 62 # Get observation container
63   - obs = obsutils.set_obs_list(obs_def_list, \
64   - duration=duration, \
65   - emin=emin, \
66   - emax=emax, \
67   - rad=rad, \
68   - caldb=caldb, \
  63 + obs = obsutils.set_obs_list(obs_def_list,
  64 + duration=duration,
  65 + emin=emin,
  66 + emax=emax,
  67 + rad=rad,
  68 + caldb=caldb,
69 69 irf=irf)
70 70  
71 71 # Return observation container
... ... @@ -92,11 +92,11 @@ def setup_model(obs, model=&quot;${CTOOLS}/share/models/crab.xml&quot;):
92 92 # ================================ #
93 93 # Simulation and analysis pipeline #
94 94 # ================================ #
95   -def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \
96   - enumbins=20, nxpix=200, nypix=200, binsz=0.02, \
97   - coordsys="CEL", proj="CAR", \
98   - model="${CTOOLS}/share/models/crab.xml", \
99   - caldb="prod2", irf="South_50h", \
  95 +def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0,
  96 + enumbins=20, nxpix=200, nypix=200, binsz=0.02,
  97 + coordsys="CEL", proj="CAR",
  98 + model="${CTOOLS}/share/models/crab.xml",
  99 + caldb="prod2", irf="South_50h",
100 100 debug=False):
101 101 """
102 102 Simulation and stacked analysis pipeline.
... ...
examples/pipeline_stacked_mem.py
... ... @@ -27,15 +27,15 @@
27 27 # ==========================================================================
28 28 import gammalib
29 29 import ctools
30   -from ctools import obsutils
  30 +from cscripts import obsutils
31 31  
32 32  
33 33 # ================== #
34 34 # Setup observations #
35 35 # ================== #
36   -def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \
37   - emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \
38   - deadc=0.95, \
  36 +def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5,
  37 + emin=0.1, emax=100.0, rad=5.0, duration=1800.0,
  38 + deadc=0.95,
39 39 caldb="prod2", irf="South_50h"):
40 40 """
41 41 Returns an observation container.
... ... @@ -54,18 +54,18 @@ def setup_observations(pattern=&quot;four&quot;, ra=83.63, dec=22.01, offset=1.5, \
54 54 irf - Instrument response function (default: cta_dummy_irf)
55 55 """
56 56 # Set list of observations
57   - obs_def_list = obsutils.set_obs_patterns(pattern, \
58   - ra=ra, \
59   - dec=dec, \
  57 + obs_def_list = obsutils.set_obs_patterns(pattern,
  58 + ra=ra,
  59 + dec=dec,
60 60 offset=offset)
61 61  
62 62 # Get observation container
63   - obs = obsutils.set_obs_list(obs_def_list, \
64   - duration=duration, \
65   - emin=emin, \
66   - emax=emax, \
67   - rad=rad, \
68   - caldb=caldb, \
  63 + obs = obsutils.set_obs_list(obs_def_list,
  64 + duration=duration,
  65 + emin=emin,
  66 + emax=emax,
  67 + rad=rad,
  68 + caldb=caldb,
69 69 irf=irf)
70 70  
71 71 # Return observation container
... ... @@ -92,8 +92,8 @@ def setup_model(obs, model=&quot;${CTOOLS}/share/models/crab.xml&quot;):
92 92 # ================================ #
93 93 # Simulation and analysis pipeline #
94 94 # ================================ #
95   -def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \
96   - enumbins=20, nxpix=200, nypix=200, binsz=0.02, \
  95 +def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0,
  96 + enumbins=20, nxpix=200, nypix=200, binsz=0.02,
97 97 coordsys="CEL", proj="CAR", debug=False):
98 98 """
99 99 Simulation and stacked analysis pipeline.
... ...
examples/pipeline_unbinned_disk.py
... ... @@ -27,15 +27,15 @@
27 27 # ==========================================================================
28 28 import gammalib
29 29 import ctools
30   -from ctools import obsutils
  30 +from cscripts import obsutils
31 31  
32 32  
33 33 # ================== #
34 34 # Setup observations #
35 35 # ================== #
36   -def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \
37   - emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \
38   - deadc=0.95, \
  36 +def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5,
  37 + emin=0.1, emax=100.0, rad=5.0, duration=1800.0,
  38 + deadc=0.95,
39 39 caldb="prod2", irf="South_50h"):
40 40 """
41 41 Returns an observation container.
... ... @@ -54,18 +54,18 @@ def setup_observations(pattern=&quot;four&quot;, ra=83.63, dec=22.01, offset=1.5, \
54 54 irf - Instrument response function (default: cta_dummy_irf)
55 55 """
56 56 # Set list of observations
57   - obs_def_list = obsutils.set_obs_patterns(pattern, \
58   - ra=ra, \
59   - dec=dec, \
  57 + obs_def_list = obsutils.set_obs_patterns(pattern,
  58 + ra=ra,
  59 + dec=dec,
60 60 offset=offset)
61 61  
62 62 # Get observation container
63   - obs = obsutils.set_obs_list(obs_def_list, \
64   - duration=duration, \
65   - emin=emin, \
66   - emax=emax, \
67   - rad=rad, \
68   - caldb=caldb, \
  63 + obs = obsutils.set_obs_list(obs_def_list,
  64 + duration=duration,
  65 + emin=emin,
  66 + emax=emax,
  67 + rad=rad,
  68 + caldb=caldb,
69 69 irf=irf)
70 70  
71 71 # Return observation container
... ... @@ -92,11 +92,11 @@ def setup_model(obs, model=&quot;${CTOOLS}/share/models/crab.xml&quot;):
92 92 # ================================ #
93 93 # Simulation and analysis pipeline #
94 94 # ================================ #
95   -def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0, \
96   - emin=0.1, emax=100.0, \
97   - tmin=0.0, tmax=0.0, \
98   - model="${CTOOLS}/share/models/crab.xml", \
99   - caldb="prod2", irf="South_50h", \
  95 +def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0,
  96 + emin=0.1, emax=100.0,
  97 + tmin=0.0, tmax=0.0,
  98 + model="${CTOOLS}/share/models/crab.xml",
  99 + caldb="prod2", irf="South_50h",
100 100 debug=False):
101 101 """
102 102 Simulation and unbinned analysis pipeline.
... ...
examples/pipeline_unbinned_mem.py
... ... @@ -27,15 +27,15 @@
27 27 # ==========================================================================
28 28 import gammalib
29 29 import ctools
30   -from ctools import obsutils
  30 +from cscripts import obsutils
31 31  
32 32  
33 33 # ================== #
34 34 # Setup observations #
35 35 # ================== #
36   -def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5, \
37   - emin=0.1, emax=100.0, rad=5.0, duration=1800.0, \
38   - deadc=0.95, \
  36 +def setup_observations(pattern="four", ra=83.63, dec=22.01, offset=1.5,
  37 + emin=0.1, emax=100.0, rad=5.0, duration=1800.0,
  38 + deadc=0.95,
39 39 caldb="prod2", irf="South_50h"):
40 40 """
41 41 Returns an observation container.
... ... @@ -54,18 +54,18 @@ def setup_observations(pattern=&quot;four&quot;, ra=83.63, dec=22.01, offset=1.5, \
54 54 irf - Instrument response function (default: cta_dummy_irf)
55 55 """
56 56 # Set list of observations
57   - obs_def_list = obsutils.set_obs_patterns(pattern, \
58   - ra=ra, \
59   - dec=dec, \
  57 + obs_def_list = obsutils.set_obs_patterns(pattern,
  58 + ra=ra,
  59 + dec=dec,
60 60 offset=offset)
61 61  
62 62 # Get observation container
63   - obs = obsutils.set_obs_list(obs_def_list, \
64   - duration=duration, \
65   - emin=emin, \
66   - emax=emax, \
67   - rad=rad, \
68   - caldb=caldb, \
  63 + obs = obsutils.set_obs_list(obs_def_list,
  64 + duration=duration,
  65 + emin=emin,
  66 + emax=emax,
  67 + rad=rad,
  68 + caldb=caldb,
69 69 irf=irf)
70 70  
71 71 # Return observation container
... ... @@ -92,9 +92,9 @@ def setup_model(obs, model=&quot;${CTOOLS}/share/models/crab.xml&quot;):
92 92 # ================================ #
93 93 # Simulation and analysis pipeline #
94 94 # ================================ #
95   -def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0, \
96   - emin=0.1, emax=100.0, \
97   - tmin=0.0, tmax=0.0, \
  95 +def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0,
  96 + emin=0.1, emax=100.0,
  97 + tmin=0.0, tmax=0.0,
98 98 debug=False):
99 99 """
100 100 Simulation and unbinned analysis pipeline.
... ...
examples/show_pha.py
... ... @@ -24,7 +24,7 @@
24 24 # ==========================================================================
25 25 import sys
26 26 import math
27   -from gammalib import *
  27 +import gammalib
28 28  
29 29  
30 30 # ================= #
... ... @@ -93,7 +93,7 @@ if __name__ == &#39;__main__&#39;:
93 93 filename = sys.argv[1]
94 94  
95 95 # Load PHA spectrum
96   - pha = GPha(filename)
  96 + pha = gammalib.GPha(filename)
97 97 #print(pha)
98 98  
99 99 # Try importing matplotlib
... ...
examples/show_response.py
... ... @@ -265,18 +265,18 @@ if __name__ == &#39;__main__&#39;:
265 265  
266 266 # Set response dictionary
267 267 rsps = [
268   - {'dbname': "dummy", \
269   - 'rspname': "cta_dummy_irf", \
270   - 'name': "Prod1 (Array E, MPIK)", \
271   - 'color': "b"}, \
272   - {'dbname': "e", \
273   - 'rspname': "IFAE20120510_50h", \
274   - 'name': "Prod1 (Array E, IFAE)", \
275   - 'color': "g"}, \
276   - {'dbname': "aar", \
277   - 'rspname': "DESY20140105_50h", \
278   - 'name': "Prod2 (Aar, DESY)", \
279   - 'color': "r"} \
  268 + {'dbname': "dummy",
  269 + 'rspname': "cta_dummy_irf",
  270 + 'name': "Prod1 (Array E, MPIK)",
  271 + 'color': "b"},
  272 + {'dbname': "e",
  273 + 'rspname': "IFAE20120510_50h",
  274 + 'name': "Prod1 (Array E, IFAE)",
  275 + 'color': "g"},
  276 + {'dbname': "aar",
  277 + 'rspname': "DESY20140105_50h",
  278 + 'name': "Prod2 (Aar, DESY)",
  279 + 'color': "r"}
280 280 ]
281 281  
282 282 # Loop over all responses
... ... @@ -297,4 +297,3 @@ if __name__ == &#39;__main__&#39;:
297 297  
298 298 # Show plot
299 299 plt.show()
300   -
301 300 \ No newline at end of file
... ...
examples/show_ts_distribution.py
... ... @@ -178,8 +178,8 @@ def dist_pdf(values, nbins, title):
178 178 nbins += 1
179 179  
180 180 # Create histogram
181   - n, bins, patches = plt.hist(values, nbins, range=[min_value, max_value], \
182   - align='mid', facecolor='green', \
  181 + n, bins, patches = plt.hist(values, nbins, range=[min_value, max_value],
  182 + align='mid', facecolor='green',
183 183 log=True, label="simulations")
184 184  
185 185 # Create expected distribution (onyl for positive TS). We compute the
... ... @@ -239,9 +239,9 @@ if __name__ == &#39;__main__&#39;:
239 239 plot = "pdf"
240 240  
241 241 # Parameter dictionnary
242   - pars = [{'option': '-n', 'value': nbins}, \
243   - {'option': '-c', 'value': tsname}, \
244   - {'option': '-t', 'value': title}, \
  242 + pars = [{'option': '-n', 'value': nbins},
  243 + {'option': '-c', 'value': tsname},
  244 + {'option': '-t', 'value': title},
245 245 {'option': '-p', 'value': plot}]
246 246  
247 247 # Gather parameters from command line
... ... @@ -280,5 +280,3 @@ if __name__ == &#39;__main__&#39;:
280 280 dist_pdf(values, nbins, title)
281 281 else:
282 282 dist_cdf(values, nbins, title)
283   -
284   -
285 283 \ No newline at end of file
... ...
examples/simulate_events.py
... ... @@ -36,8 +36,8 @@ except:
36 36 # ======================== #
37 37 # Create CTA observation #
38 38 # ======================== #
39   -def createobs(ra=86.171648, dec=-1.4774586, rad=5.0, \
40   - emin=0.1, emax=100.0, duration=360000.0, deadc=0.95, \
  39 +def createobs(ra=86.171648, dec=-1.4774586, rad=5.0,
  40 + emin=0.1, emax=100.0, duration=360000.0, deadc=0.95,
41 41 irf="South_50h", caldb="prod2"):
42 42 """
43 43 Create CTA observation.
... ...