def test_impulse_response():
    """
    conv.convolutional_model raises the source wavelet as result when the model
    is a centred spike, considering the dimension of the model equal to the
    source wavelet
    """
    w = conv.rickerwave(30., 2.e-3)
    rc_test = np.zeros((w.shape[0], 20))
    rc_test[w.shape[0] / 2, :] = 1.
    spike = conv.convolutional_model(rc_test, 30., conv.rickerwave, dt=2.e-3)
    for j in range(0, rc_test.shape[1]):
        assert_array_almost_equal(spike[:, j], w, 9)
Exemple #2
0
def test_impulse_response():
    """
    conv.convolutional_model raises the source wavelet as result when the model
    is a centred spike, considering the dimension of the model equal to the
    source wavelet
    """
    w = conv.rickerwave(30., 2.e-3)
    rc_test = np.zeros((w.shape[0], 20))
    rc_test[w.shape[0]/2, :] = 1.
    spike = conv.convolutional_model(rc_test, 30., conv.rickerwave, dt=2.e-3)
    for j in range(0, rc_test.shape[1]):
        assert_array_almost_equal(spike[:, j], w, 9)
Exemple #3
0
def test_rc_shorter_than_wavelet():
    """
    When the reflectivity series is shorter than the wavelength, the spike
    response is observed like in the opposite case. The difference is that the
    the ricker wavelet (or other symmetric wavelet) is shorter in the result.
    """
    w = conv.rickerwave(30., 2.e-3)
    rc_test = np.zeros((21, 20))
    rc_test[rc_test.shape[0]/2, :] = 1
    spike = conv.convolutional_model(rc_test, 30., conv.rickerwave, dt=2.e-3)
    for j in range(0, rc_test.shape[1]):
        assert_array_almost_equal(spike[:, j],
                                  w[(w.shape[0]-rc_test.shape[0])/2:
                                  -(w.shape[0]-rc_test.shape[0])/2], 9)
def test_rc_shorter_than_wavelet():
    """
    When the reflectivity series is shorter than the wavelength, the spike
    response is observed like in the opposite case. The difference is that the
    the ricker wavelet (or other symmetric wavelet) is shorter in the result.
    """
    w = conv.rickerwave(30., 2.e-3)
    rc_test = np.zeros((21, 20))
    rc_test[rc_test.shape[0] / 2, :] = 1
    spike = conv.convolutional_model(rc_test, 30., conv.rickerwave, dt=2.e-3)
    for j in range(0, rc_test.shape[1]):
        assert_array_almost_equal(
            spike[:, j], w[(w.shape[0] - rc_test.shape[0]) /
                           2:-(w.shape[0] - rc_test.shape[0]) / 2], 9)
Exemple #5
0
One way to plot seismic data is using black and white wiggles.
Function :func:`fatiando.vis.mpl.seismic_wiggle` does exactly this.

