From c07e93f04b627c95ed1346b5bdc2b4d7d7179eff Mon Sep 17 00:00:00 2001 From: knodlseder <> Date: Fri, 25 Feb 2011 02:28:56 +0000 Subject: [PATCH] update for GPL v3 --- test/example_binned.py | 24 ++++++++++++++++++++---- test/example_models.py | 23 ++++++++++++++++++++--- test/example_survey.py | 33 ++++++++++++++++++++++++--------- test/example_unbinned.py | 26 +++++++++++++++++++++----- test/test_coverage.py | 22 ++++++++++++++++++---- test/test_ctatools.sh | 22 +++++++++++++++++++--- test/test_python.py | 25 ++++++++++++++++++++----- 7 files changed, 142 insertions(+), 33 deletions(-) diff --git a/test/example_binned.py b/test/example_binned.py index 160d86e..7f608b9 100755 --- a/test/example_binned.py +++ b/test/example_binned.py @@ -1,9 +1,25 @@ #! /usr/bin/env python -# ===========================================================================================# -# This script illustrates how to build a binned analysis pipeline using CTAtools. +# ========================================================================== +# This script illustrates how to build a binned analysis pipeline using the +# ctatools. If matplotlib is installed, a counts spectrum and an offset +# histogram will be displayed. # -# If matplotlib is installed, a counts spectrum and an offset histogram will be displayed. -# ===========================================================================================# +# Copyright (C) 2011 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ========================================================================== from ctatools import * from gammalib import * from math import * diff --git a/test/example_models.py b/test/example_models.py index a05bc9f..e36bd7d 100755 --- a/test/example_models.py +++ b/test/example_models.py @@ -1,7 +1,24 @@ #! /usr/bin/env python -# ===========================================================================================# -# This script illustrates how to build a unbinned analysis chain using CTAtools. -# ===========================================================================================# +# ========================================================================== +# This script performs an unbinned maximum likelihood analysis for a +# variety of models. This allows checking the models. +# +# Copyright (C) 2011 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ========================================================================== from ctatools import * from gammalib import * from math import * diff --git a/test/example_survey.py b/test/example_survey.py index 8f3cc21..744928c 100755 --- a/test/example_survey.py +++ b/test/example_survey.py @@ -1,9 +1,24 @@ #! /usr/bin/env python -# ===========================================================================================# -# This script simulates CTA surveys. +# ========================================================================== +# This script simulates CTA surveys. It can be considered as the master +# script for CTA science simulations. Please modify as needed. # -# If matplotlib is installed, the spectrum will be displayed on the screen. -# ===========================================================================================# +# Copyright (C) 2011 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ========================================================================== from ctatools import * from gammalib import * from math import * @@ -20,8 +35,7 @@ def plot_counts(obs): Plot counts. """ # Only proceed if matplotlib is available - if 1 == 1: - #try: + try: # Import matplotlib import matplotlib.pyplot as plt @@ -155,8 +169,8 @@ def plot_counts(obs): # Show counts spectra plt.show() - #except: - # print "Matplotlib is not (correctly) installed on your system. No counts spectra are shown." + except ImportError: + print "Matplotlib is not (correctly) installed on your system." # Return return @@ -244,7 +258,8 @@ def make_counts_map(obs): # ================ # def make_model_map(obs): """ - Make model map by combining all observations. + Make model map by combining all observations. The map will + be in units of [counts/(sr MeV s)]. """ # Allocate model map nxpix = 600 diff --git a/test/example_unbinned.py b/test/example_unbinned.py index f917276..bb44529 100755 --- a/test/example_unbinned.py +++ b/test/example_unbinned.py @@ -1,9 +1,25 @@ #! /usr/bin/env python -# ===========================================================================================# -# This script illustrates how to build a unbinned analysis chain using CTAtools. +# ========================================================================== +# This script illustrates how to build an unbinned analysis pipeline with +# the ctatools. If matplotlib is installed, the spectrum will be displayed +# on the screen. # -# If matplotlib is installed, the spectrum will be displayed on the screen. -# ===========================================================================================# +# Copyright (C) 2011 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ========================================================================== from ctatools import * from gammalib import * from math import * @@ -337,7 +353,7 @@ def plot_counts(observations): # Show counts spectra plt.show() - except: + except ImportError: print "Matplotlib is not (correctly) installed on your system. No counts spectra are shown." # Return diff --git a/test/test_coverage.py b/test/test_coverage.py index 1cc22ff..ab43e42 100755 --- a/test/test_coverage.py +++ b/test/test_coverage.py @@ -1,9 +1,23 @@ #! /usr/bin/env python -# ===========================================================================================# -# This script illustrates how to build a binned analysis pipeline using CTAtools. +# ========================================================================== +# This script computes the pull distribution for models. # -# If matplotlib is installed, a counts spectrum and an offset histogram will be displayed. -# ===========================================================================================# +# Copyright (C) 2011 Christoph Deil +# +# 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ========================================================================== from ctatools import * from gammalib import * from math import * diff --git a/test/test_ctatools.sh b/test/test_ctatools.sh index acebe64..e293b5a 100755 --- a/test/test_ctatools.sh +++ b/test/test_ctatools.sh @@ -1,7 +1,23 @@ #! /bin/bash +# ========================================================================== +# This script tests all ctatools executables. # -# ctatools test script -# ==================================================================== +# Copyright (C) 2011 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ========================================================================== # # Print Header @@ -21,7 +37,7 @@ rm -rf *.fits *.log *.xml # Creates pfiles directory # ======================== mkdir -p pfiles -cp -ru ../src/*/*.par pfiles/ +cp -r ../src/*/*.par pfiles/ export PFILES=pfiles # diff --git a/test/test_python.py b/test/test_python.py index bf4a70f..92413e6 100755 --- a/test/test_python.py +++ b/test/test_python.py @@ -1,9 +1,24 @@ #! /usr/bin/env python -# ===========================================================================================# -# This script illustrates how to build a unbinned analysis chain using CTAtools. +# ========================================================================== +# This script illustrates how to build an unbinned analysis pipeline using +# the ctatools. # -# If matplotlib is installed, the spectrum will be displayed on the screen. -# ===========================================================================================# +# Copyright (C) 2011 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ========================================================================== from ctatools import * from gammalib import * from math import * @@ -173,7 +188,7 @@ if __name__ == '__main__': os.mkdir("pfiles") except: pass - os.system("cp -ru ../src/*/*.par pfiles/") + os.system("cp -r ../src/*/*.par pfiles/") os.environ['PFILES'] = "pfiles" # Remove any existing result files -- libgit2 0.21.4