Commit ecd8254d023be1f11bdb4d1d4bf86cc1ce622c39

Authored by Jürgen Knödlseder
1 parent d9b8269c

Check also opening of figure in matplotlib test

examples/make_spectrum.py
@@ -23,6 +23,8 @@ import ctools @@ -23,6 +23,8 @@ import ctools
23 import cscripts 23 import cscripts
24 try: 24 try:
25 import matplotlib.pyplot as plt 25 import matplotlib.pyplot as plt
  26 + plt.figure()
  27 + plt.close()
26 has_matplotlib = True 28 has_matplotlib = True
27 except: 29 except:
28 has_matplotlib = False 30 has_matplotlib = False
examples/show_butterfly.py
@@ -22,6 +22,8 @@ import sys @@ -22,6 +22,8 @@ import sys
22 import gammalib 22 import gammalib
23 try: 23 try:
24 import matplotlib.pyplot as plt 24 import matplotlib.pyplot as plt
  25 + plt.figure()
  26 + plt.close()
25 except: 27 except:
26 print('This script needs the "matplotlib" module') 28 print('This script needs the "matplotlib" module')
27 sys.exit() 29 sys.exit()
examples/show_model.py
@@ -23,6 +23,8 @@ import math @@ -23,6 +23,8 @@ import math
23 import gammalib 23 import gammalib
24 try: 24 try:
25 import matplotlib.pyplot as plt 25 import matplotlib.pyplot as plt
  26 + plt.figure()
  27 + plt.close()
26 except: 28 except:
27 print('This script needs the "matplotlib" module') 29 print('This script needs the "matplotlib" module')
28 sys.exit() 30 sys.exit()
examples/show_pha.py
@@ -23,6 +23,8 @@ import math @@ -23,6 +23,8 @@ import math
23 import gammalib 23 import gammalib
24 try: 24 try:
25 import matplotlib.pyplot as plt 25 import matplotlib.pyplot as plt
  26 + plt.figure()
  27 + plt.close()
26 except: 28 except:
27 print('This script needs the "matplotlib" module') 29 print('This script needs the "matplotlib" module')
28 sys.exit() 30 sys.exit()
@@ -68,7 +70,7 @@ def show_pha(pha, plotfile=''): @@ -68,7 +70,7 @@ def show_pha(pha, plotfile=''):
68 plt.semilogy(energy, counts, 'ro') 70 plt.semilogy(energy, counts, 'ro')
69 else: 71 else:
70 plt.loglog(energy, counts, 'ro') 72 plt.loglog(energy, counts, 'ro')
71 - plt.errorbar(energy, counts, error, fmt=None, ecolor='r') 73 + plt.errorbar(energy, counts, error, fmt='none', ecolor='r')
72 74
73 # Set axes 75 # Set axes
74 if channels: 76 if channels:
examples/show_pull_evolution.py
@@ -24,6 +24,8 @@ try: @@ -24,6 +24,8 @@ try:
24 import matplotlib.pyplot as plt 24 import matplotlib.pyplot as plt
25 except: 25 except:
26 print('This script needs the "matplotlib" module') 26 print('This script needs the "matplotlib" module')
  27 + plt.figure()
  28 + plt.close()
27 sys.exit() 29 sys.exit()
28 try: 30 try:
29 import numpy as np 31 import numpy as np
examples/show_pull_histogram.py
@@ -23,6 +23,8 @@ import csv @@ -23,6 +23,8 @@ import csv
23 try: 23 try:
24 import matplotlib.pyplot as plt 24 import matplotlib.pyplot as plt
25 import matplotlib.mlab as mlab 25 import matplotlib.mlab as mlab
  26 + plt.figure()
  27 + plt.close()
26 except: 28 except:
27 print('This script needs the "matplotlib" module') 29 print('This script needs the "matplotlib" module')
28 sys.exit() 30 sys.exit()