"""
import numpy as np
import matplotlib.pyplot as plt
from fatiando.seismic import conv
from fatiando.vis.mpl import seismic_wiggle

# We need some data to plot, so let's generate some using the convolution model
# in fatiando.seismic.conv
n_samples, n_traces = 400, 20
dt = 2e-3  # the sampling interval
velocity = 1500 * np.ones((n_samples, n_traces))
# Our model will have a different velocity layer in the middle. This will cause
# a reflection on the top and one on the bottom (with reversed polarity).
velocity[150:300, :] = 2500
# For simplicity, we'll assume constant density when calculating the
# reflectivity.
rc = conv.reflectivity(velocity, 2000 * np.ones_like(velocity))
data = conv.convolutional_model(rc, f=30, wavelet=conv.rickerwave, dt=dt)

# Plot the data using wiggles
plt.figure(figsize=(6, 5))
plt.title("Seismic wiggles")
# The scale parameter makes the wiggles larger or smaller
seismic_wiggle(data, dt=dt, scale=3, color='k')
plt.ylabel('time (s)')
plt.xlabel('trace')
plt.show()
# Define the parameters of our depth model
n_samples, n_traces = [600, 100]
velocity = 1500 * np.ones((n_samples, n_traces))
# We'll put two interfaces in depth
velocity[150:, :] = 2000
velocity[400:, :] = 3500

# We need to convert the depth model we made above into time
vel_l = conv.depth_2_time(velocity, velocity, dt=2e-3, dz=1)
# and we'll assume the density is homogeneous
rho_l = 2200 * np.ones(np.shape(vel_l))
# With that, we can calculate the reflectivity model in time
rc = conv.reflectivity(vel_l, rho_l)
# and finally perform our convolution
synt = conv.convolutional_model(rc, 30, conv.rickerwave, dt=2e-3)

# We can use the utility function in fatiando.vis.mpl to plot the seismogram
fig, axes = plt.subplots(1, 2, figsize=(8, 5))

ax = axes[0]
ax.set_title("Velocity model (in depth)")
tmp = ax.imshow(velocity,
                extent=[0, n_traces, n_samples, 0],
                cmap="copper",
                aspect='auto',
                origin='upper')
fig.colorbar(tmp, ax=ax, pad=0, aspect=50)
ax.set_xlabel('Trace')
ax.set_ylabel('Depth (m)')
# Define the parameters of our depth model
n_samples, n_traces = [600, 100]
velocity = 1500*np.ones((n_samples, n_traces))
# We'll put two interfaces in depth
velocity[150:, :] = 2000
velocity[400:, :] = 3500
dt = 2e-3

# We need to convert the depth model we made above into time
vel_l = conv.depth_2_time(velocity, velocity, dt=dt, dz=1)
# and we'll assume the density is homogeneous
rho_l = 2200*np.ones(np.shape(vel_l))
# With that, we can calculate the reflectivity model in time
rc = conv.reflectivity(vel_l, rho_l)
# and finally perform our convolution
synt = conv.convolutional_model(rc, 30, conv.rickerwave, dt=dt)

# We can use the utility function in fatiando.vis.mpl to plot the seismogram
fig, axes = plt.subplots(1, 2, figsize=(8, 5))

ax = axes[0]
ax.set_title("Velocity model (in depth)")
tmp = ax.imshow(velocity, extent=[0, n_traces, n_samples, 0],
                cmap="copper", aspect='auto', origin='upper')
fig.colorbar(tmp, ax=ax, pad=0, aspect=50)
ax.set_xlabel('Trace')
ax.set_ylabel('Depth (m)')

ax = axes[1]
ax.set_title("Synthetic seismogram")
mpl.seismic_wiggle(synt[:, ::20], dt, scale=1)
Exemple #8
0
Seismic: Synthetic convolutional seismogram for a simple two layer velocity
model
"""
import numpy as np
import matplotlib.pyplot as plt
from fatiando.seismic import conv
from fatiando.vis import mpl
# model parameters
n_samples, n_traces = [600, 20]
rock_grid = 1500.*np.ones((n_samples, n_traces))
rock_grid[300:, :] = 2500.
# synthetic calculation
vel_l = conv.depth_2_time(rock_grid, rock_grid, dt=2.e-3, dz=1.)
rho_l = np.ones(np.shape(vel_l))
rc = conv.reflectivity(vel_l, rho_l)
synt = conv.convolutional_model(rc, 30., conv.rickerwave, dt=2.e-3)
# plot input model
plt.figure()
plt.subplot(3, 1, 1)
plt.ylabel('Depth (m)')
plt.title("Depth Vp model", fontsize=13, family='sans-serif', weight='bold')
plt.imshow(rock_grid, extent=[0, n_traces, n_samples, 0],
           cmap=mpl.pyplot.cm.bwr, aspect='auto', origin='upper')
# plot resulted seismogram using wiggle
plt.subplot(3, 1, 2)
mpl.seismic_wiggle(synt, dt=2.e-3)
mpl.seismic_image(synt, dt=2.e-3, cmap=mpl.pyplot.cm.jet, aspect='auto')
plt.ylabel('time (seconds)')
plt.title("Convolutional seismogram", fontsize=13, family='sans-serif',
          weight='bold')
Exemple #9
0
One way to plot seismic data is using black and white wiggles.
Function :func:`fatiando.vis.mpl.seismic_wiggle` does exactly this.

"""
import numpy as np
import matplotlib.pyplot as plt
from fatiando.seismic import conv
from fatiando.vis.mpl import seismic_wiggle

# We need some data to plot, so let's generate some using the convolution model
# in fatiando.seismic.conv
n_samples, n_traces = 400, 20
dt = 2e-3    # the sampling interval
velocity = 1500*np.ones((n_samples, n_traces))
# Our model will have a different velocity layer in the middle. This will cause
# a reflection on the top and one on the bottom (with reversed polarity).
velocity[150:300, :] = 2500
# For simplicity, we'll assume constant density when calculating the
# reflectivity.
rc = conv.reflectivity(velocity, 2000*np.ones_like(velocity))
data = conv.convolutional_model(rc, f=30, wavelet=conv.rickerwave, dt=dt)

# Plot the data using wiggles
plt.figure(figsize=(6, 5))
plt.title("Seismic wiggles")
# The scale parameter makes the wiggles larger or smaller
seismic_wiggle(data, dt=dt, scale=3, color='k')
plt.ylabel('time (s)')
plt.xlabel('trace')
plt.show()