def test_plotBenchmark(self): """ Test benchmark plot. """ reltol = 1 if MATPLOTLIB_VERSION < [1, 2, 0]: reltol = 2 path = os.path.join(os.path.dirname(__file__), 'data') path_images = os.path.join(os.path.dirname(__file__), "images") sufiles = sorted(glob.glob(os.path.join(path, 'seismic01_*_vz.su'))) # new temporary file with PNG extension with ImageComparison(path_images, 'test_plotBenchmark.png', reltol=reltol) as ic: # generate plot with warnings.catch_warnings(record=True) as w: warnings.resetwarnings() np_err = np.seterr(all="warn") plotBenchmark(sufiles, outfile=ic.name, format='PNG') np.seterr(**np_err) self.assertEqual(len(w), 1) self.assertEqual(w[0].category, RuntimeWarning) self.assertTrue( str(w[0].message) in [ 'underflow encountered in divide', 'underflow encountered in true_divide' ])
def test_plotBenchmark(self): """ Test benchmark plot. """ path = os.path.join(os.path.dirname(__file__), "data") path_images = os.path.join(os.path.dirname(__file__), "images") sufiles = sorted(glob.glob(os.path.join(path, "seismic01_*_vz.su"))) # new temporary file with PNG extension with ImageComparison(path_images, "test_plotBenchmark.png") as ic: # generate plot plotBenchmark(sufiles, outfile=ic.name, format="PNG")
def test_plotBenchmark(self): """ Test benchmark plot. """ path = os.path.join(os.path.dirname(__file__), 'data', 'seismic01_*_vz.su') sufiles = glob.glob(path) # new temporary file with PNG extension with NamedTemporaryFile(suffix='.png') as tf: # generate plot plotBenchmark(sufiles, outfile=tf.name, format='PNG') # compare images expected_image = os.path.join(os.path.dirname(__file__), 'images', 'test_plotBenchmark.png') compare_images(tf.name, expected_image, 0.001)
def test_plotBenchmark(self): """ Test benchmark plot. """ reltol = 1 if MATPLOTLIB_VERSION < [1, 2, 0]: reltol = 2 path = os.path.join(os.path.dirname(__file__), 'data') path_images = os.path.join(os.path.dirname(__file__), "images") sufiles = sorted(glob.glob(os.path.join(path, 'seismic01_*_vz.su'))) # new temporary file with PNG extension with ImageComparison(path_images, 'test_plotBenchmark.png', reltol=reltol) as ic: # generate plot with warnings.catch_warnings(record=True) as w: warnings.resetwarnings() np_err = np.seterr(all="warn") plotBenchmark(sufiles, outfile=ic.name, format='PNG') np.seterr(**np_err) self.assertEqual(len(w), 1) self.assertEqual(w[0].category, RuntimeWarning) self.assertEqual(str(w[0].message), 'underflow encountered in divide')
from obspy.core.util import getExampleFile from obspy.segy.segy import readSU from obspy.segy.benchmark import plotBenchmark files = [getExampleFile('seismic01_fdmpi_vz.su'), getExampleFile('seismic01_gemini_vz.su'), getExampleFile('seismic01_sofi2D_transformed_vz.su'), getExampleFile('seismic01_specfem_vz.su')] sufiles = [readSU(file) for file in files] plotBenchmark(sufiles, title="Homogenous halfspace", xmax=0.14)