diff --git a/spyro/tools/velocity_smoother.py b/spyro/tools/velocity_smoother.py index 26b9b52c..8c7196f2 100644 --- a/spyro/tools/velocity_smoother.py +++ b/spyro/tools/velocity_smoother.py @@ -70,7 +70,7 @@ def smooth_velocity_field_file(input_filename, output_filename, sigma, show=Fals plt.xlabel("x-direction (m)") plt.ylabel("z-direction (m)") ax.axis("equal") - plt.show() plt.savefig(output_filename+".png") + plt.show() return None diff --git a/test/test_cpw_calc.py b/test/test_cpw_calc.py index fb00ea97..f0312ec4 100644 --- a/test/test_cpw_calc.py +++ b/test/test_cpw_calc.py @@ -1,4 +1,5 @@ import numpy as np +import pytest import spyro @@ -10,13 +11,7 @@ def is_seismicmesh_installed(): return False -def test_cpw_calc(): - if is_seismicmesh_installed(): - FEM_method_to_evaluate = "mass_lumped_triangle" - correct_cpw = 2.3 - else: - FEM_method_to_evaluate = "spectral_quadrilateral" - correct_cpw = 2.5 +def run_test_cpw_calc(FEM_method_to_evaluate, correct_cpw): grid_point_calculator_parameters = { # Experiment parameters # Here we define the frequency of the Ricker wavelet source @@ -81,5 +76,19 @@ def test_cpw_calc(): assert all([test1, test2, test3]) +@pytest.mark.skipif(not is_seismicmesh_installed(), reason="SeismicMesh is not installed") +def test_cpw_calc_triangles(): + method = "mass_lumped_triangle" + correct_cpw = 2.3 + return run_test_cpw_calc(method, correct_cpw) + + +def test_cpw_calc_quads(): + method = "spectral_quadrilateral" + correct_cpw = 2.5 + return run_test_cpw_calc(method, correct_cpw) + + if __name__ == "__main__": - test_cpw_calc() + test_cpw_calc_triangles() + test_cpw_calc_quads() diff --git a/test/test_velocity_smoother.py b/test/test_velocity_smoother.py index 7f6f69ed..d3747e34 100644 --- a/test/test_velocity_smoother.py +++ b/test/test_velocity_smoother.py @@ -56,8 +56,8 @@ def test_write_segy_and_smooth(show=False): plt.xlabel("x-direction (m)") plt.ylabel("z-direction (m)") ax.axis("equal") - plt.show() plt.savefig("nonsmoothedtest.png") + plt.show() spyro.tools.smooth_velocity_field_file(segy_file, smoothed_file, 5, show=show)