From 88dd060bac017742a29797ae6a91a576449e3132 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Wed, 2 Dec 2020 08:35:13 +0100 Subject: [PATCH] Import matplotlib first in example scripts (#3260) --- ChangeLog | 8 ++++++++ doc/source/admin/release_history/1.7.3.rst | 6 ++++-- examples/show_butterfly.py | 6 +++--- examples/show_irf.py | 6 +++--- examples/show_model.py | 6 +++--- examples/show_obs.py | 6 +++--- examples/show_pha.py | 6 +++--- examples/show_phases.py | 6 +++--- examples/show_pointings.py | 6 +++--- examples/show_pull_evolution.py | 4 ++-- examples/show_pull_histogram.py | 4 ++-- examples/show_residuals.py | 6 +++--- examples/show_response.py | 6 +++--- examples/show_rmf.py | 6 +++--- examples/show_sensitivity.py | 6 +++--- examples/show_significance_distribution.py | 6 +++--- examples/show_spectrum.py | 4 ++-- examples/show_ts_distribution.py | 4 ++-- examples/show_variability_evolution.py | 6 +++--- examples/show_viscube.py | 6 +++--- 20 files changed, 62 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3cf7f61..ea8f4e9 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-12-02 + + * Bug fix version 1.7.3 released + ================================ + + Import matplotlib first in example scripts (#3423) + + 2020-10-15 * Bug fix version 1.7.2 released diff --git a/doc/source/admin/release_history/1.7.3.rst b/doc/source/admin/release_history/1.7.3.rst index 3880e6a..48fee06 100644 --- a/doc/source/admin/release_history/1.7.3.rst +++ b/doc/source/admin/release_history/1.7.3.rst @@ -8,5 +8,7 @@ Overview ctools 1.7.3 is a bug fix release for ctools release 1.7. -No changes were made to the code base. The bug fix release is made for -compliance reasons with the GammaLib 1.7.3 bug fix release. +The following bugs were fixed: + +* [`3423 `_] - + Import matplotlib first in example scripts diff --git a/examples/show_butterfly.py b/examples/show_butterfly.py index 61fabc7..70eeb43 100755 --- a/examples/show_butterfly.py +++ b/examples/show_butterfly.py @@ -2,7 +2,7 @@ # ========================================================================== # Shows butterfly diagram created with ctbutterfly # -# Copyright (C) 2014-2019 Michael Mayer +# Copyright (C) 2014-2020 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 @@ -19,8 +19,6 @@ # # ========================================================================== import sys -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -28,6 +26,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ======================================== # diff --git a/examples/show_irf.py b/examples/show_irf.py index 7698fb5..3faecbb 100755 --- a/examples/show_irf.py +++ b/examples/show_irf.py @@ -2,7 +2,7 @@ # ========================================================================== # Display Instrument Response Function # -# Copyright (C) 2017-2018 Juergen Knoedlseder +# Copyright (C) 2017-2020 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 @@ -20,8 +20,6 @@ # ========================================================================== import sys import math -import gammalib -import cscripts try: import matplotlib.pyplot as plt from matplotlib import ticker @@ -31,6 +29,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ========= # diff --git a/examples/show_model.py b/examples/show_model.py index b57531d..306a5f4 100755 --- a/examples/show_model.py +++ b/examples/show_model.py @@ -2,7 +2,7 @@ # ========================================================================== # Shows the photon spectrum of a model # -# Copyright (C) 2015-2016 Juergen Knoedlseder +# Copyright (C) 2015-2020 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 @@ -19,8 +19,6 @@ # # ========================================================================== import sys -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -28,6 +26,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ======================= # diff --git a/examples/show_obs.py b/examples/show_obs.py index 1cb6de7..fe1a174 100755 --- a/examples/show_obs.py +++ b/examples/show_obs.py @@ -2,7 +2,7 @@ # ========================================================================== # Display summary of observation definition XML file # -# Copyright (C) 2016 Michael Mayer +# Copyright (C) 2016-2020 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 @@ -19,8 +19,6 @@ # # ========================================================================== import sys -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -28,6 +26,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ==================== # diff --git a/examples/show_pha.py b/examples/show_pha.py index 7aa2404..b862fb8 100755 --- a/examples/show_pha.py +++ b/examples/show_pha.py @@ -2,7 +2,7 @@ # ========================================================================== # Show a spectrum in PHA format # -# Copyright (C) 2013-2016 Juergen Knoedlseder +# Copyright (C) 2013-2020 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 @@ -20,8 +20,6 @@ # ========================================================================== import sys import math -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -29,6 +27,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ================= # diff --git a/examples/show_phases.py b/examples/show_phases.py index f7c58ee..476636d 100755 --- a/examples/show_phases.py +++ b/examples/show_phases.py @@ -2,7 +2,7 @@ # ========================================================================== # Display phase information from event list # -# Copyright (C) 2017 Juergen Knoedlseder +# Copyright (C) 2017-2020 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 @@ -19,8 +19,6 @@ # # ========================================================================== import sys -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -28,6 +26,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # =========== # diff --git a/examples/show_pointings.py b/examples/show_pointings.py index 02c4b96..7db62a7 100755 --- a/examples/show_pointings.py +++ b/examples/show_pointings.py @@ -2,7 +2,7 @@ # ========================================================================== # Display pointings in observation definition XML file # -# Copyright (C) 2017 Juergen Knoedlseder +# Copyright (C) 2017-2020 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 @@ -19,8 +19,6 @@ # # ========================================================================== import sys -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -28,6 +26,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # =============================== # diff --git a/examples/show_pull_evolution.py b/examples/show_pull_evolution.py index 4920388..ba9cf40 100755 --- a/examples/show_pull_evolution.py +++ b/examples/show_pull_evolution.py @@ -2,7 +2,7 @@ # ========================================================================== # Shows the evolution of the mean and rms pull # -# Copyright (C) 2015-2017 Juergen Knoedlseder +# Copyright (C) 2015-2020 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 @@ -19,7 +19,6 @@ # # ========================================================================== import sys -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -32,6 +31,7 @@ try: except ImportError: print('This script needs the "numpy" module') sys.exit() +import cscripts # =================== # diff --git a/examples/show_pull_histogram.py b/examples/show_pull_histogram.py index 57d96bb..e90fb82 100755 --- a/examples/show_pull_histogram.py +++ b/examples/show_pull_histogram.py @@ -2,7 +2,7 @@ # ========================================================================== # Shows the pull histogram # -# Copyright (C) 2011-2017 Juergen Knoedlseder +# Copyright (C) 2011-2020 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 @@ -19,7 +19,6 @@ # # ========================================================================== import sys -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -32,6 +31,7 @@ try: except ImportError: print('This script needs the "numpy" module') sys.exit() +import cscripts # =================== # diff --git a/examples/show_residuals.py b/examples/show_residuals.py index c992f42..2042e11 100755 --- a/examples/show_residuals.py +++ b/examples/show_residuals.py @@ -2,7 +2,7 @@ # ========================================================================== # Display residuals generated by csresspec # -# Copyright (C) 2017-2019 Luigi Tibaldo +# Copyright (C) 2017-2020 Luigi Tibaldo # # 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 @@ -20,8 +20,6 @@ # ========================================================================== import sys import math -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -29,6 +27,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ======================= # diff --git a/examples/show_response.py b/examples/show_response.py index bc7290b..9d6b422 100755 --- a/examples/show_response.py +++ b/examples/show_response.py @@ -2,7 +2,7 @@ # ========================================================================== # Shows one or several CTA response functions. # -# Copyright (C) 2014-2017 Juergen Knoedlseder +# Copyright (C) 2014-2020 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 @@ -20,8 +20,6 @@ # ========================================================================== import sys import math -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -29,6 +27,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ================================== # diff --git a/examples/show_rmf.py b/examples/show_rmf.py index 83479db..7790e97 100755 --- a/examples/show_rmf.py +++ b/examples/show_rmf.py @@ -2,7 +2,7 @@ # ========================================================================== # Display Redistribution Matrix File # -# Copyright (C) 2018-2019 Juergen Knoedlseder +# Copyright (C) 2018-2020 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 @@ -19,8 +19,6 @@ # # ========================================================================== import sys -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -28,6 +26,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ======== # diff --git a/examples/show_sensitivity.py b/examples/show_sensitivity.py index 7aea2c1..ff4b94c 100755 --- a/examples/show_sensitivity.py +++ b/examples/show_sensitivity.py @@ -2,7 +2,7 @@ # ========================================================================== # Display differential sensitivity plot generated by cssens # -# Copyright (C) 2015-2017 Juergen Knoedlseder +# Copyright (C) 2015-2020 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 @@ -20,8 +20,6 @@ # ========================================================================== import sys import math -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -29,6 +27,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ===================== # diff --git a/examples/show_significance_distribution.py b/examples/show_significance_distribution.py index 20d88af..3bcdefd 100755 --- a/examples/show_significance_distribution.py +++ b/examples/show_significance_distribution.py @@ -2,7 +2,7 @@ # ========================================================================== # Shows the distribution of significances in a given significance map. # -# Copyright (C) 2018-2019 Andreas Specovius +# Copyright (C) 2018-2020 Andreas Specovius # # 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 @@ -46,8 +46,6 @@ # ========================================================================== import sys import math -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -60,6 +58,8 @@ try: except ImportError: print('This script needs the "numpy" module') sys.exit() +import gammalib +import cscripts # ======================= # diff --git a/examples/show_spectrum.py b/examples/show_spectrum.py index a199795..0b91071 100755 --- a/examples/show_spectrum.py +++ b/examples/show_spectrum.py @@ -19,8 +19,6 @@ # # ========================================================================== import sys -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -33,6 +31,8 @@ try: except ImportError: print('This script needs the "numpy" module') sys.exit() +import gammalib +import cscripts # ===================================== # diff --git a/examples/show_ts_distribution.py b/examples/show_ts_distribution.py index 0a89da8..5bf4998 100755 --- a/examples/show_ts_distribution.py +++ b/examples/show_ts_distribution.py @@ -2,7 +2,7 @@ # ========================================================================== # Display TS distribution generated by cstsdist # -# Copyright (C) 2011-2017 Jurgen Knodlseder +# Copyright (C) 2011-2020 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 @@ -21,7 +21,6 @@ import sys import csv import math -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -34,6 +33,7 @@ try: except ImportError: print('This script needs the "numpy" module') sys.exit() +import cscripts # ==================== # diff --git a/examples/show_variability_evolution.py b/examples/show_variability_evolution.py index e1adfc8..811b088 100755 --- a/examples/show_variability_evolution.py +++ b/examples/show_variability_evolution.py @@ -2,7 +2,7 @@ # ========================================================================== # Shows source variability evolution created with ctfindvar # -# Copyright (C) 2018 Simon Bonnefoy +# Copyright (C) 2018-2020 Simon Bonnefoy # # 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 @@ -19,8 +19,6 @@ # # ========================================================================== import sys -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -28,6 +26,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # ========================== # diff --git a/examples/show_viscube.py b/examples/show_viscube.py index 6f9d711..9ed14ed 100755 --- a/examples/show_viscube.py +++ b/examples/show_viscube.py @@ -2,7 +2,7 @@ # ========================================================================== # Show visibility cube # -# Copyright (C) 2019 Juergen Knoedlseder +# Copyright (C) 2019-2020 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 @@ -19,8 +19,6 @@ # # ========================================================================== import sys -import gammalib -import cscripts try: import matplotlib.pyplot as plt plt.figure() @@ -28,6 +26,8 @@ try: except (ImportError, RuntimeError): print('This script needs the "matplotlib" module') sys.exit() +import gammalib +import cscripts # =========================== # -- libgit2 0.21.4