Skip to main content
Geosciences LibreTexts

5.5 Seismic Reflection Jupyter Notebook

  • Page ID
    11985
  • Instructions

    • To use this page, read the text between each of the python code windows, then press RUN to execute the code in the box.
    • It is necessary to run each of the boxes in order.
    • Don't click restart in the cells unless you come back to the top of the page and start over.
    • If you modify the code, this modification will not remain after you leave or refresh this page.
    • You must run simulations/cells that require user input to completion. Make sure you see the Message informing you a cell is complete before continuing to the next cell. Here's why you must do this:
      • These cells may not be re-run until the simulation is completed, otherwise no output will be generated.
      • All following cells will not run until the user input cell is completed.
    • For Dropdown Menus: You do not need to rerun the cells with the menu to change your selection. However, you must rerun all of the following cells to implement the change.

    Be patient, some times it can take 1-2 minutes for the juypter kernel to start.

    An interactive example of single-layer seismic reflection.

    Key Questions: Consider these as you work your way through this page.

    • Do waves with larger or smaller incidence angles travel farther?
    • Compare the two segments of the various ray path to each other: how are these similar or different?
    • Does the bounce point spacing depend on layer thickness? Why or why not?

     

    First, let's import the necessary libraries.

    import numpy as np
    import matplotlib.pyplot as plt
    
    print('The libraries are imported.')

    Now let's create our 1-layer model. This cell will prompt you to choose a layer thickness and the spacing between receivers, and will then plot your model. Mathematically, this model is created by selecting the receiver locations and calculating the required incidence angles to achieve those locations given the layer thickness.

    print('Please enter the thickness of the layer between 0 and 500 m')
    h = float(input())
    while h <= 0 or h>500:
        print('Invalid thickness, enter a number between 0 and 500 m')
        h = float(input())
    
    print('Please enter your desired reciever spacing')
    print('There will be 5 recievers spaced evenly using this spacing')
    spacing = float(input())
    v = 1000 #m/s
    recievers = np.arange(spacing,5*spacing+spacing,spacing)
    half_x = recievers/2
    handle = display(None, display_id=True)
    lines = []
    bbox = dict(boxstyle ="round", fc = '1')
    
    while h > 0 and h <= 500:
        theta_i = np.arctan(half_x/h)
        theta = np.pi/2 - theta_i
    
        print('Plotting for thickness',h,'m')
    
        fig, ax = plt.subplots(figsize=(10,5))
        for i in range(len(theta)):
            path = np.concatenate((np.linspace(0,half_x[i])*-np.tan(theta[i])+h,(np.linspace(half_x[i]+0.01,2*half_x[i])-half_x[i])*np.tan(theta[i])))
            lines.append(ax.plot(np.concatenate((np.linspace(0,half_x[i]),np.linspace(half_x[i]+0.01,2*half_x[i]))),path,label='{:.0f}'.format(np.degrees(theta_i[i]))))
        top = ax.hlines(0,0,5*spacing,color='black')
        bottom = ax.hlines(h,0,5*spacing,color='black')
        ax.set_xlabel('Distance from Source (m)')
        tick_spacing = h / 10
        ax.set_yticks(np.arange(0,h+tick_spacing,tick_spacing))
        ax.set_yticklabels(np.arange(h,-tick_spacing,-tick_spacing))
        ax.set_ylabel('Depth (m)')
        ax.set_title('Seismic Reflection')
        label = ax.text(5*spacing*0.6,0,'Layer 1 Velocity: '+str(v)+' m/s',bbox=bbox)
        ax.legend(title='Incidence Angle (degrees)',bbox_to_anchor=(1.3,0.7))
        handle.update(fig)
        
        top.remove()
        bottom.remove()
        label.remove()
        
        print('To exit the simulation, enter a number outside the range')
        print('Please enter a new thickness of the layer between 0 and 500 m')
        h = float(input())
        plt.close()
    print('The simulation is complete. You can rerun for different reciever spacings by going back up and clicking on Run again.')

    Key Questions: Consider these as you work your way through this page.

    • Do waves with larger or smaller incidence angles travel farther?
    • Compare the two segments of the various ray path to each other: how are these similar or different?
    • Does the bounce point spacing depend on layer thickness? Why or why not?
    • Was this article helpful?