Commit 88dd060bac017742a29797ae6a91a576449e3132
1 parent
14acfe68
Import matplotlib first in example scripts (#3260)
Showing
20 changed files
with
62 additions
and
52 deletions
ChangeLog
doc/source/admin/release_history/1.7.3.rst
| ... | ... | @@ -8,5 +8,7 @@ Overview |
| 8 | 8 | |
| 9 | 9 | ctools 1.7.3 is a bug fix release for ctools release 1.7. |
| 10 | 10 | |
| 11 | -No changes were made to the code base. The bug fix release is made for | |
| 12 | -compliance reasons with the GammaLib 1.7.3 bug fix release. | |
| 11 | +The following bugs were fixed: | |
| 12 | + | |
| 13 | +* [`3423 <https://cta-redmine.irap.omp.eu/issues/3423>`_] - | |
| 14 | + Import matplotlib first in example scripts | ... | ... |
examples/show_butterfly.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Shows butterfly diagram created with ctbutterfly |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2014-2019 Michael Mayer | |
| 5 | +# Copyright (C) 2014-2020 Michael Mayer | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,8 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import gammalib | |
| 23 | -import cscripts | |
| 24 | 22 | try: |
| 25 | 23 | import matplotlib.pyplot as plt |
| 26 | 24 | plt.figure() |
| ... | ... | @@ -28,6 +26,8 @@ try: |
| 28 | 26 | except (ImportError, RuntimeError): |
| 29 | 27 | print('This script needs the "matplotlib" module') |
| 30 | 28 | sys.exit() |
| 29 | +import gammalib | |
| 30 | +import cscripts | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | # ======================================== # | ... | ... |
examples/show_irf.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Display Instrument Response Function |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2017-2018 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2017-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -20,8 +20,6 @@ |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | 22 | import math |
| 23 | -import gammalib | |
| 24 | -import cscripts | |
| 25 | 23 | try: |
| 26 | 24 | import matplotlib.pyplot as plt |
| 27 | 25 | from matplotlib import ticker |
| ... | ... | @@ -31,6 +29,8 @@ try: |
| 31 | 29 | except (ImportError, RuntimeError): |
| 32 | 30 | print('This script needs the "matplotlib" module') |
| 33 | 31 | sys.exit() |
| 32 | +import gammalib | |
| 33 | +import cscripts | |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | # ========= # | ... | ... |
examples/show_model.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Shows the photon spectrum of a model |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2015-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2015-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,8 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import gammalib | |
| 23 | -import cscripts | |
| 24 | 22 | try: |
| 25 | 23 | import matplotlib.pyplot as plt |
| 26 | 24 | plt.figure() |
| ... | ... | @@ -28,6 +26,8 @@ try: |
| 28 | 26 | except (ImportError, RuntimeError): |
| 29 | 27 | print('This script needs the "matplotlib" module') |
| 30 | 28 | sys.exit() |
| 29 | +import gammalib | |
| 30 | +import cscripts | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | # ======================= # | ... | ... |
examples/show_obs.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Display summary of observation definition XML file |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2016 Michael Mayer | |
| 5 | +# Copyright (C) 2016-2020 Michael Mayer | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,8 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import gammalib | |
| 23 | -import cscripts | |
| 24 | 22 | try: |
| 25 | 23 | import matplotlib.pyplot as plt |
| 26 | 24 | plt.figure() |
| ... | ... | @@ -28,6 +26,8 @@ try: |
| 28 | 26 | except (ImportError, RuntimeError): |
| 29 | 27 | print('This script needs the "matplotlib" module') |
| 30 | 28 | sys.exit() |
| 29 | +import gammalib | |
| 30 | +import cscripts | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | # ==================== # | ... | ... |
examples/show_pha.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Show a spectrum in PHA format |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2013-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2013-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -20,8 +20,6 @@ |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | 22 | import math |
| 23 | -import gammalib | |
| 24 | -import cscripts | |
| 25 | 23 | try: |
| 26 | 24 | import matplotlib.pyplot as plt |
| 27 | 25 | plt.figure() |
| ... | ... | @@ -29,6 +27,8 @@ try: |
| 29 | 27 | except (ImportError, RuntimeError): |
| 30 | 28 | print('This script needs the "matplotlib" module') |
| 31 | 29 | sys.exit() |
| 30 | +import gammalib | |
| 31 | +import cscripts | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | # ================= # | ... | ... |
examples/show_phases.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Display phase information from event list |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2017 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2017-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,8 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import gammalib | |
| 23 | -import cscripts | |
| 24 | 22 | try: |
| 25 | 23 | import matplotlib.pyplot as plt |
| 26 | 24 | plt.figure() |
| ... | ... | @@ -28,6 +26,8 @@ try: |
| 28 | 26 | except (ImportError, RuntimeError): |
| 29 | 27 | print('This script needs the "matplotlib" module') |
| 30 | 28 | sys.exit() |
| 29 | +import gammalib | |
| 30 | +import cscripts | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | # =========== # | ... | ... |
examples/show_pointings.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Display pointings in observation definition XML file |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2017 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2017-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,8 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import gammalib | |
| 23 | -import cscripts | |
| 24 | 22 | try: |
| 25 | 23 | import matplotlib.pyplot as plt |
| 26 | 24 | plt.figure() |
| ... | ... | @@ -28,6 +26,8 @@ try: |
| 28 | 26 | except (ImportError, RuntimeError): |
| 29 | 27 | print('This script needs the "matplotlib" module') |
| 30 | 28 | sys.exit() |
| 29 | +import gammalib | |
| 30 | +import cscripts | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | # =============================== # | ... | ... |
examples/show_pull_evolution.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Shows the evolution of the mean and rms pull |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2015-2017 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2015-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,7 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import cscripts | |
| 23 | 22 | try: |
| 24 | 23 | import matplotlib.pyplot as plt |
| 25 | 24 | plt.figure() |
| ... | ... | @@ -32,6 +31,7 @@ try: |
| 32 | 31 | except ImportError: |
| 33 | 32 | print('This script needs the "numpy" module') |
| 34 | 33 | sys.exit() |
| 34 | +import cscripts | |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | # =================== # | ... | ... |
examples/show_pull_histogram.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Shows the pull histogram |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2011-2017 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2011-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,7 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import cscripts | |
| 23 | 22 | try: |
| 24 | 23 | import matplotlib.pyplot as plt |
| 25 | 24 | plt.figure() |
| ... | ... | @@ -32,6 +31,7 @@ try: |
| 32 | 31 | except ImportError: |
| 33 | 32 | print('This script needs the "numpy" module') |
| 34 | 33 | sys.exit() |
| 34 | +import cscripts | |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | # =================== # | ... | ... |
examples/show_residuals.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Display residuals generated by csresspec |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2017-2019 Luigi Tibaldo | |
| 5 | +# Copyright (C) 2017-2020 Luigi Tibaldo | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -20,8 +20,6 @@ |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | 22 | import math |
| 23 | -import gammalib | |
| 24 | -import cscripts | |
| 25 | 23 | try: |
| 26 | 24 | import matplotlib.pyplot as plt |
| 27 | 25 | plt.figure() |
| ... | ... | @@ -29,6 +27,8 @@ try: |
| 29 | 27 | except (ImportError, RuntimeError): |
| 30 | 28 | print('This script needs the "matplotlib" module') |
| 31 | 29 | sys.exit() |
| 30 | +import gammalib | |
| 31 | +import cscripts | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | # ======================= # | ... | ... |
examples/show_response.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Shows one or several CTA response functions. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -20,8 +20,6 @@ |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | 22 | import math |
| 23 | -import gammalib | |
| 24 | -import cscripts | |
| 25 | 23 | try: |
| 26 | 24 | import matplotlib.pyplot as plt |
| 27 | 25 | plt.figure() |
| ... | ... | @@ -29,6 +27,8 @@ try: |
| 29 | 27 | except (ImportError, RuntimeError): |
| 30 | 28 | print('This script needs the "matplotlib" module') |
| 31 | 29 | sys.exit() |
| 30 | +import gammalib | |
| 31 | +import cscripts | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | # ================================== # | ... | ... |
examples/show_rmf.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Display Redistribution Matrix File |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2018-2019 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2018-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,8 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import gammalib | |
| 23 | -import cscripts | |
| 24 | 22 | try: |
| 25 | 23 | import matplotlib.pyplot as plt |
| 26 | 24 | plt.figure() |
| ... | ... | @@ -28,6 +26,8 @@ try: |
| 28 | 26 | except (ImportError, RuntimeError): |
| 29 | 27 | print('This script needs the "matplotlib" module') |
| 30 | 28 | sys.exit() |
| 29 | +import gammalib | |
| 30 | +import cscripts | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | # ======== # | ... | ... |
examples/show_sensitivity.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Display differential sensitivity plot generated by cssens |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2015-2017 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2015-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -20,8 +20,6 @@ |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | 22 | import math |
| 23 | -import gammalib | |
| 24 | -import cscripts | |
| 25 | 23 | try: |
| 26 | 24 | import matplotlib.pyplot as plt |
| 27 | 25 | plt.figure() |
| ... | ... | @@ -29,6 +27,8 @@ try: |
| 29 | 27 | except (ImportError, RuntimeError): |
| 30 | 28 | print('This script needs the "matplotlib" module') |
| 31 | 29 | sys.exit() |
| 30 | +import gammalib | |
| 31 | +import cscripts | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | # ===================== # | ... | ... |
examples/show_significance_distribution.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Shows the distribution of significances in a given significance map. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2018-2019 Andreas Specovius | |
| 5 | +# Copyright (C) 2018-2020 Andreas Specovius | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -46,8 +46,6 @@ |
| 46 | 46 | # ========================================================================== |
| 47 | 47 | import sys |
| 48 | 48 | import math |
| 49 | -import gammalib | |
| 50 | -import cscripts | |
| 51 | 49 | try: |
| 52 | 50 | import matplotlib.pyplot as plt |
| 53 | 51 | plt.figure() |
| ... | ... | @@ -60,6 +58,8 @@ try: |
| 60 | 58 | except ImportError: |
| 61 | 59 | print('This script needs the "numpy" module') |
| 62 | 60 | sys.exit() |
| 61 | +import gammalib | |
| 62 | +import cscripts | |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | # ======================= # | ... | ... |
examples/show_spectrum.py
| ... | ... | @@ -19,8 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import gammalib | |
| 23 | -import cscripts | |
| 24 | 22 | try: |
| 25 | 23 | import matplotlib.pyplot as plt |
| 26 | 24 | plt.figure() |
| ... | ... | @@ -33,6 +31,8 @@ try: |
| 33 | 31 | except ImportError: |
| 34 | 32 | print('This script needs the "numpy" module') |
| 35 | 33 | sys.exit() |
| 34 | +import gammalib | |
| 35 | +import cscripts | |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | # ===================================== # | ... | ... |
examples/show_ts_distribution.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Display TS distribution generated by cstsdist |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2011-2017 Jurgen Knodlseder | |
| 5 | +# Copyright (C) 2011-2020 Jurgen Knodlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -21,7 +21,6 @@ |
| 21 | 21 | import sys |
| 22 | 22 | import csv |
| 23 | 23 | import math |
| 24 | -import cscripts | |
| 25 | 24 | try: |
| 26 | 25 | import matplotlib.pyplot as plt |
| 27 | 26 | plt.figure() |
| ... | ... | @@ -34,6 +33,7 @@ try: |
| 34 | 33 | except ImportError: |
| 35 | 34 | print('This script needs the "numpy" module') |
| 36 | 35 | sys.exit() |
| 36 | +import cscripts | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | # ==================== # | ... | ... |
examples/show_variability_evolution.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Shows source variability evolution created with ctfindvar |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2018 Simon Bonnefoy | |
| 5 | +# Copyright (C) 2018-2020 Simon Bonnefoy | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,8 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import gammalib | |
| 23 | -import cscripts | |
| 24 | 22 | try: |
| 25 | 23 | import matplotlib.pyplot as plt |
| 26 | 24 | plt.figure() |
| ... | ... | @@ -28,6 +26,8 @@ try: |
| 28 | 26 | except (ImportError, RuntimeError): |
| 29 | 27 | print('This script needs the "matplotlib" module') |
| 30 | 28 | sys.exit() |
| 29 | +import gammalib | |
| 30 | +import cscripts | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | # ========================== # | ... | ... |
examples/show_viscube.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Show visibility cube |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2019 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2019-2020 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -19,8 +19,6 @@ |
| 19 | 19 | # |
| 20 | 20 | # ========================================================================== |
| 21 | 21 | import sys |
| 22 | -import gammalib | |
| 23 | -import cscripts | |
| 24 | 22 | try: |
| 25 | 23 | import matplotlib.pyplot as plt |
| 26 | 24 | plt.figure() |
| ... | ... | @@ -28,6 +26,8 @@ try: |
| 28 | 26 | except (ImportError, RuntimeError): |
| 29 | 27 | print('This script needs the "matplotlib" module') |
| 30 | 28 | sys.exit() |
| 29 | +import gammalib | |
| 30 | +import cscripts | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | # =========================== # | ... | ... |