├── .gitattributes ├── .gitignore ├── explorationpy ├── __init__.py ├── marine.py ├── modeling.py ├── prestack_synthetic.py ├── raytrace.py ├── raytraceClass.py ├── raytrace_optimize.py ├── vawt.py ├── velocity.py ├── zApp.py └── zoeppritz.py ├── synthetic_marine.py ├── test_fft.py ├── test_marine.py └── test_raytracing.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # Jupyter Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | .venv/ 83 | venv/ 84 | ENV/ 85 | 86 | # Spyder project settings 87 | .spyderproject 88 | 89 | # Rope project settings 90 | .ropeproject 91 | 92 | # VS code 93 | .vscode/ 94 | 95 | # Numpy data 96 | *.npy -------------------------------------------------------------------------------- /explorationpy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whimian/ExplorationPy/00a560845fdafcd73734568c1853f7cd999b9cd8/explorationpy/__init__.py -------------------------------------------------------------------------------- /explorationpy/marine.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Collections of routines for exploration seismology 4 | 5 | Modifed on Mon May 08 2017 6 | """ 7 | import numpy as np 8 | import matplotlib.pyplot as plt 9 | 10 | __author__ = "yuhao" 11 | 12 | def mat_mult(adj, add, B, x, nx, y, ny): 13 | "matrix multiplication and its joint" 14 | for ix in range(nx): 15 | for iy in range(ny): 16 | if adj is True: 17 | x[ix] += B[iy, ix] * y[iy] 18 | else: 19 | y[iy] += B[iy, ix] * x[ix] 20 | 21 | 22 | def igrad1(adj, add, xx, n, yy): 23 | "1-D first derivative" 24 | for i in range(1, n-1): 25 | if adj is False: 26 | yy[i] = yy[i] + xx[i+1] - xx[i] 27 | else: 28 | xx[i+1] = xx[i+1] + yy[i] 29 | xx[i] = xx[i] - yy[i] 30 | 31 | 32 | def lmo(adj, add, slowness, tau0, t0, dt, x0, dx, modl, nt, nx, data): 33 | "linear moveout" 34 | for ix in range(1, nx): 35 | x = x0 + dx * (ix - 1) 36 | for it in range(1, nt): 37 | t = t0 + dt * (it - 1) 38 | tau = t - x * slowness 39 | iu = 1.5001 + (tau-tau0)/dt 40 | if 0 < iu and iu <= nt: 41 | if adj == 0: 42 | data[it, ix] = data[it, ix] + modl[iu, ix] 43 | else: 44 | modl[iu, ix] = modl[iu, ix] + data[it, ix] 45 | 46 | 47 | def wiggle(Data, SH, skipt=1, maxval=8, lwidth=.1): 48 | """variable area wiggle trace 49 | """ 50 | fig, ax = plt.subplots() 51 | t = range(SH['ns']) 52 | for i in range(0, SH['ntraces'], skipt): 53 | trace = Data[:, i] 54 | trace[0] = 0 55 | trace[SH['ns'] - 1] = 0 56 | ax.plot(i + trace/maxval, t, color='black', linewidth=lwidth) 57 | for a in range(len(trace)): 58 | if trace[a] < 0: 59 | trace[a] = 0 60 | ax.fill(i+Data[:, i]/maxval, t, 'k', linewidth=0) 61 | ax.set(ylim=(np.max(t), 0)) 62 | ax.title(SH['filename']) 63 | ax.grid(True) 64 | ax.invert_yaxis() 65 | ax.show() 66 | 67 | 68 | def ricker(dt, fdom, tlength): 69 | "ricker wavelet" 70 | # if(nargin<3): 71 | # tlength=127.*dt 72 | # if(nargin<2): 73 | # fdom=15.0 74 | # create a time vector 75 | nt = np.round(tlength/dt) + 1 76 | tmin = -1 * dt * np.round(nt / 2) 77 | # tw=tmin+dt*(0:nt-1)' 78 | tw = tmin + dt*np.arange(nt) 79 | # create the wavelet 80 | pf = np.pi**2 * fdom**2 81 | wavelet = (1 - 2. * pf * tw**2) * np.exp(-pf * tw**2) 82 | re = {'tw': tw, 'wavelet': wavelet} 83 | return re 84 | # normalize 85 | # generate a refenence sinusoid at the dominant frequency 86 | # wavelet=wavenorm(wavelet,tw,2) 87 | -------------------------------------------------------------------------------- /explorationpy/modeling.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | 4 | 5 | def heaviside(t): 6 | return 0.5 * (np.sign(t) + 1) 7 | 8 | 9 | def ricker(t, fm, tm, R, v): 10 | k = R/v 11 | f = heaviside(t - k) * (1 - 2 * np.pi**2 * fm**2 * (t - tm - k)**2) *\ 12 | np.exp(-np.pi**2 * fm**2 * (t - tm - k)**2) 13 | return f 14 | 15 | # w = np.zeros(t.shape) 16 | # for i in range(len(t)): 17 | # w[i] = ricker(t[i], 30., 0.03, 400., 2000.) 18 | 19 | # plt.plot(t, w) 20 | t = np.r_[0:0.5:1000j] 21 | r = np.r_[-500:500:501j] 22 | z = np.r_[0:2000:1001j] 23 | t = np.r_[0:0.6:0.003] 24 | nr = len(r) 25 | nz = len(z) 26 | nt = len(t) 27 | 28 | dr = 2 29 | dz = 2 30 | dt = 0.003 31 | 32 | # normal finite difference 33 | A = np.zeros((len(r), len(z), len(t))) 34 | B = np.zeros((len(r), len(z), len(t))) 35 | for p in range(1, nt-1): 36 | for m in range(1, nr-1): 37 | for n in range(1, nz-1): 38 | if (p == 0): 39 | continue 40 | else: 41 | if (n <= 501): 42 | vp = 2000 43 | vs = 1500 44 | else: 45 | vp = 1500 * 1.1 46 | vs = 2000 * 1.1 47 | 48 | if (m != nr/2): 49 | A1 = 2 * A[m, n, p] 50 | A2 = -A[m, n, p-1] 51 | A3 = (vp * dt / dr)**2 * \ 52 | (A[m+1, n, p] - 2 * A[m, n, p] + A[m-1, n, p]) 53 | A4 = 0.5 * (vp * dt / dr)**2 / (m - nr/2) * \ 54 | (A[m+1, n, p] - A[m-1, n, p]) 55 | A5 = - (vp*dt/dr)**2 / \ 56 | (m - nr/2)**2 * A[m, n, p] 57 | A6 = 0.25 * (vp*dt/dr)**2 * (dr/dz) * (1 - (vs/vp)**2) * \ 58 | (B[m+1, n+1, p] - B[m+1, n-1, p] - 59 | B[m-1, n+1, p] + B[m-1, n-1, p]) 60 | A7 = (vp*dt/dr)**2 * (dr/dz)**2 * (vs/vp)**2 * \ 61 | (A[m, n+1, p] - 2 * A[m, n, p] + A[m, n-1, p]) 62 | A[m, n, p+1] = A1 + A2 + A3 + A4 + A5 + A6 + A7 63 | 64 | B1 = 2 * B[m, n, p] 65 | B2 = -B[m, n, p-1] 66 | B3 = (vp * dt / dr)**2 * (dr/dz)**2 * \ 67 | (B[m, n+1, p] - 2 * B[m, n, p] + B[m, n-1, p]) 68 | B4 = 0.5 * (vp*dt/dr)**2 * (dr/dz) * (1 - (vs/vp)**2) / \ 69 | (m - nr/2) * (A[m, n+1, p] - A[m, n-1, p]) 70 | B5 = 0.25 * (vp*dt/dr)**2 * (dr/dz) * (1 - (vs/vp)**2) * \ 71 | (A[m+1, n+1, p] - A[m+1, n-1, p] - 72 | A[m-1, n+1, p] + A[m-1, n-1, p]) 73 | B6 = 0.5 * (vp*dt/dr)**2 * (vs/vp)**2 / (m - nr/2) * \ 74 | (B[m+1, n, p] - B[m-1, n, p]) 75 | B[m, n, p+1] = B1 + B2 + B3 + B4 + B5 + B6 76 | 77 | A[nr/2, :, :] = 0 78 | for p in range(1, nt-1): 79 | for n in range(1, nz-1): 80 | B1 = 2 * B[nr/2, n, p] 81 | B2 = -B[nr/2, n, p-1] 82 | B3 = (vp*dt/dr)**2 * (dr/dz)**2 * \ 83 | (B[nr/2, n+1, p] - 2 * B[nr/2, n, p] - 84 | 2 * B[nr/2, n, p] + B[nr/2, n-1, p]) 85 | B4 = 1.5 * (vp*dt/dr)**2 * (dr/dz) * (1 - (vs/vp)**2) * \ 86 | (A[nr/2+1, n+1, p] - A[nr/2+1, n-1, p]) 87 | B5 = 2 * (vp*dt/dr)**2 * (vs/vp)**2 * \ 88 | (B[nr/2+1, n, p] - B[nr/2, n, p]) 89 | B[nr/2, n, p+1] = B1 + B2 + B3 + B4 + B5 90 | 91 | # A[m, n, p+1] = 2 * A[m, n, p] - A[m, n, p-1] + \ 92 | # (vp * dt / dr)**2 * \ 93 | # (A[m+1, n, p] - 2 * A[m, n, p] + A[m-1, n, p]) + \ 94 | # 0.5 * (vp * dt / dr)**2 / (m - nr/2) * \ 95 | # (A[m+1, n, p] - A[m-1, n, p]) - (vp*dt/dr)**2 / \ 96 | # (m - nr/2)**2 * A[m, n, p] + 0.25 * (vp*dt/dr)**2 * \ 97 | # (dr/dz) * (1 - (vs/vp)**2) * \ 98 | # (B[m+1, n+1, p] - B[m+1, n-1, p] - 99 | # B[m-1, n+1, p] + B[m-1, n-1, p]) + \ 100 | # (vp*dt/dr)**2 * (dr/dz)**2 * (vs/vp)**2 * \ 101 | # (A[m, n+1, p] - 2 * A[m, n, p] + A[m, n-1, p]) 102 | # B[m, n, p+1] = 2 * B[m, n, p] - B[m, n, p-1] + \ 103 | # (vp * dt / dr)**2 * (dr/dz)**2 * \ 104 | # (B[m, n+1, p] - 2 * B[m, n, p] + B[m, n-1, p]) + \ 105 | # 0.5 * (vp*dt/dr)**2 * (dr/dz) * (1 - (vs/vp)**2) / \ 106 | # (m - nr/2) * (A[m, n+1, p] - A[m, n-1, p]) + \ 107 | # 0.25 * (vp*dt/dr)**2 * (dr/dz) * (1 - (vs/vp)**2) * \ 108 | # (A[m+1, n+1, p] - A[m+1, n-1, p] - 109 | # A[m-1, n+1, p] + A[m-1, n-1, p]) + \ 110 | # 0.5 * (vp*dt/dr)**2 * (vs/vp)**2 / (m - nr/2) * \ 111 | # (B[m+1, n, p] - B[m-1, n, p]) 112 | # B[nr/2, n, p+1] = 2 * B[nr/2, n, p] - B[nr/2, n, p-1] + \ 113 | # (vp*dt/dr)**2 * (dr/dz)**2 * \ 114 | # (B[nr/2, n+1, p] - 2 * B[nr/2, n, p] + B[nr/2, n-1, p]) + \ 115 | # 1.5 * (vp*dt/dr)**2 * (dr/dz) * (1 - (vs/vp)**2) * \ 116 | # (A[nr/2+1, n+1, p] - A[nr/2+1, n-1, p]) + \ 117 | # 2 * (vp*dt/dr)**2 * (vs/vp)**2 * (B[nr/2+1, n, p] - B[nr/2, n, p]) 118 | -------------------------------------------------------------------------------- /explorationpy/prestack_synthetic.py: -------------------------------------------------------------------------------- 1 | # import raytraceClass as rc 2 | import numpy as np 3 | # import matplotlib.pyplot as plt 4 | 5 | from raytrace import * 6 | from zoeppritz import * 7 | import marine as ma 8 | 9 | vp = np.array([1500, 2000, 2500, 3000, 3500]) 10 | vs = np.array([1500, 1600, 2000, 2250, 2000]) 11 | rho = np.array([2.3, 2.7, 2.8, 3.0, 3.0]) 12 | thic = np.array([50, 50, 50, 50]) 13 | offset = np.array([25, 50, 75, 100]) 14 | 15 | pm, tm = raytrace(vp, thic, offset) 16 | 17 | rayParameter = pm 18 | 19 | reflec = np.zeros((thic.shape[-1], offset.shape[-1])) 20 | 21 | for ii in np.arange(pm.shape[0]): 22 | for io in np.arange(pm.shape[1]): 23 | reflec[ii, io] = zoeppritz(vp[ii], vp[ii+1], vs[ii], vs[ii+1], 24 | rho[ii], rho[ii+1], pm[ii, io], 'r') 25 | 26 | tw = [] 27 | wavelet = [] 28 | dt = 0.01 29 | fdom = 30 30 | tlength = 1.0 31 | re = ma.ricker(dt, fdom, tlength) 32 | tw = re['tw'] 33 | wavelet = re['wavelet'] 34 | W = np.fft.fft(wavelet) 35 | freq = np.fft.fftfreq(tw.shape[-1], d=0.01) 36 | 37 | T = np.zeros((freq.shape[-1], offset.shape[-1]), dtype=complex) 38 | 39 | for io in np.arange(offset.shape[-1]): 40 | for f in np.arange(freq.shape[-1]): 41 | temp = 0 42 | for ii in np.arange(thic.shape[-1]): 43 | temp += reflec[ii, io] * W[f] *\ 44 | np.exp(1j * 2 * np.pi * freq[f] * tm[ii, io]) 45 | T[f, io] = temp 46 | 47 | A = np.real(T) 48 | SH = {'ns': freq.shape[-1]/2 + 1, 'ntraces': 4, 'filename': 'abc'} 49 | ma.wiggle(A[0: freq.shape[-1]/2 + 1, :], SH) 50 | -------------------------------------------------------------------------------- /explorationpy/raytrace.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created in 2014 4 | Modifed on Apr. 26th 2017 5 | """ 6 | import numpy as np 7 | 8 | __author__ = "yuhao" 9 | 10 | def raytrace(velocity, thickness, offset): 11 | """ 12 | Raytracing for simple 1-D VTI model. 13 | 14 | Calculate reflection coefficient and travel time for each interface given 15 | layer thickness and offset distances. 16 | 17 | Parameters 18 | ---------- 19 | velocity : 1-d ndarray 20 | Velocity of each layer 21 | 22 | thickness : 1-d ndarray 23 | Thickness of each layer 24 | 25 | offset : 1-d ndarray 26 | Offset positions to be calculated in horizontal direction 27 | 28 | Return 29 | ------ 30 | pm : 2-d ndarray 31 | Reflection coefficients for each layer and each offset 32 | 33 | tm : 2-d ndarray 34 | Travel time for each layer and each offset 35 | """ 36 | m = len(thickness) 37 | n = len(offset) 38 | pm = np.zeros((m, n)) 39 | tm = np.zeros((m, n)) 40 | for ii in range(m): # for each interface 41 | for io in range(n): # for each offset 42 | err = offset[io] 43 | counter = 0 44 | p0 = np.sin(np.pi/4) / velocity[ii] 45 | flag = False 46 | while err > 0.01 * offset[io]: 47 | # deviation from target using p0 48 | y0 = 0 49 | for i in range(ii + 1): 50 | y0 += (thickness[i] * velocity[i] * p0) / np.sqrt(1 - velocity[i]**2 * p0**2) 51 | y0 = 2 * y0 52 | ydelta = offset[io] - y0 53 | # correct p0 54 | pg = 0 # gradient of p relate to y 55 | for i in range(ii + 1): 56 | pg += (thickness[i] * velocity[i]) / ((1 - velocity[i]**2 * p0**2)**(1.5)) 57 | pg = pg**(-1) 58 | pg = 0.5 * pg 59 | p0 += pg * ydelta # corrected p 60 | # calculate error for new p0 61 | y = 0 62 | for i in range(ii + 1): 63 | y += (thickness[i] * velocity[i] * p0) / np.sqrt(1 - velocity[i]**2 * p0**2) 64 | y = 2 * y 65 | err = np.abs(y - offset[io]) 66 | # break when correct for 100 times 67 | counter += 1 68 | if counter == 100: 69 | p0 = np.nan 70 | break 71 | pm[ii, io] = p0 72 | # Calculate Travel time along specific trace 73 | for ii in range(m): # for each interface 74 | for io in range(n): # for each offset 75 | traveltime = 0 76 | p = pm[ii, io] 77 | for i in range(ii + 1): 78 | traveltime = traveltime + 2 * thickness[i] /\ 79 | (velocity[i] * np.sqrt(1 - velocity[i]**2 * p**2)) 80 | tm[ii, io] = traveltime 81 | 82 | return pm, tm 83 | -------------------------------------------------------------------------------- /explorationpy/raytraceClass.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Fri Dec 12 16:13:29 2014 4 | 5 | @author: yuhao 6 | """ 7 | import numpy as np 8 | 9 | class Raytrace(): 10 | Vp = [] 11 | thic = [] 12 | offset = [] 13 | pm = [] 14 | 15 | def __inint__(self, Vp, thic, offset): 16 | self.Vp = Vp 17 | self.thic = thic 18 | self.offset = offset 19 | 20 | def raytrace(self): 21 | Vp = self.Vp 22 | thic = self.thic 23 | # rho = self.rho 24 | offset = self.offset 25 | 26 | self.pm = np.zeros((len(thic),len(offset))) 27 | 28 | for ii in range(len(thic)): #for each interface 29 | for io in range(len(offset)): #for each offset 30 | err = offset[io] 31 | counter = 0 32 | p0 = np.sin(np.pi/4) / Vp[ii] 33 | flag = False 34 | while err > 0.01* offset[io]: 35 | y0 = 0 36 | for i in range(ii + 1): 37 | y0 += (thic[i] * Vp[i] * p0) / np.sqrt(1 - Vp[i]**2 * p0**2) 38 | y0 = 2 * y0 39 | 40 | ydelta = offset[io] - y0 41 | 42 | pg = 0 # gradient of p relate to y 43 | for i in range(ii + 1): 44 | pg += (thic[i] * Vp[i]) / ((1 - Vp[i]**2 * p0**2)**(1.5)) 45 | pg = pg**(-1) 46 | pg = 0.5 * pg 47 | 48 | p0 += pg * ydelta # corrected p 49 | 50 | y = 0 51 | for i in range(ii + 1): 52 | y += (thic[i] * Vp[i] * p0) / np.sqrt(1 - Vp[i]**2 * p0**2) 53 | y = 2 * y 54 | 55 | err = np.abs(y - offset[io]) 56 | 57 | counter += 1 58 | if counter == 100: 59 | flag = True 60 | break 61 | if flag == True: 62 | self.pm[ii,io] = np.NaN 63 | else: 64 | self.pm[ii,io] = p0 -------------------------------------------------------------------------------- /explorationpy/raytrace_optimize.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Apr. 26th 2017 4 | """ 5 | from functools import partial 6 | 7 | import numpy as np 8 | from scipy.optimize import minimize 9 | 10 | __author__ = "yuhao" 11 | 12 | def raytrace(velocity, thickness, offset): 13 | """ 14 | Raytracing for simple 1-D VTI model. 15 | 16 | Calculate reflection coefficient and travel time for each interface given 17 | layer thickness and offset distances. 18 | 19 | Parameters 20 | ---------- 21 | velocity : 1-d ndarray 22 | Velocity of each layer 23 | 24 | thickness : 1-d ndarray 25 | Thickness of each layer 26 | 27 | offset : 1-d ndarray 28 | Offset positions to be calculated in horizontal direction 29 | 30 | Return 31 | ------ 32 | pm : 2-d ndarray 33 | Reflection coefficients for each layer and each offset 34 | 35 | tm : 2-d ndarray 36 | Travel time for each layer and each offset 37 | """ 38 | velocity = np.array(velocity) 39 | thickness = np.array(thickness) 40 | m = len(thickness) 41 | n = len(offset) 42 | pm = np.zeros((m, n)) 43 | tm = np.zeros((m, n)) 44 | for ii in range(m): # for each interface 45 | for io in range(n): # for each offset 46 | err = offset[io] 47 | counter = 0 48 | p0 = np.sin(np.pi/4) / velocity[ii] 49 | tolerance = 0.01 * offset[io] 50 | func = partial( 51 | func_offset, y1=offset[io], velocity=velocity[:ii+1], 52 | thickness=thickness[:ii+1]) 53 | res = minimize(func, p0, method='Nelder-Mead') 54 | p0 = res.x[0] 55 | pm[ii, io] = p0 56 | # Calculate Travel time along specific trace 57 | for ii in range(m): # for each interface 58 | for io in range(n): # for each offset 59 | traveltime = 0 60 | p = pm[ii, io] 61 | traveltime = func_traveltime(p, velocity[:ii+1], thickness[:ii+1]) 62 | tm[ii, io] = traveltime 63 | 64 | return pm, tm 65 | 66 | 67 | def func_traveltime(p, velocity, thickness): 68 | return np.sum(2 * thickness / (velocity * np.sqrt(1 - velocity**2 * p**2))) 69 | 70 | 71 | def func_offset(p, y1, velocity, thickness): 72 | """ 73 | Calculate offset with reflection coefficient p 74 | """ 75 | offset = 2 * np.sum((thickness * velocity * p) / \ 76 | np.sqrt(1 - velocity**2 * p**2)) 77 | return np.abs(offset - y1) 78 | -------------------------------------------------------------------------------- /explorationpy/vawt.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Thu Apr 26 2017 4 | """ 5 | import numpy as np 6 | import matplotlib.pyplot as plt 7 | from scipy.signal import cspline1d, cspline1d_eval 8 | 9 | __author__ = "yuhao" 10 | 11 | class Wiggles(object): 12 | def __init__(self, data, wiggleInterval=10, overlap=1, posFill='black', 13 | negFill=None, lineColor='black', rescale=True, extent=None, ax=None): 14 | self.data = data 15 | self.origin = 0 16 | self.posFill = 'black' 17 | self.negFill = None 18 | self.lineColor = None 19 | self.resampleRatio = 10 20 | self.rescale = True 21 | self.zmin = 0 22 | self.zmax = None 23 | self.ax = ax 24 | self.extent = extent 25 | self.wiggleInterval = wiggleInterval 26 | self.overlap = overlap 27 | 28 | def wiggle(self, values): 29 | """ 30 | Plot a trace in VAWT(Variable Area Wiggle Trace) 31 | """ 32 | if self.zmax is None: 33 | self.zmax = values.size 34 | 35 | # Rescale so that values ranges from -1 to 1 36 | if self.rescale: 37 | values = values.astype(np.float) 38 | values -= values.min() 39 | values /= values.ptp() 40 | values *= 2 41 | values -= 1 42 | 43 | # Interpolate at resampleRatio x the previous density 44 | resample_z = np.linspace(0, values.size, values.size * self.resampleRatio) 45 | # cubic spline interpolation 46 | cj = cspline1d(values) 47 | resample_v = cspline1d_eval(cj, resample_z) 48 | print(resample_v) 49 | newz = resample_z 50 | if self.origin == None: 51 | self.origin = resample_v.mean() 52 | 53 | # Plot 54 | if self.posFill is not None: 55 | self.ax.fill_betweenx(newz, resample_v, self.origin, 56 | where=resample_v > self.origin, 57 | facecolor=self.posFill) 58 | if self.negFill is not None: 59 | self.ax.fill_betweenx(newz, resample_v, self.origin, 60 | where=resample_v < self.origin, 61 | facecolor=self.negFill) 62 | if self.lineColor is not None: 63 | self.ax.plot(resample_v, newz, color=self.lineColor, linewidth=.1) 64 | 65 | def wiggles(self): 66 | """ 67 | 2-D Wiggle Trace Variable Amplitude Plot 68 | """ 69 | # Rescale so that the data ranges from -1 to 1 70 | if self.rescale: 71 | self.data = self.data.astype(np.float) 72 | self.data -= self.data.min() 73 | self.data /= self.data.ptp() 74 | self.data *= 2 75 | self.data -= 1 76 | 77 | if self.extent is None: 78 | xmin, ymin = 0, self.data.shape[0] 79 | ymax, xmax = 0, self.data.shape[1] 80 | else: 81 | xmin, xmax, ymin, ymax = extent 82 | 83 | if self.ax is None: 84 | fig, self.ax = plt.subplots() 85 | self.ax.invert_yaxis() 86 | self.ax.set(xlim=[xmin, xmax], ylim=[ymin, ymax]) # range should be larger!!! 87 | ny, nx = self.data.shape 88 | x_loc = np.linspace(xmin, xmax, nx) 89 | for i in range(self.wiggleInterval//2, nx, self.wiggleInterval): 90 | x = self.overlap * (self.wiggleInterval / 2.0) * (x_loc[1] - x_loc[0]) * self.data[:, i] 91 | self.wiggle(x + x_loc[i]) 92 | 93 | 94 | def wiggle(values, origin=0, posFill='black', negFill=None, lineColor='black', 95 | resampleRatio=10, rescale=False, zmin=0, zmax=None, ax=None): 96 | """ 97 | Plot a trace in VAWT(Variable Area Wiggle Trace) 98 | 99 | Parameters 100 | ---------- 101 | x: input data (1D numpy array) 102 | 103 | origin: (default, 0) value to fill above or below (float) 104 | 105 | posFill: (default, black) 106 | color to fill positive wiggles with (string or None) 107 | 108 | negFill: (default, None) 109 | color to fill negative wiggles with (string or None) 110 | 111 | lineColor: (default, black) 112 | color of wiggle trace (string or None) 113 | 114 | resampleRatio: (default, 10) 115 | factor to resample traces by before plotting (1 = raw data) (float) 116 | 117 | rescale: (default, False) 118 | If True, rescale "x" to be between -1 and 1 119 | 120 | zmin: (default, 0) 121 | The minimum z to use for plotting 122 | 123 | zmax: (default, len(x)) 124 | The maximum z to use for plotting 125 | 126 | ax: (default, current axis) 127 | The matplotlib axis to plot onto 128 | 129 | Return 130 | ------ 131 | Plot 132 | """ 133 | if zmax is None: 134 | zmax = values.size 135 | 136 | # Rescale so that values ranges from -1 to 1 137 | if rescale: 138 | values = values.astype(np.float) 139 | values -= values.min() 140 | values /= values.ptp() 141 | values *= 2 142 | values -= 1 143 | 144 | # Interpolate at resampleRatio x the previous density 145 | resample_z = np.linspace(0, values.size, values.size * resampleRatio) 146 | # cubic spline interpolation 147 | cj = cspline1d(values) 148 | resample_v = cspline1d_eval(cj, resample_z) 149 | 150 | # newz = np.linspace(zmax, zmin, resample_z.size) 151 | # newz = np.linspace(zmin, zmax, resample_z.size) 152 | newz = resample_z 153 | if origin == None: 154 | origin = resample_v.mean() 155 | 156 | # # Plot 157 | # if ax is None: 158 | # ax = plt.gca() 159 | # # plt.hold(True) 160 | if posFill is not None: 161 | ax.fill_betweenx(newz, resample_v, origin, 162 | where=resample_v > origin, 163 | facecolor=posFill) 164 | if negFill is not None: 165 | ax.fill_betweenx(newz, resample_v, origin, 166 | where=resample_v < origin, 167 | facecolor=negFill) 168 | if lineColor is not None: 169 | ax.plot(resample_v, newz, color=lineColor, linewidth=.1) 170 | 171 | 172 | def wiggles(data, wiggleInterval=10, overlap=1, posFill='black', 173 | negFill=None, lineColor='black', rescale=True, extent=None, ax=None): 174 | """ 175 | 2-D Wiggle Trace Variable Amplitude Plot 176 | 177 | Parameters 178 | ---------- 179 | x: input data (2D numpy array) 180 | wiggleInterval: (default, 10) Plot 'wiggles' every wiggleInterval traces 181 | overlap: (default, 0.7) amount to overlap 'wiggles' by (1.0 = scaled 182 | to wiggleInterval) 183 | posFill: (default, black) color to fill positive wiggles with (string 184 | or None) 185 | negFill: (default, None) color to fill negative wiggles with (string 186 | or None) 187 | lineColor: (default, black) color of wiggle trace (string or None) 188 | resampleRatio: (default, 10) factor to resample traces by before 189 | plotting (1 = raw data) (float) 190 | extent: (default, (0, nx, 0, ny)) The extent to use for the plot. 191 | A 4-tuple of (xmin, xmax, ymin, ymax) 192 | ax: (default, current axis) The matplotlib axis to plot onto. 193 | Output: 194 | a matplotlib plot on the current axes 195 | """ 196 | # Rescale so that the data ranges from -1 to 1 197 | if rescale: 198 | data = data.astype(np.float) 199 | data -= data.min() 200 | data /= data.ptp() 201 | data *= 2 202 | data -= 1 203 | 204 | if extent is None: 205 | xmin, ymin = 0, data.shape[0] 206 | ymax, xmax = 0, data.shape[1] 207 | else: 208 | xmin, xmax, ymin, ymax = extent 209 | 210 | if ax is None: 211 | fig, ax = plt.subplots() 212 | ax.invert_yaxis() 213 | ax.set(xlim=[xmin, xmax], ylim=[ymin, ymax]) # range should be larger!!! 214 | ny, nx = data.shape 215 | x_loc = np.linspace(xmin, xmax, nx) 216 | for i in range(wiggleInterval//2, nx, wiggleInterval): 217 | x = overlap * (wiggleInterval / 2.0) * (x_loc[1] - x_loc[0]) * data[:, i] 218 | wiggle(x + x_loc[i], origin=x_loc[i], posFill=posFill, negFill=negFill, 219 | lineColor=lineColor, zmin=ymin, zmax=ymax, ax=ax) 220 | -------------------------------------------------------------------------------- /explorationpy/velocity.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | class InputError(Exception): 5 | pass 6 | 7 | 8 | class LengthMismatchError(InputError): 9 | def __init__(self, len_1, len_2): 10 | self.len_1 = len_1 11 | self.len_2 = len_2 12 | 13 | def __str__(self): 14 | return 'Warning: The Length of input arrays are mismatched: ' +\ 15 | str(self.len_1) + ' and '+str(self.len_2) 16 | 17 | 18 | class ZeroLengthError(InputError): 19 | def __init__(self): 20 | pass 21 | 22 | def __str__(self): 23 | return "Warining: One or more input array length are zero!" 24 | 25 | 26 | class NegativeValueError(InputError): 27 | def __init__(self): 28 | pass 29 | 30 | def __str__(self): 31 | return "Warning: Negative values in input array." 32 | 33 | 34 | def rms2int(twt, v_rms): 35 | """Dix Equation""" 36 | try: 37 | if len(twt) != len(v_rms): 38 | raise LengthMismatchError(len(twt), len(v_rms)) 39 | elif len(twt) == 0 or len(v_rms) == 0: 40 | raise ZeroLengthError 41 | elif False: 42 | raise NegativeValueError 43 | else: 44 | v_int = np.zeros(v_rms.shape) 45 | v_int[0] = v_rms[0] 46 | for i in range(1, len(twt)): 47 | v_int[i] = ((v_rms[i]**2 * twt[i] - 48 | v_rms[i-1]**2 * twt[i-1]) / 49 | (twt[i]-twt[i-1]))**0.5 50 | return v_int 51 | except LengthMismatchError, e: 52 | print e.__str__() 53 | return None 54 | except ZeroLengthError, e: 55 | print e.__str__() 56 | return None 57 | 58 | 59 | def int2rms(twt, v_int): 60 | try: 61 | if len(twt) != len(v_int): 62 | raise LengthMismatchError(len(twt), len(v_int)) 63 | elif len(twt) == 0 or len(v_int) == 0: 64 | raise ZeroLengthError 65 | elif False: 66 | raise NegativeValueError 67 | else: 68 | v_rms = np.zeros(v_int.shape) 69 | v_rms[0] = v_int[0] 70 | for i in range(1, len(twt)): 71 | v_rms[i] = ((v_rms[i-1]**2 * twt[i-1] + 72 | v_int[i]**2 * (twt[i] - twt[i-1])) / 73 | twt[i])**0.5 74 | return v_rms 75 | except LengthMismatchError, e: 76 | print e.__str__() 77 | return None 78 | except ZeroLengthError, e: 79 | print e.__str__() 80 | return None 81 | 82 | 83 | def int2ave(twt, v_int): 84 | v_ave = [] 85 | return v_ave 86 | 87 | 88 | if __name__ == '__main__': 89 | twt = np.array([2, 4, 6]) 90 | v_rms = np.array([1500, 1800]) 91 | # twt = np.array([]) 92 | # v_rms = np.array([]) 93 | v_int = rms2int(twt, v_rms) 94 | -------------------------------------------------------------------------------- /explorationpy/zApp.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | from zoeppritz import zoeppritz as zo 4 | 5 | 6 | def zApp(*args, **kwargs): 7 | vp1 = kwargs['vp1'] 8 | vp2 = kwargs['vp2'] 9 | vs1 = kwargs['vs1'] 10 | vs2 = kwargs['vs2'] 11 | rho1 = kwargs['rho1'] 12 | rho2 = kwargs['rho2'] 13 | flag = kwargs['flag'] 14 | angle = np.linspace(0, np.pi/2.0, 30) 15 | p = np.zeros(angle.shape) 16 | for i in range(0, angle.shape[0]): 17 | p[i] = np.sin(angle[i])/vp1 18 | co = np.zeros(angle.shape) 19 | for i in range(0, angle.shape[0]): 20 | co[i] = zo(vp1, vp2, vs1, vs2, rho1, rho2, p[i], flag) 21 | ra = np.linspace(0, 90, 30) 22 | plt.plot(ra, co) 23 | plt.xlim((0, 90)) 24 | plt.ylim((0, 1.0)) 25 | plt.show() 26 | plt.savefig('result') 27 | return co 28 | 29 | if __name__ == '__main__': 30 | # parameter = {'vp1': 1500, 'vp2': 2000, 'vs1': 1500, 31 | # 'vs2': 1600, 'rho1': 2.3, 'rho2': 2.7, 32 | # 'flag': 'r'} 33 | 34 | coefficient = zApp(vp1=1500, vp2=2000, vs1=1500, 35 | vs2=1600, rho1=2.3, rho2=2.7, flag='r') 36 | -------------------------------------------------------------------------------- /explorationpy/zoeppritz.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Wed Dec 17 14:53:12 2014 4 | 5 | @author: yuhao 6 | """ 7 | import numpy as np 8 | 9 | 10 | def zoeppritz(vp1, vp2, vs1, vs2, rho1, rho2, p, flag='r'): 11 | """ 12 | Compute reflection&refraction coefficient of a given ray(ray parameter) 13 | 14 | Parameters 15 | ---------- 16 | vp1 : float 17 | compressional wave velocity in upper layer 18 | vp2 : float 19 | compressional wave velocity in lower layer 20 | vs1 : float 21 | shear wave velocity in upper layer 22 | vs2 : flaot 23 | shear wave velocity in lower layer 24 | rho1 : float 25 | density of upper layer 26 | rho2 : float 27 | density of lower layer 28 | p : float 29 | ray parameter 30 | flag : string 31 | r = reflection, else = refraction 32 | 33 | Returns 34 | ------- 35 | out : float 36 | reflection or refraction coefficient 37 | """ 38 | 39 | # try: 40 | # raise Exception('LargerThanCriticalError') 41 | # except: 42 | # return None 43 | parameter = [] 44 | sin_critical_angle = p * vp2 # check critical angle 45 | if sin_critical_angle >= 1: 46 | parameter = schoenberg_protazaio(vp1, vp2, vs1, vs2, 47 | rho1, rho2, p, flag) 48 | else: 49 | parameter = dahl_ursin(vp1, vp2, vs1, vs2, rho1, rho2, p, flag) 50 | return parameter 51 | 52 | 53 | def dahl_ursin(vp1, vp2, vs1, vs2, rho1, rho2, p, flag): 54 | """ 55 | Calculate the reflection and transmision coefficient 56 | [Dahl and Ursin (1991)] 57 | """ 58 | q = 2 * (rho2 * vs2**2 - rho1 * vs1**2) 59 | X = rho2 - q * p**2 60 | Y = rho1 + q * p**2 61 | Z = rho2 - rho1 - q * p**2 62 | P1 = (1 - vp1**2 * p**2)**0.5 63 | P2 = (1 - vs1**2 * p**2)**0.5 64 | P3 = (1 - vp2**2 * p**2)**0.5 65 | P4 = (1 - vs2**2 * p**2)**0.5 66 | 67 | D = q**2 * p**2 * P1 * P2 * P3 * P4 + \ 68 | rho1 * rho2 * (vs1*vp2 * P1 * P4 + vp1 * vs2 * P2 * P3) + \ 69 | vp1 * vs1 * P3 * P4 * Y**2 + \ 70 | vp2 * vs2 * P1 * P2 * X**2 + \ 71 | vp1 * vp2 * vs1 * vs2 * p**2 * Z**2 72 | 73 | Nr = q**2 * p**2 * P1 * P2 * P3 * P4 + \ 74 | rho1 * rho2 * (vs1*vp2*P1*P4 - vp1*vs2*P2*P3) - \ 75 | vp1 * vs1 * P3 * P4 * Y**2 + \ 76 | vp2 * vs2 * P1 * P2 * X**2 - \ 77 | vp1 * vp2 * vs1 * vs2 * p**2 * Z**2 78 | 79 | Nt = 2 * vp1 * rho1 * P1 * (vs2 * P2 * X + vs1 * P4 * Y) 80 | 81 | rpp = Nr / D 82 | 83 | tpp = Nt / D 84 | if flag == 'r': 85 | return rpp 86 | else: 87 | return tpp 88 | 89 | 90 | def schoenberg_protazaio(vp1, vp2, vs1, vs2, rho1, rho2, p, flag): 91 | """ 92 | Calculate the reflection and transmision coefficient of P- and S-wave 93 | [Schoenberg and Protazio (1992)] 94 | """ 95 | Sp = np.sqrt(vp1**(-2) - p**2) 96 | Ss = np.sqrt(vs1**(-2) - p**2) 97 | K = 1 - 2 * vs1**2 * p**2 98 | x1 = vp1 * p 99 | x2 = vp1 * Ss 100 | x3 = -rho1 * vp1 + 2 * rho1 * vs1**3 101 | x4 = p * Ss 102 | X = np.matrix([[x1, x2], [x3, x4]]) 103 | y1 = -2 * rho1 * vp1 * vs1**2 * p * Sp 104 | y2 = -rho1 * vs1 * K 105 | y3 = vp1 * Sp 106 | y4 = -vs1 * p 107 | Y = np.matrix([[y1, y2], [y3, y4]]) 108 | 109 | p_ = p * vp1 / vp2 110 | Sp_ = np.sqrt(vp2**(-2) - p_**2) 111 | Ss_ = np.sqrt(vs2**(-2) - p_**2) 112 | K_ = 1 - 2 * vs2**2 * p_**2 113 | x1_ = vp2 * p_ 114 | x2_ = vp2 * Ss_ 115 | x3_ = -rho2 * vp2 + 2 * rho2 * vs2**3 116 | x4_ = p_ * Ss_ 117 | X_ = np.matrix([[x1_, x2_], [x3_, x4_]]) 118 | y1_ = -2 * rho2 * vp2 * vs2**2 * p_ * Sp_ 119 | y2_ = -rho2 * vs2 * K_ 120 | y3_ = vp2 * Sp_ 121 | y4_ = -vs2 * p_ 122 | Y_ = np.matrix([[y1_, y2_], [y3_, y4_]]) 123 | T = 2 * Y_.I * (X.I * X_ * Y_.I * Y + K).I 124 | R = (X.I * X_ * Y_.I * Y + K).I * (X.I * X_ * Y_ * Y - K) 125 | if flag == 'r': 126 | return R[0, 0] 127 | else: 128 | return T[0, 0] 129 | -------------------------------------------------------------------------------- /synthetic_marine.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | A random jumble of point scatters in a constant-velocity medium. 4 | 5 | from Imaging the Earth Interior by Claerbout 6 | 7 | Created on Sat Nov 29 21:17:06 2014 8 | """ 9 | import numpy as np 10 | import scipy as sp 11 | from scipy.interpolate import interp1d 12 | import matplotlib.pyplot as plt 13 | import matplotlib.cm as cm 14 | 15 | from explorationpy.marine import wiggle 16 | from explorationpy.vawt import wiggles 17 | from explorationpy.vawt import Wiggles 18 | 19 | __author__ = "yuhao" 20 | 21 | def hyperbola(depth, cdp, trace_interval=25.0): 22 | """ 23 | travel time index given a constant velocity 24 | """ 25 | return np.sqrt(depth**2 + trace_interval*cdp**2) 26 | 27 | 28 | if __name__ == "__main__": 29 | nz = 50 30 | depth = np.zeros(nz) 31 | ny = 60 32 | refl = np.zeros((nz,ny)) 33 | nh = 30 34 | nt = 60 35 | ns = ny 36 | data = np.zeros((nt, nh, ny)) 37 | 38 | for i_z in range(nz): 39 | depth[i_z] = sp.random.uniform(0, 1.0) * nt # reflector depth 40 | layer = 2.0 * sp.random.uniform(0, 1.0) - 1.0 # reflector strength 41 | refl[i_z, :] = (sp.random.uniform(0, 1.0) + 1) * layer # texture on layer 42 | 43 | for i_s in range(ny): # shots 44 | for i_h in range(nh): # down cable h = (g-s)/2 45 | twt = np.zeros((nz,)) 46 | tr_data_z = np.zeros_like(twt) 47 | i_y = (ns - i_s) + (i_h) # y = midpoint 48 | i_y = i_y - ny * (i_y // ny) # periodic with midpoint 49 | for i_z in range(nz): # add hyperbola 50 | i_t = hyperbola(depth[i_z], i_h) 51 | twt[i_z] = i_t 52 | tr_data_z[i_z] = refl[i_z, i_y] 53 | func = interp1d(twt, tr_data_z, fill_value=(0, 0), bounds_error=False) 54 | tr_data_twt = func(np.arange(0, nt)) 55 | data[:, i_h, i_s] += tr_data_twt 56 | 57 | # SH = {'ns':60, 'ntraces':60, 'filename':'abc'} 58 | # k = data[:, :, 40] 59 | # # wiggle(data[:,:,40],SH) 60 | 61 | fig, ax = plt.subplots() 62 | 63 | wiggles(data[:, :, 40], wiggleInterval=1, ax=ax) 64 | # vawt = Wiggles(data[:, :, 40]) 65 | # vawt.wiggleInterval = 1 66 | # vawt.ax = ax 67 | # vawt.wiggles() 68 | plt.show() 69 | -------------------------------------------------------------------------------- /test_fft.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Dec 23 22:11:06 2014 4 | 5 | @author: yuhao 6 | """ 7 | import numpy as np 8 | import matplotlib.pyplot as plt 9 | 10 | Fs = 1000 11 | T = 1.0/Fs 12 | L = 1000 13 | t = np.arange(0,1000*T,T) 14 | -------------------------------------------------------------------------------- /test_marine.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Wed Dec 03 16:53:04 2014 4 | 5 | @author: yuhao 6 | """ 7 | 8 | import numpy as np 9 | #import scipy as sp 10 | import matplotlib.pyplot as plt 11 | import marine as ma 12 | import raytrace 13 | adj = False 14 | add = True 15 | B = np.r_[1:9:9j] 16 | B = B.reshape((3,3)) 17 | x = np.r_[1:1:3j] 18 | nx = 3 19 | y = np.zeros(3) 20 | ny = 3 21 | 22 | ma.mat_mult(adj, add, B, x, nx, y, ny) 23 | 24 | tw = [] 25 | wavelet = [] 26 | dt = 0.01 27 | fdom = 30 28 | tlength = 1.0 29 | re = ma.ricker(dt, fdom, tlength) 30 | tw = re['tw'] 31 | wavelet = re['wavelet'] 32 | 33 | #t = np.arange(0,10,0.01) 34 | ##plt.plot(t, np.sin(2*t)) 35 | ##plt.show() 36 | #x = np.sin(2 * np.pi * 10 * t) 37 | #plt.plot(t, x) 38 | #plt.show() 39 | #spp = np.fft.fft(x) 40 | #freq = np.fft.fftfreq(t.shape[-1], d=0.01) 41 | #plt.figure() 42 | #plt.plot(freq, spp.real)#, freq, spp.imag 43 | #plt.show() 44 | 45 | -------------------------------------------------------------------------------- /test_raytracing.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Fri Dec 12 15:45:54 2014 4 | """ 5 | import numpy as np 6 | import explorationpy.zoeppritz as z 7 | # from explorationpy.raytrace import raytrace 8 | from explorationpy.raytrace_optimize import raytrace 9 | 10 | __author__ = "yuhao" 11 | 12 | if __name__ == "__main__": 13 | vp = [1500, 2000, 2500, 3000, 3500] 14 | #3vp = [1500, 2000] 15 | #vs = [1500, 1600, 2000, 2250] 16 | #rho = [2.3, 2.7, 2.8, 3.0] 17 | thic = [50, 50, 50, 50] 18 | #thic = [50] 19 | offset = [25, 50, 75, 100, 125] 20 | #offset = [50, 100, 150, 200, 250] 21 | #offset = np.arange(1000, 3000, 100) 22 | #zp=[200, 100, 150, 300, 250, 700, 800, 1000, 500] 23 | #vp=[1500, 1600, 2000, 2250, 2700, 2100, 3200, 3750, 4000, 4200] 24 | ppp, ttt = raytrace(vp, thic, offset) 25 | print("Reflection Coefficient:") 26 | print(ppp) 27 | print("Travel time:") 28 | print(ttt) 29 | # Try Zoeppritz 30 | #a = rc.Raytrace() 31 | #a.offset = offset 32 | #a.Vp = vp 33 | #a.thic = thic 34 | #a.raytrace() 35 | #kkk = a.pm 36 | # vp1 = 1500 37 | # vp2 = 2000 38 | # vs1 = 1000 39 | # vs2 = 1300 40 | # rho1 = 1300 41 | # rho2 = 1400 42 | # p = np.sin(np.pi / 6.) / 1500. 43 | # #p = np.sin(np.pi / 18.) / 1500. 44 | # a, b = z.zoeppritz(vp1, vp2, vs1, vs2, rho1, rho2, p) 45 | --------------------------------------------------------------------------------