Skip to content

Commit

Permalink
examples: small corrections/changes in order to reduce CI time
Browse files Browse the repository at this point in the history
  • Loading branch information
ofmla committed Feb 17, 2021
1 parent 29c0b43 commit 6165b83
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 2 additions & 0 deletions examples/seismic/tti/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ def JacobianOperator(model, geometry, space_order=4,
**kwargs):
"""
Construct a Linearized Born operator in a TTI media.
Parameters
----------
model : Model
Expand Down Expand Up @@ -590,6 +591,7 @@ def JacobianAdjOperator(model, geometry, space_order=4,
save=True, **kwargs):
"""
Construct a linearized JacobianAdjoint modeling Operator in a TTI media.
Parameters
----------
model : Model
Expand Down
4 changes: 2 additions & 2 deletions examples/seismic/tti/tti_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from examples.seismic.tti import AnisotropicWaveSolver


def tti_setup(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=500.0,
def tti_setup(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=250.0,
kernel='centered', space_order=4, nbl=10, preset='layers-tti',
**kwargs):

Expand All @@ -21,7 +21,7 @@ def tti_setup(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=500.0,
return AnisotropicWaveSolver(model, geometry, space_order=space_order, **kwargs)


def run(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=500.0,
def run(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=250.0,
autotune=False, time_order=2, space_order=4, nbl=10,
kernel='centered', full_run=False, **kwargs):

Expand Down
2 changes: 2 additions & 0 deletions examples/seismic/tti/wavesolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def jacobian(self, dm, src=None, rec=None, u0=None, v0=None, du=None, dv=None,
"""
Linearized Born modelling function that creates the necessary
data objects for running an adjoint modelling operator.
Parameters
----------
src : SparseTimeFunction or array_like, optional
Expand Down Expand Up @@ -285,6 +286,7 @@ def jacobian_adjoint(self, rec, u0, v0, du=None, dv=None, dm=None, vp=None,
Gradient modelling function for computing the adjoint of the
Linearized Born modelling function, ie. the action of the
Jacobian adjoint on an input data.
Parameters
----------
rec : SparseTimeFunction
Expand Down
8 changes: 4 additions & 4 deletions tests/test_adjoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def test_adjoint_F(self, mkey, shape, kernel, space_order, setup_func):
('layers', (40, 50, 30), 'OT2', 8, acoustic_setup),
('layers', (40, 50, 30), 'OT2', 4, acoustic_setup),
# 2D TTI tests with varying space orders
('layers-tti', (30, 35), 'centered', 8, tti_setup),
('layers-tti', (30, 35), 'centered', 4, tti_setup),
('layers-tti', (20, 25), 'centered', 8, tti_setup),
('layers-tti', (20, 25), 'centered', 4, tti_setup),
# 3D TTI tests with varying space orders
('layers-tti', (30, 35, 40), 'centered', 8, tti_setup),
('layers-tti', (30, 35, 40), 'centered', 4, tti_setup),
('layers-tti', (20, 25, 30), 'centered', 8, tti_setup),
('layers-tti', (20, 25, 30), 'centered', 4, tti_setup),
])
def test_adjoint_J(self, mkey, shape, kernel, space_order, setup_func):
"""
Expand Down
10 changes: 5 additions & 5 deletions tests/test_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ def test_gradient_equivalence(self, shape, kernel, space_order, preset, nbl, dty
(np.float32, 4, 'OT2', (70, 80), False, setup),
(np.float64, 4, 'OT2', (70, 80), True, setup),
(np.float64, 4, 'OT2', (70, 80), False, setup),
(np.float32, 4, 'centered', (70, 80), True, tti_setup),
(np.float32, 4, 'centered', (70, 80), False, tti_setup),
(np.float64, 4, 'centered', (70, 80), True, tti_setup),
(np.float64, 4, 'centered', (70, 80), False, tti_setup),
(np.float32, 4, 'centered', (50, 60), True, tti_setup),
(np.float32, 4, 'centered', (50, 60), False, tti_setup),
(np.float64, 4, 'centered', (50, 60), True, tti_setup),
(np.float64, 4, 'centered', (50, 60), False, tti_setup),
])
def test_gradientFWI(self, dtype, space_order, kernel, shape, ckp, setup_func):
"""
Expand All @@ -167,7 +167,7 @@ def test_gradientFWI(self, dtype, space_order, kernel, shape, ckp, setup_func):
"""
spacing = tuple(10. for _ in shape)
wave = setup_func(shape=shape, spacing=spacing, dtype=dtype,
kernel=kernel, space_order=space_order, nbl=40)
kernel=kernel, tn=400.0, space_order=space_order, nbl=40)

vel0 = Function(name='vel0', grid=wave.model.grid, space_order=space_order)
smooth(vel0, wave.model.vp)
Expand Down

0 comments on commit 6165b83

Please sign in to comment.