Skip to content

Commit

Permalink
improvements based on SouzaEM's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Olender committed Nov 20, 2024
1 parent 3f1f690 commit 498354a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion spyro/tools/velocity_smoother.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Check warning on line 73 in spyro/tools/velocity_smoother.py

View check run for this annotation

Codecov / codecov/patch

spyro/tools/velocity_smoother.py#L73

Added line #L73 was not covered by tests
plt.show()

return None
25 changes: 17 additions & 8 deletions test/test_cpw_calc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import pytest
import spyro


Expand All @@ -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
Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion test/test_velocity_smoother.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 498354a

Please sign in to comment.