diff --git a/.gitignore b/.gitignore
index ecb9f76..1c6ae15 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,6 +81,7 @@ test/*.xml
test/*.reg
test/*.trs
test/*.txt
+test/*.eps
test/test_cscripts.sh
test/test_examples.sh
test/reports/*.xml
diff --git a/examples/make_spectrum.py b/examples/make_spectrum.py
index 5c76599..3b99216 100755
--- a/examples/make_spectrum.py
+++ b/examples/make_spectrum.py
@@ -94,14 +94,14 @@ def make_spectrum():
# ============= #
def plot_spectrum(spectrum, file=False):
"""
- Plot spectrum.
+ Plot spectrum
Parameters
----------
spectrum : `~gammalib.GFits`
Spectrum FITS file
- type : str, optional
- Plot type (blank means display on screen)
+ file : bool, optional
+ Plot into a file
"""
# Extract columns from spectrum file
table = spectrum.table(1)
diff --git a/examples/show_butterfly.py b/examples/show_butterfly.py
index f6f094d..294084a 100755
--- a/examples/show_butterfly.py
+++ b/examples/show_butterfly.py
@@ -1,8 +1,8 @@
#! /usr/bin/env python
# ==========================================================================
-# This script shows how to plot a butterfly created with ctbutterfly
+# Shows butterfly diagram created with ctbutterfly
#
-# Copyright (C) 2014-2015 Michael Mayer
+# Copyright (C) 2014-2016 Michael Mayer
#
# 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
@@ -18,12 +18,12 @@
# along with this program. If not, see .
#
# ==========================================================================
-import gammalib
import sys
+import gammalib
try:
import matplotlib.pyplot as plt
except:
- sys.exit("This script needs matplotlib")
+ sys.exit('This script needs the "matplotlib" module')
# ============ #
@@ -32,8 +32,13 @@ except:
if __name__ == "__main__":
# Check for given butterfly file
- if not len(sys.argv) == 2:
- sys.exit("Usage: show_butterfly.py butterfly.txt")
+ if len(sys.argv) < 2:
+ sys.exit('Usage: show_butterfly.py butterfly.txt [file]')
+
+ # Check if plotting in file is requested
+ plotfile = ''
+ if len(sys.argv) == 3:
+ plotfile = sys.argv[2]
# Read given butterfly file
filename = sys.argv[1]
@@ -74,6 +79,11 @@ if __name__ == "__main__":
plt.grid()
plt.plot(line_x,line_y,color='black',ls='-')
plt.fill(butterfly_x,butterfly_y,color='green',alpha=0.5)
- plt.xlabel("Energy (MeV)")
- plt.ylabel(r"E dN/dE (MeV$^{-1}$ s$^{-1}$ cm$^{-2}$)")
- plt.show()
+ plt.xlabel('Energy (MeV)')
+ plt.ylabel('E dN/dE (MeV$^{-1}$ s$^{-1}$ cm$^{-2}$)')
+
+ # Show spectrum or save it into file
+ if len(plotfile) > 0:
+ plt.savefig(plotfile)
+ else:
+ plt.show()
diff --git a/examples/show_model.py b/examples/show_model.py
index 52501e3..25d415a 100755
--- a/examples/show_model.py
+++ b/examples/show_model.py
@@ -1,8 +1,8 @@
#! /usr/bin/env python
# ==========================================================================
-# This script shows a model
+# Shows the photon spectrum of a model
#
-# Copyright (C) 2015 Juergen Knoedlseder
+# Copyright (C) 2015-2016 Juergen Knoedlseder
#
# 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
@@ -18,27 +18,41 @@
# along with this program. If not, see .
#
# ==========================================================================
-import gammalib
import sys
import math
+import gammalib
try:
import matplotlib.pyplot as plt
except:
- sys.exit("This script needs matplotlib")
+ sys.exit('This script needs the "matplotlib" module')
# ======================= #
# Plot spectral component #
# ======================= #
-def plot_spectrum(model, emin=0.01, emax=100.0, enumbins=100):
+def plot_spectrum(model, emin=0.01, emax=100.0, enumbins=100, plotfile=''):
"""
+ Plot spectral model component
+
+ Parameters
+ ----------
+ model : `~gammalib.GModel`
+ Model
+ emin : float, optional
+ Minimum energy (TeV)
+ emax : float, optional
+ Maximum energy (TeV)
+ enumbins : integer, optional
+ Number of energy bins
+ plotfile : str, optional
+ Name of plot file
"""
# Get spectral component
spectrum = model.spectral()
# Setup energy axis
- e_min = gammalib.GEnergy(emin, "TeV")
- e_max = gammalib.GEnergy(emax, "TeV")
+ e_min = gammalib.GEnergy(emin, 'TeV')
+ e_max = gammalib.GEnergy(emax, 'TeV')
ebounds = gammalib.GEbounds(enumbins, e_min, e_max)
# Setup model plot
@@ -48,7 +62,7 @@ def plot_spectrum(model, emin=0.01, emax=100.0, enumbins=100):
max = 0.0
for i in range(enumbins):
energy = ebounds.elogmean(i)
- value = spectrum.eval(energy, gammalib.GTime())
+ value = spectrum.eval(energy)
if value > max:
max = value
if value < min:
@@ -57,22 +71,27 @@ def plot_spectrum(model, emin=0.01, emax=100.0, enumbins=100):
y.append(value)
# Set minimum and maximum
- max = math.pow(10.0, math.log10(max)+1)
- if min < 0.0001*max:
- min = 0.0001*max
- min = math.pow(10.0, math.log10(min)-1)
+ #max = math.pow(10.0, math.log10(max)+1)
+ #if min < 0.0001*max:
+ # min = 0.0001*max
+ #min = math.pow(10.0, math.log10(min)-1)
# Show spectrum
plt.figure()
- plt.title(model.name()+" ("+spectrum.type()+")")
+ plt.title(model.name()+' ('+spectrum.type()+')')
plt.loglog()
plt.grid()
plt.loglog(x, y, color='red')
- plt.xlabel("Energy [TeV]")
- plt.ylabel(r"dN/dE [ph s$^{-1}$ cm$^{-2}$ MeV$^{-1}$]")
- plt.ylim([min,max])
- plt.show()
+ plt.xlabel('Energy (TeV)')
+ plt.ylabel(r'dN/dE (ph s$^{-1}$ cm$^{-2}$ MeV$^{-1}$)')
+ #plt.ylim([min,max])
+
+ # Show spectrum or save it into file
+ if len(plotfile) > 0:
+ plt.savefig(plotfile)
+ else:
+ plt.show()
# Return
return
@@ -85,20 +104,24 @@ if __name__ == "__main__":
# Check for model filename
if len(sys.argv) < 2:
- sys.exit("Usage: show_model.py model.xml [index]")
+ sys.exit('Usage: show_model.py model.xml [name] [file]')
# Get optional model index
- if len(sys.argv) == 3:
- index = int(sys.argv[2])
+ if len(sys.argv) >= 3:
+ name = sys.argv[2]
+ else:
+ name = 0
+ if len(sys.argv) == 4:
+ plotfile = sys.argv[3]
else:
- index = 0
+ plotfile = ''
# Read models XML file
filename = sys.argv[1]
models = gammalib.GModels(filename)
# Extract relevant model
- model = models[index]
+ model = models[name]
# Plot spectrum
- plot_spectrum(model)
+ plot_spectrum(model, plotfile=plotfile)
diff --git a/examples/show_pha.py b/examples/show_pha.py
index 90b8729..e070435 100755
--- a/examples/show_pha.py
+++ b/examples/show_pha.py
@@ -1,12 +1,8 @@
#! /usr/bin/env python
# ==========================================================================
-# This script displays a spectrum in PHA format.
+# Show a spectrum in PHA format.
#
-# Required 3rd party modules:
-# - matplotlib
-# - numpy
-#
-# Copyright (C) 2013 Juergen Knoedlseder
+# Copyright (C) 2013-2016 Juergen Knoedlseder
#
# 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
@@ -25,17 +21,29 @@
import sys
import math
import gammalib
+try:
+ import matplotlib.pyplot as plt
+except:
+ sys.exit('This script needs the "matplotlib" module')
# ================= #
# Show PHA spectrum #
# ================= #
-def show_pha(pha):
+def show_pha(pha, plotfile=''):
"""
+ Show PHA spectrum
+
+ Parameters
+ ----------
+ spectrum : `~gammalib.GPha`
+ PHA file
+ plotfile : str, optional
+ Plot file name
"""
# Create figure
plt.figure(1)
- plt.title("PHA spectrum (" + pha.filename() + ")")
+ plt.title('PHA spectrum (' + pha.filename() + ')')
# Generate energy vector
energy = []
@@ -63,16 +71,19 @@ def show_pha(pha):
# Set axes
if channels:
- plt.xlabel("Channels")
+ plt.xlabel('Channels')
else:
- plt.xlabel("Energy (TeV)")
- plt.ylabel("Counts")
+ plt.xlabel('Energy (TeV)')
+ plt.ylabel('Counts')
- # Show plot
- plt.show()
+ # Show spectrum or save it into file
+ if len(plotfile) > 0:
+ plt.savefig(plotfile)
+ else:
+ plt.show()
# Return
- #return
+ return
# ======================== #
@@ -81,27 +92,21 @@ def show_pha(pha):
if __name__ == '__main__':
# Print usage information
- usage = "Usage: show_pha filename" \
- " [-n bins] [-c column] [-t title] [-p plot]"
+ usage = 'Usage: show_pha filename [file]'
if len(sys.argv) < 2:
print(usage)
sys.exit()
+ # Check if plotting in file is requested
+ plotfile = ''
+ if len(sys.argv) == 3:
+ plotfile = sys.argv[2]
+
# Extract parameters
filename = sys.argv[1]
# Load PHA spectrum
pha = gammalib.GPha(filename)
- #print(pha)
-
- # Try importing matplotlib
- try:
- import matplotlib.pyplot as plt
- has_matplotlib = True
- except ImportError:
- print("Matplotlib is not (correctly) installed on your system.")
- has_matplotlib = False
# Show PHA spectrum
- if has_matplotlib:
- show_pha(pha)
+ show_pha(pha, plotfile=plotfile)
diff --git a/examples/show_pull_evolution.py b/examples/show_pull_evolution.py
index 5d9ae83..8361cda 100755
--- a/examples/show_pull_evolution.py
+++ b/examples/show_pull_evolution.py
@@ -1,19 +1,8 @@
#! /usr/bin/env python
# ==========================================================================
-# This script displays the evolution of the pull distributions as function
-# of the number of samples. The pull distributions are generated using the
-# cspull script. The pull is defined by
+# Shows the evolution of the mean and rms pull
#
-# (fitted value - simulated value) / estimated error
-#
-# and the pull histogram allows to assess possible biases in the fit
-# parameters and errors.
-#
-# Required 3rd party modules:
-# - matplotlib
-# - numpy
-#
-# Copyright (C) 2015 Juergen Knoedlseder
+# Copyright (C) 2015-2016 Juergen Knoedlseder
#
# 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
@@ -29,10 +18,16 @@
# along with this program. If not, see .
#
# ==========================================================================
-import matplotlib.pyplot as plt
-import numpy as np
import sys
import csv
+try:
+ import matplotlib.pyplot as plt
+except:
+ sys.exit('This script needs the "matplotlib" module')
+try:
+ import numpy as np
+except:
+ sys.exit('This script needs the "numpy" module')
# ====================== #
@@ -40,7 +35,14 @@ import csv
# ====================== #
def read_pull(filename, parname):
"""
- Read pull distribution.
+ Read pull distribution
+
+ Parameters
+ ----------
+ filename : str
+ Pull distribution ASCII file
+ parname : str
+ Parameter
"""
# Initialise list
values = []
@@ -58,9 +60,9 @@ def read_pull(filename, parname):
try:
index = row.index(parname)
except:
- sys.stdout.write('ERROR: Parameter "'+parname+'" not found in list:\n')
+ print('ERROR: Parameter "'+parname+'" not found in list:')
for p in row:
- sys.stdout.write(' "'+p+'"\n')
+ print(' "'+p+'"')
raise NameError(parname)
# Handle data rows
@@ -83,11 +85,16 @@ def read_pull(filename, parname):
if __name__ == '__main__':
# Print usage information
- usage = "Usage: show_pull_evolution filename parname"
+ usage = 'Usage: show_pull_evolution filename parname [file]'
if len(sys.argv) < 3:
- sys.stdout.write(usage+"\n")
+ print(usage)
sys.exit()
+ # Check if plotting in file is requested
+ plotfile = ''
+ if len(sys.argv) == 4:
+ plotfile = sys.argv[3]
+
# Extract parameters
filename = sys.argv[1]
parname = sys.argv[2]
@@ -106,17 +113,20 @@ if __name__ == '__main__':
rms.append(np.std(values[0:i]))
# Plot mean and rms evolution
- plt.semilogx(samples, mean, 'r-', label="Mean")
- plt.semilogx(samples, rms, 'b-', label="Std. deviation")
+ plt.semilogx(samples, mean, 'r-', label='Mean')
+ plt.semilogx(samples, rms, 'b-', label='Std. deviation')
# Set plot
- plt.xlabel("Samples")
- plt.ylabel("Value")
+ plt.xlabel('Samples')
+ plt.ylabel('Value')
plt.title(parname)
plt.grid(True)
# Set legend
- plt.legend(loc="upper left")
+ plt.legend(loc='upper left')
- # Show histogram
- plt.show()
+ # Show figure
+ if len(plotfile) > 0:
+ plt.savefig(plotfile)
+ else:
+ plt.show()
diff --git a/examples/show_pull_histogram.py b/examples/show_pull_histogram.py
index d4daf6f..76aef81 100755
--- a/examples/show_pull_histogram.py
+++ b/examples/show_pull_histogram.py
@@ -1,18 +1,8 @@
#! /usr/bin/env python
# ==========================================================================
-# This script displays pull histograms that have been generated using the
-# cspull script. The pull is defined by
+# Shows the pull histogram
#
-# (fitted value - simulated value) / estimated error
-#
-# and the pull histogram allows to assess possible biases in the fit
-# parameters and errors.
-#
-# Required 3rd party modules:
-# - matplotlib
-# - numpy
-#
-# Copyright (C) 2011 Jurgen Knodlseder
+# Copyright (C) 2011-2016 Juergen Knoedlseder
#
# 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,11 +18,17 @@
# along with this program. If not, see .
#
# ==========================================================================
-import matplotlib.mlab as mlab
-import matplotlib.pyplot as plt
-import numpy as np
import sys
import csv
+try:
+ import matplotlib.pyplot as plt
+ import matplotlib.mlab as mlab
+except:
+ sys.exit('This script needs the "matplotlib" module')
+try:
+ import numpy as np
+except:
+ sys.exit('This script needs the "numpy" module')
# ====================== #
@@ -40,7 +36,14 @@ import csv
# ====================== #
def read_pull(filename, parname):
"""
- Read pull distribution.
+ Read pull distribution
+
+ Parameters
+ ----------
+ filename : str
+ Pull distribution ASCII file
+ parname : str
+ Parameter
"""
# Initialise list
values = []
@@ -58,9 +61,9 @@ def read_pull(filename, parname):
try:
index = row.index(parname)
except:
- sys.stdout.write('ERROR: Parameter "'+parname+'" not found in list:\n')
+ print('ERROR: Parameter "'+parname+'" not found in list:')
for p in row:
- sys.stdout.write(' "'+p+'"\n')
+ print(' "'+p+'"')
raise NameError(parname)
# Handle data rows
@@ -83,9 +86,9 @@ def read_pull(filename, parname):
if __name__ == '__main__':
# Print usage information
- usage = "Usage: show_pull_histogram filename parname [bins]"
+ usage = 'Usage: show_pull_histogram filename parname [bins] [file]'
if len(sys.argv) < 3:
- sys.stdout.write(usage+"\n")
+ print(usage)
sys.exit()
# Extract parameters
@@ -95,13 +98,17 @@ if __name__ == '__main__':
nbins = int(sys.argv[3])
else:
nbins = 50
+ if len(sys.argv) == 5:
+ plotfile = sys.argv[4]
+ else:
+ plotfile = ''
# Read values from CSV file
values = read_pull(filename, parname)
# Create histogram
n, bins, patches = plt.hist(values, nbins, range=[-4.0,4.0],
- normed=True, facecolor='green')
+ normed=True, facecolor='green')
# Create expected distribution
y = mlab.normpdf(bins, 0.0, 1.0)
@@ -116,5 +123,8 @@ if __name__ == '__main__':
plt.title(name)
plt.grid(True)
- # Show histogram
- plt.show()
+ # Show figure
+ if len(plotfile) > 0:
+ plt.savefig(plotfile)
+ else:
+ plt.show()
diff --git a/test/data/butterfly.txt b/test/data/butterfly.txt
new file mode 100644
index 0000000..b6f559a
--- /dev/null
+++ b/test/data/butterfly.txt
@@ -0,0 +1,100 @@
+103514 7.97876e-15 7.61983e-15 8.34788e-15
+110917 6.72257e-15 6.4272e-15 7.02571e-15
+118850 5.66416e-15 5.42109e-15 5.91312e-15
+127350 4.77239e-15 4.57237e-15 4.97683e-15
+136458 4.02101e-15 3.8564e-15 4.18893e-15
+146218 3.38794e-15 3.25246e-15 3.52586e-15
+156675 2.85454e-15 2.743e-15 2.96785e-15
+167880 2.40511e-15 2.31326e-15 2.49824e-15
+179887 2.02645e-15 1.95077e-15 2.10302e-15
+192752 1.7074e-15 1.64502e-15 1.7704e-15
+206538 1.43859e-15 1.38713e-15 1.49045e-15
+221309 1.21209e-15 1.16962e-15 1.25483e-15
+237137 1.02126e-15 9.86165e-16 1.05651e-15
+254097 8.6047e-16 8.31443e-16 8.89582e-16
+272270 7.24996e-16 7.00958e-16 7.49072e-16
+291743 6.10851e-16 5.90916e-16 6.30794e-16
+312608 5.14678e-16 4.9812e-16 5.31227e-16
+334965 4.33646e-16 4.1987e-16 4.47406e-16
+358922 3.65372e-16 3.53889e-16 3.76836e-16
+384592 3.07847e-16 2.98257e-16 3.17421e-16
+412098 2.59379e-16 2.51353e-16 2.67393e-16
+441570 2.18542e-16 2.1181e-16 2.25268e-16
+473151 1.84135e-16 1.78475e-16 1.89793e-16
+506991 1.55144e-16 1.50375e-16 1.59917e-16
+543250 1.30718e-16 1.26691e-16 1.34754e-16
+582103 1.10138e-16 1.06729e-16 1.13559e-16
+623735 9.27973e-17 8.99058e-17 9.57049e-17
+668344 7.81872e-17 7.57292e-17 8.06636e-17
+716143 6.58773e-17 6.37836e-17 6.79909e-17
+767361 5.55054e-17 5.37188e-17 5.7313e-17
+822243 4.67666e-17 4.52393e-17 4.83151e-17
+881049 3.94036e-17 3.80959e-17 4.07323e-17
+944061 3.31998e-17 3.20787e-17 3.43416e-17
+1.01158e+06 2.79728e-17 2.70103e-17 2.89551e-17
+1.08393e+06 2.35687e-17 2.27416e-17 2.44147e-17
+1.16145e+06 1.9858e-17 1.91465e-17 2.05873e-17
+1.24451e+06 1.67315e-17 1.6119e-17 1.73606e-17
+1.33352e+06 1.40973e-17 1.35697e-17 1.46403e-17
+1.42889e+06 1.18778e-17 1.1423e-17 1.23467e-17
+1.53109e+06 1.00077e-17 9.61563e-18 1.04128e-17
+1.64059e+06 8.4321e-18 8.09391e-18 8.78208e-18
+1.75792e+06 7.10453e-18 6.81279e-18 7.40699e-18
+1.88365e+06 5.98598e-18 5.73426e-18 6.24739e-18
+2.01837e+06 5.04354e-18 4.82635e-18 5.26946e-18
+2.16272e+06 4.24948e-18 4.06207e-18 4.44474e-18
+2.31739e+06 3.58043e-18 3.41874e-18 3.74917e-18
+2.48313e+06 3.01672e-18 2.87723e-18 3.16252e-18
+2.66073e+06 2.54177e-18 2.42144e-18 2.66772e-18
+2.85102e+06 2.14159e-18 2.03782e-18 2.25037e-18
+3.05492e+06 1.80441e-18 1.71493e-18 1.89835e-18
+3.27341e+06 1.52032e-18 1.44319e-18 1.60142e-18
+3.50752e+06 1.28096e-18 1.21448e-18 1.35096e-18
+3.75837e+06 1.07928e-18 1.02201e-18 1.13968e-18
+4.02717e+06 9.09359e-19 8.60023e-19 9.61461e-19
+4.31519e+06 7.66188e-19 7.23704e-19 8.11119e-19
+4.62381e+06 6.45558e-19 6.08984e-19 6.84293e-19
+4.9545e+06 5.43921e-19 5.12443e-19 5.77303e-19
+5.30884e+06 4.58285e-19 4.31203e-19 4.87047e-19
+5.68853e+06 3.86132e-19 3.62839e-19 4.10905e-19
+6.09537e+06 3.25339e-19 3.0531e-19 3.46669e-19
+6.53131e+06 2.74117e-19 2.569e-19 2.92478e-19
+6.99842e+06 2.30959e-19 2.16165e-19 2.4676e-19
+7.49894e+06 1.94597e-19 1.81887e-19 2.0819e-19
+8.03526e+06 1.63959e-19 1.53044e-19 1.7565e-19
+8.60994e+06 1.38145e-19 1.28773e-19 1.48196e-19
+9.22571e+06 1.16395e-19 1.08351e-19 1.25035e-19
+9.88553e+06 9.80699e-20 9.11675e-20 1.05493e-19
+1.05925e+07 8.26296e-20 7.67083e-20 8.9007e-20
+1.13501e+07 6.96202e-20 6.45422e-20 7.50971e-20
+1.21619e+07 5.86591e-20 5.43052e-20 6.33617e-20
+1.30317e+07 4.94237e-20 4.56918e-20 5.34601e-20
+1.39637e+07 4.16424e-20 3.84443e-20 4.51063e-20
+1.49624e+07 3.50861e-20 3.23463e-20 3.80579e-20
+1.60325e+07 2.95621e-20 2.72155e-20 3.2111e-20
+1.71791e+07 2.49078e-20 2.28983e-20 2.70936e-20
+1.84077e+07 2.09863e-20 1.9266e-20 2.28601e-20
+1.97242e+07 1.76822e-20 1.62098e-20 1.92882e-20
+2.11349e+07 1.48983e-20 1.36383e-20 1.62745e-20
+2.26464e+07 1.25527e-20 1.14748e-20 1.37317e-20
+2.42661e+07 1.05763e-20 9.65444e-21 1.15863e-20
+2.60016e+07 8.91119e-21 8.12282e-21 9.77606e-21
+2.78612e+07 7.5082e-21 6.83419e-21 8.24867e-21
+2.98538e+07 6.32609e-21 5.74997e-21 6.95995e-21
+3.1989e+07 5.3301e-21 4.83773e-21 5.87259e-21
+3.42768e+07 4.49092e-21 4.07022e-21 4.95511e-21
+3.67282e+07 3.78386e-21 3.42447e-21 4.18097e-21
+3.9355e+07 3.18813e-21 2.88116e-21 3.5278e-21
+4.21697e+07 2.68618e-21 2.42404e-21 2.97667e-21
+4.51856e+07 2.26327e-21 2.03945e-21 2.51165e-21
+4.84172e+07 1.90693e-21 1.71587e-21 2.11927e-21
+5.188e+07 1.6067e-21 1.44362e-21 1.7882e-21
+5.55904e+07 1.35374e-21 1.21457e-21 1.50885e-21
+5.95662e+07 1.14061e-21 1.02186e-21 1.27314e-21
+6.38263e+07 9.61027e-22 8.59731e-22 1.07426e-21
+6.83912e+07 8.09721e-22 7.23319e-22 9.06442e-22
+7.32825e+07 6.82237e-22 6.0855e-22 7.64845e-22
+7.85236e+07 5.74825e-22 5.11991e-22 6.45368e-22
+8.41395e+07 4.84324e-22 4.30753e-22 5.44554e-22
+9.01571e+07 4.08071e-22 3.62405e-22 4.59489e-22
+9.66051e+07 3.43824e-22 3.04901e-22 3.87712e-22
diff --git a/test/data/pha.fits b/test/data/pha.fits
new file mode 100644
index 0000000..d3e5718
--- /dev/null
+++ b/test/data/pha.fits
diff --git a/test/data/pull.dat b/test/data/pull.dat
new file mode 100644
index 0000000..3a1ecc2
--- /dev/null
+++ b/test/data/pull.dat
@@ -0,0 +1,101 @@
+LogL,Sim_Events,Npred_Events,Crab_Prefactor,Pull_Crab_Prefactor,Unc_Crab_Prefactor,Crab_Index,Pull_Crab_Index,Unc_Crab_Index,Background_Prefactor,Pull_Background_Prefactor,Unc_Background_Prefactor,Background_Index,Pull_Background_Index,Unc_Background_Index
+104702.14348660898,15105.0,15104.999075727912,5.67748323458501e-16,-0.08501991498574554,2.6484107186845484e-17,-2.512994429094607,-1.1338279073158557,0.02910003262551158,0.9958218078266116,-0.17872001258319373,0.023378423675096273,-0.012229059990362811,-0.9236754329409402,0.013239563979119857
+103330.80595191609,14818.0,14817.997797150003,5.732404092766631e-16,0.12283753926158997,2.637963358873928e-17,-2.484339613991382,-0.1554901325428316,0.027909256493730588,0.9787908971847574,-0.9101986145091182,0.023301620632196762,-0.008200032682593691,-0.6103278351854464,0.013435455848252658
+104268.96595026793,14979.0,14978.999805565223,5.572825610413261e-16,-0.48658024310290293,2.6136365253088216e-17,-2.4950417511405485,-0.516821157597015,0.02910436409083146,1.0063046580826853,0.2716574371824787,0.02320811882816348,-0.0008417569678340521,-0.06468934227489305,0.013012297516599597
+104821.06173253663,15107.0,15106.996064070843,5.572524365485819e-16,-0.4875817324560644,2.614446482070941e-17,-2.488742729886503,-0.3182574459681672,0.027470621653193025,0.9996316452115123,-0.015557106670414662,0.023677589688849032,-0.010871023195874276,-0.8107102927475592,0.013409257651129044
+103881.48989070744,14862.0,14861.992397431473,5.301740735337788e-16,-1.5134244536513575,2.631510702112374e-17,-2.465301587043766,0.4827690936075433,0.030446052058549868,1.0115707161034393,0.4942920042462879,0.023408665331503164,0.0048734492051994045,0.3732789541610912,0.013055783485441917
+104709.9140731044,15024.0,15023.989651557333,5.226837712898727e-16,-1.7954633953701884,2.6353212675979732e-17,-2.4343195831835844,1.5525972082532988,0.029421936722278975,1.017947066365573,0.7598967774868103,0.02361776875134134,0.0009326118036593681,0.07132952806775084,0.013074694715119194
+103713.58340281199,14892.0,14891.999561522098,5.591199213471972e-16,-0.41862333613425523,2.599013889974217e-17,-2.470115751370293,0.35799682935892585,0.027609877571840587,0.9794463837010542,-0.8909844728935377,0.023068433765401575,-0.012917295469889406,-0.9740485577904611,0.013261449202482362
+104795.70589373197,15029.0,15028.996906992426,5.435055239409328e-16,-1.0152303535510279,2.609700937959154e-17,-2.4655187514911407,0.49983528642007014,0.028972041194964666,1.0209631987169243,0.8832401674398217,0.023734426365241833,0.00466053101676357,0.3544111893768436,0.013150067369368664
+104193.29654018967,14931.0,14930.996770551044,5.485461677632551e-16,-0.8193085256981937,2.6185291088558448e-17,-2.479088507285966,0.031657689546980165,0.028792142669831974,1.0185759089559494,0.7867635712209643,0.023610535153682555,0.008184752146355114,0.6243663808647385,0.013108893106991681
+103628.40847429863,14848.0,14847.998122677556,6.014015930608307e-16,1.1849643924993984,2.6500030937298085e-17,-2.473150703559013,0.25987554591515094,0.026356063695286987,0.9902956776180022,-0.4187159470974005,0.02317638592289015,0.001885900145097897,0.14262284727070834,0.013222987629172232
+105660.09206884849,15205.0,15204.992131202547,6.109854020247515e-16,1.5187149825791957,2.6986895167878697e-17,-2.4922552592625755,-0.44934245174528803,0.0272737623943052,1.00323842606026,0.13976115495783228,0.023171145524928653,-0.005994371257142875,-0.46075233874827176,0.013009963820103039
+103835.59625385483,14858.0,14857.999995507591,5.297499346626201e-16,-1.54328568208427,2.6080761199715524e-17,-2.4319384773924724,1.701399801117752,0.028248223948276648,1.0130018036654878,0.5601780025624995,0.023210128934038485,0.006713522884626453,0.5203716357596322,0.012901400505479386
+103482.23089354827,14807.0,14806.999524388077,5.736758548183581e-16,0.13761738296308404,2.6710686827580283e-17,-2.4701072439260923,0.3421196454712564,0.028916071336040444,0.9891275161084382,-0.4697332187670207,0.02314608262132377,-0.0006918586515145906,-0.05255682430971379,0.013164011726384277
+102857.43398505163,14731.0,14730.999998518842,5.258007078860843e-16,-1.7041864102309696,2.5935714455043313e-17,-2.4853332222867714,-0.17651127204646544,0.03021462722996824,0.9985936056978045,-0.060149237976978034,0.023381747624695796,0.0019325678652796843,0.14603466473388227,0.013233624145345124
+103817.91519576444,14910.0,14909.994926336014,5.329622298577745e-16,-1.4389390287441313,2.5739638304585517e-17,-2.4916943762429473,-0.39969910169305867,0.02925794977624896,1.0079906020378802,0.3407215111753502,0.023452003398070874,0.00020664358393950301,0.015738123620475775,0.013130128401752638
+103967.78649231851,14870.0,14869.990058174044,5.260603968355675e-16,-1.6789644755360136,2.6170656857051498e-17,-2.4301686389439427,1.7352508788074,0.02871709311007826,1.0126332673580076,0.536452771161907,0.02354963575012417,0.005447900085284499,0.4147492279428597,0.013135407417889301
+105284.40661958465,15058.0,15057.999998318428,4.927243299991711e-16,-2.9598366118818897,2.6108086402680312e-17,-2.4504493609494307,0.9673695847716703,0.03054741384860079,1.0639477867734564,2.6531725316838397,0.0241023853555697,0.02273846071513058,1.7729798337272424,0.012824996811908856
+104830.07226830821,15032.0,15031.998093973076,5.743212958004981e-16,0.16282839716227676,2.653895681470984e-17,-2.460255056292079,0.7331750878331816,0.02693073460293763,1.009527339928993,0.40649631413313464,0.023437703117457166,0.0017910275983860455,0.13653669474155755,0.013117554967740933
+104698.0498891591,15040.0,15039.998968232076,5.570480545515681e-16,-0.4911050777527014,2.6373063597102404e-17,-2.4920533487352197,-0.4183571629577559,0.02881114464493293,1.0144387152840497,0.6180934305102588,0.0233600853387651,0.0013844182971720093,0.10655399897505911,0.012992645142263101
+104925.21327728468,15098.0,15097.992620766281,5.87969306777613e-16,0.6774288392926258,2.6525748145556783e-17,-2.5084885893716833,-1.0402720874605131,0.027385709676426055,1.0166071274045811,0.716918888388743,0.023164583432730087,0.003874758455068439,0.30154828940328254,0.012849545466618257
+103716.61350507324,14871.0,14870.999265696919,5.610566829273711e-16,-0.33697545311885546,2.653996601192925e-17,-2.454976233044967,0.886385961633361,0.028231231132001506,0.9787988077612177,-0.922234954456611,0.022988927210283613,-0.011704744624020038,-0.8844478536183279,0.013233956729201437
+103344.09380500649,14825.0,14824.999999989699,5.185881816208363e-16,-1.9630789475358086,2.6189378905876087e-17,-2.418893532303184,2.1636019917057876,0.028242933742466933,0.9802133791662438,-0.8562764603125603,0.02310774819914305,-0.013591256173913914,-1.026686644454609,0.01323797893673175
+105469.3219667073,15214.0,15213.997120280635,5.796556830349523e-16,0.36143547823531713,2.6714818041924188e-17,-2.481092011680722,-0.03892934595915295,0.028051118091422435,0.9960380118113645,-0.16810935916980949,0.023567921549408868,-0.014903616203581289,-1.1156393733398904,0.013358811601426653
+104469.9971681874,14961.0,14960.999082266428,5.947706132978403e-16,0.9305884258012391,2.6618226286784883e-17,-2.475757601829857,0.1572808660063672,0.02697339020228572,0.9946878034334904,-0.22520963190307067,0.023587785840331894,-0.0017152659481122583,-0.12790022377679958,0.01341096909342076
+104826.19001967587,15063.0,15062.99608195958,5.287050347495291e-16,-1.5838597523756837,2.6072362271047778e-17,-2.4579789012405966,0.7746752179149065,0.028426233665606017,1.0185925724596263,0.7958686132990104,0.02336135908483304,-0.0002351029057570468,-0.018165082808064857,0.012942572750214319
+103320.95695538132,14818.0,14817.998687527173,5.478498323029024e-16,-0.8523687875773152,2.598660112843289e-17,-2.490995186934019,-0.37945854402407125,0.028975989886582468,0.9953315815622235,-0.19898386538883064,0.02346129133964744,-0.0013328500645812436,-0.09997748749545347,0.01333150190078397
+104825.19976994366,15116.0,15115.990754728477,5.315233940698427e-16,-1.460682378789519,2.6341528102805798e-17,-2.464718006751812,0.5076150170072764,0.030105479026773865,0.9928387367913682,-0.3049904020195074,0.023480290400003188,-0.018504566807966617,-1.3859269563155745,0.01335176195516118
+103770.47872478547,14858.0,14857.991542917502,5.241689052795333e-16,-1.7674486406832426,2.5930651485720014e-17,-2.470999774704249,0.31047198034973555,0.028988848802434315,1.0142624255798223,0.613387112964016,0.02325191592451823,0.005780894385199397,0.4468102900554024,0.012938140669237033
+103629.36892843783,14923.0,14922.999996487131,5.984682923028192e-16,1.0727263172672183,2.653826222455558e-17,-2.517783256274881,-1.3204723419015199,0.028613440112249505,0.9670801291995181,-1.4156504768341795,0.023254236366380916,-0.017944371819906522,-1.3217953180960127,0.013575756831817646
+104202.31840266004,14969.0,14968.993306219852,6.11363636982842e-16,1.5511916803318888,2.6665716111881122e-17,-2.4805177040241033,-0.01902684336053044,0.027209138914617383,0.9743574698978508,-1.1040125515345534,0.02322666537305819,-0.012864906504281222,-0.9561276967352017,0.013455217904689712
+104558.3210911674,14988.0,14987.99592260394,5.727035536558679e-16,0.10076888899713153,2.6829249411937305e-17,-2.4539572754877907,0.9040406708094028,0.028807027552082087,0.991942847147923,-0.3490713839169001,0.02308167676670701,-0.007233321441344711,-0.5529892440587004,0.013080401687843472
+103295.47162555656,14883.0,14883.000000254477,5.800709280699981e-16,0.3789335257832652,2.6577031021948253e-17,-2.498719352789656,-0.6638277678957628,0.028199110816038476,0.9595872183999479,-1.7482932734147603,0.023115562025310562,-0.02304437391034645,-1.6988602430501567,0.013564608392372682
+103258.47720670803,14845.0,14844.992307538843,5.83283553420523e-16,0.4952239600807473,2.6823325386673746e-17,-2.4589665237005023,0.7632059346150839,0.02755937204564027,0.964755489938738,-1.5351536401647652,0.022958294947911025,-0.016523138292911025,-1.2320888966887555,0.01341067055901326
+103657.9671271524,14817.0,14816.999863026358,5.363242117977063e-16,-1.2786443217150414,2.6337103782797478e-17,-2.4323288184790695,1.6135859025493344,0.029543627919414728,1.0151591013135277,0.6351636323121661,0.023866450379636053,0.010915006913822117,0.8190878811605987,0.013325806869900458
+104392.7082185512,15006.0,15005.995853606486,6.005823640352908e-16,1.1354123615360034,2.6935028251690447e-17,-2.4730683275167515,0.25611675736022566,0.027064501966574228,0.9714394796871246,-1.2460905368592647,0.022920100480709322,-0.017794798460961776,-1.3401186899781854,0.013278524203890809
+105182.36065597368,15075.0,15074.989261140847,5.26313996325609e-16,-1.67692009148971,2.6051332974120466e-17,-2.4565236365198113,0.8036379946781819,0.029212610199683024,1.029479540250354,1.2428947693473755,0.023718452259504866,0.005601907621198788,0.43008379976278804,0.013025153759077906
+103071.25151722605,14836.0,14835.999997691571,5.626870367730519e-16,-0.2758504395736606,2.651060929339331e-17,-2.4857663826203016,-0.19466445034259733,0.02962216578401001,0.9595379837552862,-1.7643536985481396,0.022933052640187388,-0.022964614426049572,-1.7082617255518946,0.013443264625407625
+103697.65696037607,14939.0,14938.998760928765,5.389129205397533e-16,-1.1876025861552415,2.6176331899788434e-17,-2.4690490243020475,0.3886240085819805,0.02817884499187428,0.9885163863773131,-0.49579679121988196,0.0231619361521725,-0.012105401262481892,-0.9167134357594129,0.01320521854515384
+104637.09745185435,15053.0,15052.996846537539,5.406589368501109e-16,-1.1101425795758761,2.6429995290423552e-17,-2.4389502165668464,1.4305536253574138,0.028695032961730167,0.9973647045748609,-0.11185075823051355,0.02356081860176562,-0.010884674103109395,-0.8187292691775412,0.013294595066869482
+104582.78060549527,15024.0,15023.999395677984,5.827997309903262e-16,0.48195052823758067,2.6558184378659893e-17,-2.480763172768796,-0.027230974562203435,0.028025907301000918,0.9972408492496609,-0.11684592426392378,0.023613581455411925,-0.004849155581888444,-0.36150282462815947,0.013413880201008851
+104660.06320954843,15025.0,15024.998351527545,5.950507262965721e-16,0.9335275835620825,2.6834478956674745e-17,-2.468672941074628,0.4151788322094137,0.027282361350393892,0.9942447528437467,-0.24704233712761414,0.023296602611399077,-0.004813342700068887,-0.3639786391517183,0.013224245003186924
+105487.22379340562,15160.0,15159.998753761023,5.897989793185405e-16,0.7404510509478629,2.6739079231767564e-17,-2.4830216972591455,-0.10999404551766875,0.027471462158922832,1.008007621452472,0.3392549160552585,0.023603553179367128,-0.003582415027088905,-0.2709663149118288,0.013220886988312945
+104309.2333224919,14961.0,14960.997133833138,5.993271060876569e-16,1.1023581510449902,2.6603972637981608e-17,-2.4663916652348883,0.5047187705067517,0.026962212543529037,1.0006059944066537,0.02571854685831731,0.023562544571124427,0.002877938002773262,0.2161085252295913,0.013317096119719353
+104536.81282712151,14994.0,14993.997986296345,5.649645367970281e-16,-0.1890146539982087,2.6640596887369527e-17,-2.445895378373151,1.2164245981656017,0.02803677406579858,0.9871622217101877,-0.5497357570786212,0.02335263465129891,-0.011401907900413608,-0.8561347270640302,0.01331788974325867
+104885.66713609539,15058.0,15057.999302468945,5.85376938187508e-16,0.5763874122125322,2.667812978163725e-17,-2.4783224283833145,0.061953861563189286,0.027077757130190266,1.011221208894034,0.4738519298700737,0.023680834004645206,0.0027051157314355177,0.20430259331033007,0.01324073124870481
+103965.1770144278,14841.0,14840.999947621616,5.441964953783418e-16,-0.9786223699914871,2.636717227492218e-17,-2.4240347973833023,2.0660578382534425,0.027087916698405833,1.0048749802449943,0.2084331684438968,0.02338869711279427,0.004696774739682412,0.3576192508777786,0.013133450529170757
+104657.89204800228,15025.0,15024.997235329069,5.291370559902183e-16,-1.5604400748894864,2.618680759828323e-17,-2.4474869070028125,1.119624494026985,0.029039283412107895,1.0070782890882277,0.3024366368726101,0.02340420513011186,-0.005298128388872043,-0.4048299005085303,0.013087295138567476
+105104.3320267707,15071.0,15070.991729175797,5.95019096110726e-16,0.9335257688335624,2.6800648622680576e-17,-2.48966742734985,-0.3400391003696072,0.028430340332455842,1.0279217001184597,1.1706788386728464,0.02385086259021603,0.01347745991263468,1.0255680015129696,0.013141459067318844
+103117.18933059537,14779.0,14778.999954219906,5.741061709636474e-16,0.1552774697240199,2.6444087290612467e-17,-2.5085237338167152,-0.9578959261781123,0.029777487341992842,0.9880764025321682,-0.5036977763199469,0.02367212647819584,-0.0007966132391824033,-0.05871465634982645,0.013567536433086148
+103861.51126322581,14909.0,14908.999988128835,5.141729840097847e-16,-2.147589053088375,2.5995204208147898e-17,-2.4563869001257395,0.8147506117659684,0.0289819971083903,1.001915565907135,0.08215253976479471,0.023317184260150284,-0.005365587573949675,-0.4086698661866238,0.01312939371825232
+104401.21304313006,15015.0,15014.998970160144,5.994262650853293e-16,1.0978905429865868,2.6802549009376762e-17,-2.4967114366338805,-0.5986746885080364,0.02791405241388654,0.9947189099510139,-0.22577026819208507,0.023391432766040707,-0.004090920537099004,-0.30811253302204894,0.013277358428020362
+103896.10903963698,14907.0,14906.999883600616,5.868618849352218e-16,0.6376991535457983,2.6441755240640774e-17,-2.479523442602133,0.017226036087355272,0.027664948305589025,0.9909518757304067,-0.3908429511409154,0.023150281316781655,-0.002695578042956474,-0.20441807152789476,0.013186593645115359
+103877.93353330657,14893.0,14892.999790511029,5.558775494680619e-16,-0.5356629666367859,2.6364433256618963e-17,-2.4743403482955824,0.2062639870749244,0.02743887473852516,1.0021831242943509,0.09496376921188177,0.022989023208207993,0.0008862487268151458,0.06861458581377454,0.01291633136459492
+103396.93676252602,14770.0,14769.999940468431,5.867378273072098e-16,0.6352366873526242,2.6348961954583328e-17,-2.5155847264284814,-1.2077020193866677,0.029464823157746442,1.015575822278027,0.6678015218032541,0.023324029325311725,0.018553263639159025,1.4254318720711299,0.013015889431601825
+104160.03334950031,14964.0,14963.999998356765,6.10907582479636e-16,1.520382351595521,2.690611505501016e-17,-2.470844076924422,0.34594540723430006,0.026466381354145058,0.9927990773010172,-0.3077142659053865,0.023401328754763813,-0.0006925360964855318,-0.05198559811791703,0.01332169142143325
+104864.6850193089,15060.0,15059.999218909168,5.609746644889459e-16,-0.3411527664813018,2.6455407658400925e-17,-2.4647004340264353,0.5481903216886338,0.027909223071352622,1.0027414961956898,0.11570915352832659,0.02369299326883945,-0.005698317662346879,-0.4266719822022961,0.013355265637398148
+104923.17543779277,15101.0,15100.995028939238,6.127117410688088e-16,1.584235014851103,2.69604829260911e-17,-2.503434209444339,-0.8389182406124437,0.02793384183330101,1.0016273884843798,0.06972600471156862,0.02333976385298056,-0.0021331039675606374,-0.1622460782952347,0.013147337611939605
+104453.17589728598,14909.0,14908.97953769627,5.536892055352507e-16,-0.6201645362100462,2.630075328787414e-17,-2.4540288821633847,0.9320828943896502,0.02786352801123104,1.0282733858014168,1.2048710613023608,0.023465901630051383,0.016505203933255115,1.281884889389383,0.01287573016101099
+104688.55914493323,15031.0,15030.991877826402,6.006938103496527e-16,1.1617511752543976,2.6420296362456006e-17,-2.499085904547056,-0.7049249572708577,0.027075087000675516,1.017186344545262,0.733530932235582,0.02342961119973933,0.009323142088312936,0.7143190125704435,0.013051790480508207
+104926.93916741286,14995.0,14994.999995528324,5.463460924576351e-16,-0.9060463828756001,2.610672918012471e-17,-2.5100838929434004,-1.0195942133745202,0.029505750963251018,1.0595024692788106,2.4864521555702046,0.023930671316362114,0.029147843606924958,2.2708541683724275,0.01283562987570262
+104418.96129561374,14975.0,14974.999993368268,5.131487853632615e-16,-2.168120600530305,2.6221426346317257e-17,-2.4229966833284244,1.9386863136486103,0.029403063440570344,1.021692983447443,0.9054165163310347,0.023959120533109186,0.004508823226188785,0.3403330078401741,0.013248268966923719
+104597.41903067115,15024.0,15023.998585086974,5.5052416135314e-16,-0.7400989417831648,2.6315182399714976e-17,-2.4745524720532823,0.18891505066199857,0.028835859967897517,0.9960930724767406,-0.1660999857570656,0.023521540386966532,-0.009836850928478167,-0.7370514625111277,0.013346219943671375
+105023.41205975645,15104.0,15103.99832493881,5.797871057178e-16,0.36796529273395895,2.659790450638014e-17,-2.4868954513434605,-0.2490035791048457,0.02769217763153948,0.9920885937026824,-0.3372923372634315,0.023455636026319258,-0.01239104177720175,-0.9265919584774807,0.013372705929330483
+103289.81254198536,14773.0,14772.998796750477,5.619254179684634e-16,-0.3038067169570706,2.6578023397282623e-17,-2.482157660822906,-0.07419044378169867,0.029082732396842604,1.0184661779445874,0.779855959686005,0.02367895983255992,0.017436881008395338,1.3229099579545722,0.0131807013043847
+102660.54003349427,14770.0,14769.999999705335,5.364790752662568e-16,-1.2975231162634542,2.5834549160307202e-17,-2.466043384426776,0.48372644345193777,0.028852289888531828,0.958831803268213,-1.8022271411880775,0.02284295680102107,-0.023476141574471938,-1.7556113526783363,0.01337206070048309
+105006.72279247809,15048.0,15047.99465532865,5.993539114702324e-16,1.1005580354163806,2.6671843306406585e-17,-2.466000437205987,0.5172157125141147,0.027067164541391957,1.018356543752431,0.7674507997149594,0.023918854158792646,0.00983138430351044,0.737755349439672,0.013326076606530082
+103102.28361685216,14716.0,14715.999442685392,5.674552108899239e-16,-0.09631102227788653,2.6422615500161828e-17,-2.454995788646379,0.9125078449265976,0.027401639879197092,0.9984852826342058,-0.06491044261688289,0.0233354958728976,0.009111631303170683,0.6896669209855639,0.013211640323635889
+104531.59108373195,14950.0,14949.998318397973,5.833625674801249e-16,0.49877785891182885,2.679061879225682e-17,-2.4544331622678186,0.9389281566958414,0.027229812579221184,1.01219836264865,0.514842214521027,0.023693400239136235,0.008740556642838928,0.6596348798548487,0.013250598035025481
+103466.32364242684,14842.0,14841.999992364486,5.559773024581159e-16,-0.5338636010041037,2.626644243119372e-17,-2.5146215085708925,-1.1450405559233547,0.030236054427761224,1.009723793948652,0.4124474334233883,0.023575838181226716,0.00721903046759916,0.545000471514331,0.013245916003596215
+104316.6824251344,14911.0,14910.975299452331,5.863638892368771e-16,0.6201956888974903,2.638504189857696e-17,-2.4780783592346936,0.07238488048354566,0.026547543526624376,1.0340466137193263,1.440548699949866,0.023634476030217625,0.023923346759196155,1.8463064644490832,0.01295740832838096
+105529.5151767736,15190.0,15189.99957462132,5.834717114215463e-16,0.5010886028147278,2.6884888911606908e-17,-2.4889834457321363,-0.3136735758566292,0.028639472443934322,1.0016659371683858,0.07092028990347908,0.02349027578219314,-0.009923624425733822,-0.7499001090737418,0.013233261744675887
+105457.94736951304,15122.0,15122.00000033066,6.027761674204073e-16,1.228476892803507,2.668032879772676e-17,-2.484405248255628,-0.16595468883164577,0.026544885755513475,1.033269220492325,1.3891723116963275,0.0239489516255185,0.015526648583225076,1.1821004068806855,0.01313479675063867
+104470.87925587903,15024.0,15023.99640239301,6.03790838846066e-16,1.2589189731428367,2.684115464691797e-17,-2.483869890747045,-0.14371975264646822,0.026926644916821823,0.9864947020215399,-0.5740287753518823,0.023527214241448623,-0.008837024981601296,-0.655230584788196,0.013486893296438342
+105162.29126301195,15112.0,15111.999999317562,6.177356170407144e-16,1.78390671313331,2.6759032122744834e-17,-2.506380869101536,-0.9667329798802878,0.027288682242746005,1.0253507279309722,1.0574779091807105,0.023972820340628042,0.0127067997195174,0.9573832730291858,0.013272427122434208
+103777.57790654837,14877.0,14876.995407234004,6.038262246294493e-16,1.268964516464256,2.6656556736275105e-17,-2.4620622880379215,0.6649687898115889,0.02697526897038421,0.9726737228224851,-1.1837182765463132,0.0230851189163385,-0.010148044300178573,-0.7591884031873629,0.013366964323444887
+104806.70057053298,15096.0,15095.997686243283,5.439260391738729e-16,-0.9824410031651785,2.6539976183937103e-17,-2.485384750079234,-0.18354769817720248,0.0293370613345176,1.0113235065508546,0.4749012032977535,0.02384392052962426,-0.0047982174071041815,-0.3597467862069802,0.013337763090796671
+105784.79092823583,15259.0,15258.997768580222,5.827961339350463e-16,0.47726383852805365,2.6811446629837503e-17,-2.5047295496039585,-0.8455934842339454,0.029245198863330865,1.0148334072555911,0.6252990634905237,0.02372210054623874,-0.005345331494155609,-0.40347832963608515,0.013248125367666706
+105162.46385599423,15152.0,15151.990215977432,6.104114704168049e-16,1.4901748418897318,2.711861003206714e-17,-2.474470457622988,0.20105659418141558,0.027502417413986915,0.9773365909881715,-0.9704918298581112,0.02335249851113323,-0.01955450863830202,-1.4522701704146073,0.013464787087597772
+103698.33193109326,14764.0,14763.999994387923,5.411019601513098e-16,-1.1049254973794107,2.615383563618418e-17,-2.4445338644781205,1.2428914744224622,0.028535182879389883,1.0311968370972786,1.3211549589914875,0.023613306588269496,0.023708273144118674,1.8300034868884438,0.01295531583080744
+104821.39827733487,15059.0,15058.999246115178,5.68594851432458e-16,-0.053139051470666006,2.6442861297923464e-17,-2.466495670942182,0.4820149547355415,0.02801641095394487,1.0120587400167682,0.5137233646888311,0.023473216998943287,0.0011567486920515345,0.08829982954016835,0.013100236977528022
+106505.23587817501,15264.0,15263.999999850623,6.218963100694398e-16,1.9102781400790376,2.7166886842610554e-17,-2.471373714397668,0.3260255898816594,0.026458921845561856,1.0244822100573021,1.0264179091613137,0.023852087769304933,0.006396545662894279,0.48529211649252724,0.013180815112195989
+103716.65615689153,15034.0,15033.999998061632,5.577294742966784e-16,-0.46570958681866953,2.634802042007193e-17,-2.482904112111916,-0.0985414772370263,0.029470961805563557,0.9613012436149456,-1.6877220023130035,0.022929579831286302,-0.03170581928856768,-2.3653482434347395,0.013404292317873425
+104225.27879959819,14900.0,14900.00000050222,5.199590965611082e-16,-1.9135528494747858,2.615078201400422e-17,-2.4556855368707633,0.8170335145337638,0.02975944400899101,1.0386428710542701,1.615496590731249,0.0239201192227701,0.018544221167335707,1.4217032000742367,0.01304366563032804
+102786.34653474073,14809.0,14808.997062384125,5.671608003596035e-16,-0.10806725632187256,2.6272524509552447e-17,-2.5099327217773117,-1.0258010259966965,0.02917985166590013,0.9698004119754605,-1.3141855751175404,0.02297969829857434,-0.014914062983158742,-1.1175505167317183,0.013345314381648704
+103693.80219318194,14925.0,14925.000000354028,6.262827577806683e-16,2.0904413060784135,2.6923864170218004e-17,-2.5411901412740177,-2.2024997893381664,0.027782132634121534,0.9887409816798305,-0.4825792434259602,0.023330921239460494,-0.000780752700560303,-0.05835466951287918,0.013379438305069774
+104450.08142122456,15026.0,15025.994475005335,5.564571488415918e-16,-0.5143813331337013,2.632842657003666e-17,-2.4774149392783564,0.09322806764920688,0.027728352488978595,0.9801244763987085,-0.8536014915849469,0.02328431217287018,-0.019296953745379125,-1.43996889663141,0.013400951777862312
+104737.74337394757,15065.0,15064.99996910083,5.554067901763217e-16,-0.5523022868838343,2.6422504795363372e-17,-2.4843390111399652,-0.14983936941816967,0.028957750935643706,1.0003050186229425,0.013048813191263154,0.02337520037046332,-0.008653486101637216,-0.657271863832087,0.013165763784843708
+104812.57801906214,15006.0,15005.99998335691,5.178722422960302e-16,-1.9922068346204702,2.6165836196370893e-17,-2.427920517426411,1.7570265877928588,0.029640691231093017,1.0336105370795834,1.4217166073837435,0.023640813439911784,0.0108890268433584,0.8436609848926396,0.012906874963222445
+106339.57096486905,15207.0,15206.999997505669,5.492624962630607e-16,-0.7780861160226986,2.6651939046210067e-17,-2.445831650210193,1.190829912702277,0.028692888401057177,1.0621195059244974,2.582425705182309,0.024054711738594643,0.02255630002191606,1.7588965807729846,0.012824119546587107
+103728.05730247138,14836.0,14835.999999972239,5.209387563455267e-16,-1.8911654411555279,2.5942333011593222e-17,-2.4645567717301,0.5223658413199294,0.029564008685709207,1.012433963029872,0.5286900139121922,0.02351843746369132,0.005379995631329906,0.4100847184331302,0.01311922973351953
+103639.17031866539,14849.0,14848.995763098657,5.526901347779302e-16,-0.6572633079617131,2.6336271951268132e-17,-2.4790756256950353,0.03172639935343961,0.029135808783939735,1.020468619932421,0.8708978450847256,0.023502894223408958,0.013820223566015184,1.0582294652684516,0.01305976068480504
+104906.65266527233,15057.0,15056.999676679454,5.898564205186925e-16,0.7409408234691087,2.6798928996413046e-17,-2.4884855686348057,-0.300606433374182,0.028228167107266427,0.9987704521192002,-0.052390350346280826,0.023468976112450243,-0.00464859897558333,-0.35058822561408415,0.013259426974311319
+103900.09432355365,14941.0,14940.999999124993,5.626494348423733e-16,-0.2802725807392193,2.622648686589148e-17,-2.5374766771077253,-1.956661148119976,0.029374875237314736,1.0177793643158666,0.7655517169966314,0.023224249807207744,0.008053383365417891,0.624695729612739,0.01289168947962929
+105421.80459221234,15086.0,15085.991362965473,5.516294154681729e-16,-0.6898096398915645,2.6631382731495095e-17,-2.432532234555485,1.6716428368356826,0.028395877635182285,1.0247181424780918,1.0377693753611312,0.023818531424180996,0.006247790610896622,0.47575967680589687,0.013132240741465004
+104763.55636490823,14971.0,14970.992992053427,5.754182702542043e-16,0.20500866554129127,2.6429469407540822e-17,-2.471106898042058,0.3212152695157941,0.02768580077574692,1.0213216150467694,0.912626363652129,0.023362918162308007,0.01187716446399299,0.918512218279798,0.012930872586797705
+104010.23755771558,14983.0,14982.986816532728,5.82399109476417e-16,0.4663708032910838,2.658637588142092e-17,-2.487410895062763,-0.26203121450146666,0.02828248946165792,0.9697278266558659,-1.3016693628373415,0.02325642302754035,-0.02063547654962738,-1.5264684883010589,0.01351844254092295
+103802.99200127616,14915.0,14914.999158519993,5.98955655549965e-16,1.0774187851228139,2.687502385311054e-17,-2.492051222393842,-0.42355797140608237,0.028452356483424656,0.9793257627282156,-0.8930739375796235,0.023149524806215908,-0.00909363354268816,-0.6818341388097926,0.013337017061894227
+104450.88752347854,15017.0,15016.999255893796,5.809988580730963e-16,0.41359203147894474,2.65934960926737e-17,-2.4601309159680382,0.7212149320641501,0.02754946292514427,0.9867690971578991,-0.5699875949468021,0.02321261543128109,-0.010889108810203578,-0.821966945763293,0.013247623722985307
+103991.60794535361,14949.0,14948.999999199335,5.116779889999498e-16,-2.2436615470269636,2.5994121563179454e-17,-2.4490704069391716,1.0231506789081568,0.0302297537385545,0.9920210767039928,-0.34551318825890465,0.02309296306810833,-0.01362458177359732,-1.0422571545953772,0.013072188292040678
+104522.21161729087,14952.0,14951.996157985375,5.778641034812695e-16,0.29445980626519813,2.670688261672947e-17,-2.463321751237089,0.6036096703921505,0.027630850831258973,1.0145116280579276,0.6221761632371783,0.02332398589882278,0.00909011274137726,0.7004224247969091,0.012978043562801382
diff --git a/test/test_examples.py b/test/test_examples.py
index 9273648..4418ac8 100755
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -89,16 +89,21 @@ class Test(gammalib.GPythonTestSuite):
self.name('examples')
# Append tests
- self.append(self.test_generate_prod3_irfs, 'Test generate_prod3_irfs')
- self.append(self.test_make_pointings, 'Test make_pointings')
- self.append(self.test_make_spectrum, 'Test make_spectrum')
- self.append(self.test_make_ts_distributions, 'Test make_ts_distributions')
- self.append(self.test_pipeline_binned_disk, 'Test pipeline_binned_disk')
- self.append(self.test_pipeline_binned_mem, 'Test pipeline_binned_mem')
- self.append(self.test_pipeline_stacked_disk, 'Test pipeline_stacked_disk')
- self.append(self.test_pipeline_stacked_mem, 'Test pipeline_stacked_mem')
- self.append(self.test_pipeline_unbinned_disk, 'Test pipeline_unbinned_disk')
- self.append(self.test_pipeline_unbinned_mem, 'Test pipeline_unbinned_mem')
+ self.append(self.test_generate_prod3_irfs, 'Test generate_prod3_irfs.py')
+ self.append(self.test_make_pointings, 'Test make_pointings.py')
+ self.append(self.test_make_spectrum, 'Test make_spectrum.py')
+ self.append(self.test_make_ts_distributions, 'Test make_ts_distributions.py')
+ self.append(self.test_pipeline_binned_disk, 'Test pipeline_binned_disk.py')
+ self.append(self.test_pipeline_binned_mem, 'Test pipeline_binned_mem.py')
+ self.append(self.test_pipeline_stacked_disk, 'Test pipeline_stacked_disk.py')
+ self.append(self.test_pipeline_stacked_mem, 'Test pipeline_stacked_mem.py')
+ self.append(self.test_pipeline_unbinned_disk, 'Test pipeline_unbinned_disk.py')
+ self.append(self.test_pipeline_unbinned_mem, 'Test pipeline_unbinned_mem.py')
+ self.append(self.test_show_butterfly, 'Test show_butterfly.py')
+ self.append(self.test_show_model, 'Test show_model.py')
+ self.append(self.test_show_pha, 'Test show_pha.py')
+ self.append(self.test_show_pull_evolution, 'Test show_pull_evolution.py')
+ self.append(self.test_show_pull_histogram, 'Test show_pull_histogram.py')
# Return
return
@@ -241,6 +246,77 @@ class Test(gammalib.GPythonTestSuite):
# Return
return
+ # Test show_butterfly
+ def test_show_butterfly(self):
+ """
+ Test show_butterfly
+ """
+ # Execute script
+ self._execute_python('show_butterfly',
+ args='data/butterfly.txt example_butterfly.eps')
+
+ #TODO: Do any testing
+
+ # Return
+ return
+
+ # Test show_model
+ def test_show_model(self):
+ """
+ Test show_model
+ """
+ # Execute script
+ self._execute_python('show_model',
+ args='data/crab.xml Crab example_model.eps')
+
+ #TODO: Do any testing
+
+ # Return
+ return
+
+ # Test show_pha
+ def test_show_pha(self):
+ """
+ Test show_pha
+ """
+ # Execute script
+ self._execute_python('show_pha', args='data/pha.fits example_pha.eps')
+
+ #TODO: Do any testing
+
+ # Return
+ return
+
+ # Test show_pull_evolution
+ def test_show_pull_evolution(self):
+ """
+ Test show_pull_evolution
+ """
+ # Execute script
+ self._execute_python('show_pull_evolution',
+ args='data/pull.dat Pull_Crab_Prefactor '
+ 'example_pull_evolution.eps')
+
+ #TODO: Do any testing
+
+ # Return
+ return
+
+ # Test show_pull_histogram
+ def test_show_pull_histogram(self):
+ """
+ Test show_pull_histogram
+ """
+ # Execute script
+ self._execute_python('show_pull_histogram',
+ args='data/pull.dat Pull_Crab_Prefactor 50 '
+ 'example_pull_histogram.eps')
+
+ #TODO: Do any testing
+
+ # Return
+ return
+
# ======================== #
# Main routine entry point #
diff --git a/testall.sh b/testall.sh
index 91f1682..bb429a0 100755
--- a/testall.sh
+++ b/testall.sh
@@ -1,8 +1,8 @@
#!/bin/sh
# =====================================================================
-# Run all test and example scripts that come with the package.
+# Run some test scripts that come with the package
#
-# Copyright (C) 2011-2015 Juergen Knoedlseder
+# Copyright (C) 2011-2016 Juergen Knoedlseder
#
# 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
@@ -25,11 +25,11 @@ base=$PWD
#
-# examples
+# test/dev
# ========
echo
-echo "=====> examples"
-cd examples
+echo "=====> test/dev"
+cd test/dev
# Create local environment
rm -rf ctools
@@ -41,18 +41,8 @@ export CTOOLS=$PWD/ctools
# Run checkers
./check_models.py
-# Run pipelines
-./pipeline_binned_disk.py
-./pipeline_binned_mem.py
-./pipeline_stacked_disk.py
-./pipeline_stacked_mem.py
-./pipeline_unbinned_disk.py
-./pipeline_unbinned_mem.py
-
# Run makers
./make_survey.py
-./make_ts_distributions.py -n 2 -e 0 -d 1800
-#./make_pull_at_sensitivity_limit.py
# Remove local environment
rm -rf ctools