diff --git a/examples/make_binned_analysis.py b/examples/make_binned_analysis.py
index 6cc0b3c..cd1d174 100755
--- a/examples/make_binned_analysis.py
+++ b/examples/make_binned_analysis.py
@@ -73,8 +73,8 @@ def pipeline_v1():
# Simulate events
sim = ctools.ctobssim()
sim.logFileOpen() # We need this to explicitely open the log file in Python mode
- sim["infile"].filename(model_name)
- sim["outfile"].filename(events_name)
+ sim["inmodel"].filename(model_name)
+ sim["outevents"].filename(events_name)
sim["caldb"].string(caldb)
sim["irf"].string(irf)
sim["ra"].real(ra)
@@ -94,8 +94,8 @@ def pipeline_v1():
# Bin events into counts map
bin = ctools.ctbin()
bin.logFileOpen() # We need this to explicitely open the log file in Python mode
- bin["evfile"].filename(events_name)
- bin["outfile"].filename(cntmap_name)
+ bin["inobs"].filename(events_name)
+ bin["outcube"].filename(cntmap_name)
bin["ebinalg"].string("LOG")
bin["emin"].real(emin)
bin["emax"].real(emax)
@@ -117,9 +117,9 @@ def pipeline_v1():
# Perform maximum likelihood fitting
like = ctools.ctlike()
like.logFileOpen() # We need this to explicitely open the log file in Python mode
- like["infile"].filename(cntmap_name)
- like["srcmdl"].filename(model_name)
- like["outmdl"].filename(result_name)
+ like["inobs"].filename(cntmap_name)
+ like["inmodel"].filename(model_name)
+ like["outmodel"].filename(result_name)
like["caldb"].string(caldb)
like["irf"].string(irf)
like.execute()
@@ -174,7 +174,7 @@ def pipeline_v2():
# Simulate events
sim = ctools.ctobssim()
- sim["infile"].filename(model_name)
+ sim["inmodel"].filename(model_name)
sim["caldb"].string(caldb)
sim["irf"].string(irf)
sim["ra"].real(ra)
diff --git a/examples/make_cube_analysis.py b/examples/make_cube_analysis.py
index b164e5e..f5d104c 100755
--- a/examples/make_cube_analysis.py
+++ b/examples/make_cube_analysis.py
@@ -20,6 +20,7 @@
# ==========================================================================
import ctools
import gammalib
+from ctools import obsutils
# ================= #
@@ -39,10 +40,10 @@ def pipeline(caldb = "dummy", \
model - Source model
"""
# Set pointing pattern (4 pointings)
- pointings = ctools.obsutils.set_obs_patterns("four", offset=2.0)
+ pointings = obsutils.set_obs_patterns("four", offset=2.0)
# Set CTA observations (default: 1800 sec per pointing)
- obs = ctools.obsutils.set_obs_list(pointings, caldb=caldb, irf=irf)
+ obs = obsutils.set_obs_list(pointings, caldb=caldb, irf=irf)
# Load models
models = gammalib.GModels(model)
@@ -56,7 +57,7 @@ def pipeline(caldb = "dummy", \
# Run ctbin (builds stacked event cube)
bin = ctools.ctbin(sim.obs())
bin.logFileOpen()
- bin["outfile"].filename("cntmap.fits")
+ bin["outcube"].filename("cntmap.fits")
bin["ebinalg"].string("LOG")
bin["emin"].real(0.1)
bin["emax"].real(100.0)
@@ -74,8 +75,8 @@ def pipeline(caldb = "dummy", \
# Run ctexpcube (builds exposure cube)
expcube = ctools.ctexpcube(sim.obs())
expcube.logFileOpen()
- expcube["cntmap"].filename("cntmap.fits")
- expcube["outfile"].filename("expcube.fits")
+ expcube["incube"].filename("cntmap.fits")
+ expcube["outcube"].filename("expcube.fits")
expcube["caldb"].string(caldb)
expcube["irf"].string(irf)
expcube.execute()
@@ -83,8 +84,8 @@ def pipeline(caldb = "dummy", \
# Run ctpsfcube (builds PSF cube)
psfcube = ctools.ctpsfcube(sim.obs())
psfcube.logFileOpen()
- psfcube["cntmap"].filename("NONE")
- psfcube["outfile"].filename("psfcube.fits")
+ psfcube["incube"].filename("NONE")
+ psfcube["outcube"].filename("psfcube.fits")
psfcube["caldb"].string(caldb)
psfcube["irf"].string(irf)
psfcube["ebinalg"].string("LOG")
@@ -105,33 +106,23 @@ def pipeline(caldb = "dummy", \
# Run ctbkgcube (builds background cube)
bkgcube = ctools.ctbkgcube(sim.obs())
bkgcube.logFileOpen()
- bkgcube["cntmap"].filename("cntmap.fits")
- bkgcube["bkgmdl"].filename(model)
- bkgcube["outfile"].filename("bkgcube.fits")
+ bkgcube["incube"].filename("cntmap.fits")
+ bkgcube["inmodel"].filename(model)
+ bkgcube["outcube"].filename("bkgcube.fits")
+ bkgcube["outmodel"].filename("bkgcube.xml")
bkgcube.execute()
# Create observation container for stacked cube analysis
obs.clear()
cta = gammalib.GCTAObservation("cntmap.fits", "expcube.fits", "psfcube.fits")
obs.append(cta)
-
- # Create model for stacked cube analysis
- models = gammalib.GModels(model)
- models.remove("Background")
- spatial = gammalib.GModelSpatialDiffuseCube("bkgcube.fits")
- spectral = gammalib.GModelSpectralConst()
- background = gammalib.GCTAModelCubeBackground(spatial, spectral)
- models.append(background)
- models.save("cube_model.xml")
-
- # Append model to observation container
- obs.models(models)
+ obs.models(gammalib.GModels("bkgcube.xml"))
# Run ctlike
like = ctools.ctlike(obs)
like.logFileOpen()
like["debug"].boolean(True)
- like["outmdl"].filename("cube_results.xml")
+ like["outmodel"].filename("cube_results.xml")
like.execute()
# Return
diff --git a/examples/make_spectrum.py b/examples/make_spectrum.py
index 83e8577..e18bc9e 100755
--- a/examples/make_spectrum.py
+++ b/examples/make_spectrum.py
@@ -20,6 +20,7 @@
# ==========================================================================
import gammalib
import ctools
+from ctools import obsutils
try:
import matplotlib.pyplot as plt
has_matplotlib = True
@@ -47,7 +48,7 @@ def make_spectrum():
# Simulate events
sim = ctools.ctobssim()
- sim["infile"].filename(model_name)
+ sim["inmodel"].filename(model_name)
sim["caldb"].string(caldb)
sim["irf"].string(irf)
sim["ra"].real(ra)
@@ -65,7 +66,7 @@ def make_spectrum():
ebounds = gammalib.GEbounds(10, e_min, e_max)
# Generate spectral points
- spectrum = ctools.obsutils.spectrum(sim.obs(), "Crab", ebounds)
+ spectrum = obsutils.spectrum(sim.obs(), "Crab", ebounds)
# Return spectrum
return spectrum
diff --git a/examples/make_ts_distributions.py b/examples/make_ts_distributions.py
index 3360a2a..ceb6893 100755
--- a/examples/make_ts_distributions.py
+++ b/examples/make_ts_distributions.py
@@ -12,7 +12,7 @@
# Required 3rd party modules:
# - processing (optional)
#
-# Copyright (C) 2011 Jurgen Knodlseder
+# Copyright (C) 2011-2015 Jurgen Knodlseder
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,8 +28,6 @@
# along with this program. If not, see .
#
# ==========================================================================
-from ctools import *
-from gammalib import *
from cstsdist import *
import sys
import time
diff --git a/examples/make_unbinned_analysis.py b/examples/make_unbinned_analysis.py
index 5011035..3859571 100755
--- a/examples/make_unbinned_analysis.py
+++ b/examples/make_unbinned_analysis.py
@@ -7,7 +7,7 @@
# Required 3rd party modules:
# None
#
-# Copyright (C) 2011-2014 Jurgen Knodlseder
+# Copyright (C) 2011-2015 Jurgen Knodlseder
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,9 +23,6 @@
# along with this program. If not, see .
#
# ==========================================================================
-#from ctools import *
-#from gammalib import *
-#from math import *
import gammalib
import ctools
import math
@@ -74,8 +71,8 @@ def pipeline_v1():
# Simulate events
sim = ctools.ctobssim()
sim.logFileOpen()
- sim["infile"].filename(model_name)
- sim["outfile"].filename(events_name)
+ sim["inmodel"].filename(model_name)
+ sim["outevents"].filename(events_name)
sim["caldb"].string(caldb)
sim["irf"].string(irf)
sim["ra"].real(ra)
@@ -95,8 +92,8 @@ def pipeline_v1():
# Select events
select = ctools.ctselect()
select.logFileOpen()
- select["infile"].filename(events_name)
- select["outfile"].filename(selected_events_name)
+ select["inobs"].filename(events_name)
+ select["outobs"].filename(selected_events_name)
select["ra"].real(ra)
select["dec"].real(dec)
select["rad"].real(rad_select)
@@ -114,9 +111,9 @@ def pipeline_v1():
# Perform maximum likelihood fitting
like = ctools.ctlike()
like.logFileOpen()
- like["infile"].filename(selected_events_name)
- like["srcmdl"].filename(model_name)
- like["outmdl"].filename(result_name)
+ like["inobs"].filename(selected_events_name)
+ like["inmodel"].filename(model_name)
+ like["outmodel"].filename(result_name)
like["caldb"].string(caldb)
like["irf"].string(irf)
like.execute()
@@ -164,7 +161,7 @@ def pipeline_v2(show_data):
# Simulate events
sim = ctools.ctobssim()
- sim["infile"].filename(model_name)
+ sim["inmodel"].filename(model_name)
sim["caldb"].string(caldb)
sim["irf"].string(irf)
sim["ra"].real(ra)
@@ -210,9 +207,6 @@ def pipeline_v2(show_data):
print("Total wall time elapsed: "+str(wall_seconds)+" seconds")
print("Total CPU time used ...: "+str(cpu_seconds)+" seconds")
- # Show model fitting results
- #print like.obs().models()
-
# Optionally plot counts
if show_data:
if has_matplotlib:
diff --git a/examples/model_bgd.xml b/examples/model_bgd.xml
deleted file mode 100644
index b927387..0000000
--- a/examples/model_bgd.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-