rockphypy 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.1
2
+ Name: rockphypy
3
+ Version: 0.0.1
4
+ Summary: Python rock physics toolbox
5
+ Home-page: UNKNOWN
6
+ Author: Jiaxin Yu
7
+ Author-email: yujiaxin666@outlook.com
8
+ License: GNU GPLv3
9
+ Description: # RockPhyPy
10
+
11
+ This Python 3.8+ package implements most of the rock physics models introduced in the Rock Physics Handbook. The package provides a bunch of usefel classes, i.e. ``Anisotropy``, ``AVO``, ``BW (Batzle&Wang)``, ``EM(Effective medium)``, ``Empirical``, ``Fluid``, ``GM(Granular Medium)``, ``Permeability`` and ``utils``. An exhaust list of methods in different classes are given in the [API Documentation](https://rockphypy.readthedocs.io/en/latest/autoapi/index.html).
12
+
13
+ ## Installation
14
+
15
+ rockphypy is available through [PyPI] and may be installed using `pip`:
16
+
17
+ ```text
18
+ pip install rockphypy
19
+ ```
20
+
21
+
22
+ ## Example code and documentation
23
+
24
+ Below is an simple example showing the comparison between critical porosity model and elastic bounds computed by Hashin-Strikmann bounds. See the [documentation](https://rockphypy.readthedocs.io/en/latest/) for more examples.
25
+
26
+ ```python
27
+ from rockphypy import EM
28
+ from rockphypy import Fluid
29
+
30
+ # specify model parameters
31
+ phi=np.linspace(0,1,100,endpoint=True) # solid volume fraction = 1-phi
32
+ K0, G0= 37,44 # moduli of grain material
33
+ Kw, Gw= 2.2,0 # moduli of water
34
+ # VRH bounds
35
+ volumes= np.vstack((1-phi,phi)).T
36
+ M= np.array([K0,Kw])
37
+ K_v,K_r,K_h=EM.VRH(volumes,M)
38
+ # Hashin-Strikmann bound
39
+ K_UHS,G_UHS= EM.HS(1-phi, K0, Kw,G0,Gw, bound='upper')
40
+ # Critical porosity model
41
+ phic=0.4 # Critical porosity
42
+ phi_=np.linspace(0.001,phic,100,endpoint=True) # solid volume fraction = 1-phi
43
+ K_dry, G_dry= EM.cripor(K0, G0, phi_, phic)# Compute dry-rock moduli
44
+ Ksat, Gsat = Fluid.Gassmann(K_dry,G_dry,K0,Kw,phi_)# saturate rock with water
45
+
46
+ # plot
47
+ plt.figure(figsize=(6,6))
48
+ plt.xlabel('Porosity')
49
+ plt.ylabel('Bulk modulus [GPa]')
50
+ plt.title('V, R, VRH, HS bounds')
51
+ plt.plot(phi, K_v,label='K Voigt')
52
+ plt.plot(phi, K_r,label='K Reuss = K HS-')
53
+ plt.plot(phi, K_h,label='K VRH')
54
+ plt.plot(phi, K_UHS,label='K HS+')
55
+ plt.plot(phi_, Ksat,label='K CriPor')
56
+ plt.legend(loc='best')
57
+ plt.grid(ls='--')
58
+ ```
59
+
60
+ ## Issues and contributing
61
+
62
+ ### Issues
63
+
64
+ If you are having trouble using the package, please let me know by creating an [Issue on GitHub] and I'll get back to you.
65
+
66
+ ### Contributing
67
+
68
+ Whatever your mathematical and Python background is, you are very welcome to contribute to rockphypy.
69
+ To contribute, fork the project, create a branch and submit and Pull Request.
70
+ Please follow these guidelines:
71
+
72
+ - Import as few external dependencies as possible.
73
+ - Use test driven development, have tests and docs for every method.
74
+ - Cite literature and implement recent methods.
75
+ - Unless it's a bottleneck computation, readability trumps speed.
76
+ - Employ object orientation, but resist the temptation to implement many methods -- stick to the basics.
77
+ - Follow PEP8.
78
+
79
+
80
+ Platform: UNKNOWN
81
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
82
+ Classifier: Programming Language :: Python
83
+ Classifier: Programming Language :: Python :: 3
84
+ Classifier: Programming Language :: Python :: 3.6
85
+ Classifier: Programming Language :: Python :: 3.7
86
+ Classifier: Programming Language :: Python :: 3.8
87
+ Classifier: Programming Language :: Python :: 3.9
88
+ Classifier: Programming Language :: Python :: 3.10
89
+ Classifier: Programming Language :: Python :: 3.11
90
+ Description-Content-Type: text/markdown
@@ -0,0 +1,70 @@
1
+ # RockPhyPy
2
+
3
+ This Python 3.8+ package implements most of the rock physics models introduced in the Rock Physics Handbook. The package provides a bunch of usefel classes, i.e. ``Anisotropy``, ``AVO``, ``BW (Batzle&Wang)``, ``EM(Effective medium)``, ``Empirical``, ``Fluid``, ``GM(Granular Medium)``, ``Permeability`` and ``utils``. An exhaust list of methods in different classes are given in the [API Documentation](https://rockphypy.readthedocs.io/en/latest/autoapi/index.html).
4
+
5
+ ## Installation
6
+
7
+ rockphypy is available through [PyPI] and may be installed using `pip`:
8
+
9
+ ```text
10
+ pip install rockphypy
11
+ ```
12
+
13
+
14
+ ## Example code and documentation
15
+
16
+ Below is an simple example showing the comparison between critical porosity model and elastic bounds computed by Hashin-Strikmann bounds. See the [documentation](https://rockphypy.readthedocs.io/en/latest/) for more examples.
17
+
18
+ ```python
19
+ from rockphypy import EM
20
+ from rockphypy import Fluid
21
+
22
+ # specify model parameters
23
+ phi=np.linspace(0,1,100,endpoint=True) # solid volume fraction = 1-phi
24
+ K0, G0= 37,44 # moduli of grain material
25
+ Kw, Gw= 2.2,0 # moduli of water
26
+ # VRH bounds
27
+ volumes= np.vstack((1-phi,phi)).T
28
+ M= np.array([K0,Kw])
29
+ K_v,K_r,K_h=EM.VRH(volumes,M)
30
+ # Hashin-Strikmann bound
31
+ K_UHS,G_UHS= EM.HS(1-phi, K0, Kw,G0,Gw, bound='upper')
32
+ # Critical porosity model
33
+ phic=0.4 # Critical porosity
34
+ phi_=np.linspace(0.001,phic,100,endpoint=True) # solid volume fraction = 1-phi
35
+ K_dry, G_dry= EM.cripor(K0, G0, phi_, phic)# Compute dry-rock moduli
36
+ Ksat, Gsat = Fluid.Gassmann(K_dry,G_dry,K0,Kw,phi_)# saturate rock with water
37
+
38
+ # plot
39
+ plt.figure(figsize=(6,6))
40
+ plt.xlabel('Porosity')
41
+ plt.ylabel('Bulk modulus [GPa]')
42
+ plt.title('V, R, VRH, HS bounds')
43
+ plt.plot(phi, K_v,label='K Voigt')
44
+ plt.plot(phi, K_r,label='K Reuss = K HS-')
45
+ plt.plot(phi, K_h,label='K VRH')
46
+ plt.plot(phi, K_UHS,label='K HS+')
47
+ plt.plot(phi_, Ksat,label='K CriPor')
48
+ plt.legend(loc='best')
49
+ plt.grid(ls='--')
50
+ ```
51
+
52
+ ## Issues and contributing
53
+
54
+ ### Issues
55
+
56
+ If you are having trouble using the package, please let me know by creating an [Issue on GitHub] and I'll get back to you.
57
+
58
+ ### Contributing
59
+
60
+ Whatever your mathematical and Python background is, you are very welcome to contribute to rockphypy.
61
+ To contribute, fork the project, create a branch and submit and Pull Request.
62
+ Please follow these guidelines:
63
+
64
+ - Import as few external dependencies as possible.
65
+ - Use test driven development, have tests and docs for every method.
66
+ - Cite literature and implement recent methods.
67
+ - Unless it's a bottleneck computation, readability trumps speed.
68
+ - Employ object orientation, but resist the temptation to implement many methods -- stick to the basics.
69
+ - Follow PEP8.
70
+
@@ -0,0 +1,419 @@
1
+ #!/usr/bin/env python
2
+ # -*-coding:utf-8 -*-
3
+
4
+ import numpy as np
5
+
6
+ class AVO:
7
+ """Exact and approximations of reflectivity in isotropic and anisotropic media.
8
+ """
9
+ @staticmethod
10
+ def AVO_HTI(D1,D2,C1,C2,theta,azimuth):
11
+ """Compute azimuth dependent PP reflectivity for wealy anisotropic HTI media using Ruger's approximation
12
+
13
+ Parameters
14
+ ----------
15
+ D1 : float or array-like
16
+ density of the upper medium g/cm3
17
+ D2 : float or array-like
18
+ density of the lower medium g/cm3
19
+ C1 : 2D array
20
+ stiffness matrix of the upper medium
21
+ C2 : 2D array
22
+ stiffness matrix of the lower medium
23
+ theta : array-like
24
+ incident angle, in degree unit
25
+ azimuth : array-like
26
+ azimuth angle, in degree unit
27
+
28
+ Returns
29
+ -------
30
+ float or array-like
31
+ PP reflectivities
32
+ """
33
+
34
+ theta = np.radians(theta)
35
+ azimuth = np.radians(azimuth)
36
+
37
+ # full azimuth
38
+ theta, azimuth=np.meshgrid(theta,azimuth)
39
+ C11_1=C1[0,0]
40
+ C13_1=C1[0,2]
41
+ C33_1=C1[2,2]
42
+ C44_1=C1[3,3]
43
+ C55_1=C1[4,4]
44
+ C66_1=C1[5,5]
45
+
46
+ C11_2=C2[0,0]
47
+ C13_2=C2[0,2]
48
+ C33_2=C2[2,2]
49
+ C44_2=C2[3,3]
50
+ C55_2=C2[4,4]
51
+ C66_2=C2[5,5]
52
+
53
+ alpha_1= np.sqrt(C33_1/D1)
54
+ beta_1=np.sqrt(C44_1/D1)
55
+ beta_v_1=np.sqrt(C55_1/D1)
56
+ gamma_1= (C44_1-C66_1)/(2*C66_1)
57
+ gamma_v_1= (C66_1-C44_1)/(2*C44_1)
58
+ epsilon_v_1= (C11_1-C33_1)/(2*C33_1)
59
+ delta_v_1= ((C13_1+C55_1)**2-(C33_1-C55_1)**2)/(2*C33_1*(C33_1-C55_1))
60
+
61
+ Z_1=D1*alpha_1
62
+ mu_1=D1*beta_1**2
63
+ mu_v_1=D1*beta_v_1**2
64
+
65
+ alpha_2= np.sqrt(C33_2/D2)
66
+ beta_2=np.sqrt(C44_2 /D2 )
67
+ beta_v_2=np.sqrt(C55_2 /D2 )
68
+ gamma_2= (C44_2 -C66_2 )/(2*C66_2)
69
+ gamma_v_2= (C66_2 -C44_2)/(2*C44_2)
70
+ epsilon_v_2= (C11_2 -C33_2 )/(2*C33_2 )
71
+ delta_v_2= ((C13_2 +C55_2 )**2-(C33_2-C55_2 )**2)/(2*C33_2 *(C33_2 -C55_2 ))
72
+
73
+ Z_2=D2*alpha_2
74
+ mu_2=D2*beta_2**2
75
+ mu_v_2=D2*beta_v_2**2
76
+
77
+ dZ=Z_2-Z_1
78
+ Z_=(Z_1+Z_2)/2
79
+ dalpha=alpha_2-alpha_1
80
+ alpha_=(alpha_1+alpha_2)/2
81
+ beta_=(beta_1+beta_2)/2
82
+ dmu=mu_2-mu_1
83
+ mu_=(mu_1+mu_2)/2
84
+ ddelta=delta_v_2-delta_v_1
85
+ dgamma=gamma_2-gamma_1
86
+ depsilon=epsilon_v_2-epsilon_v_1
87
+
88
+ # beta_v_= (beta_v_1+beta_v_2)/2
89
+ # dmu_v=mu_v_2-mu_v_1
90
+ # mu_v_=(mu_v_1+mu_v_2)/2
91
+
92
+ # full azimuth Rüger (1996)
93
+ Rpp= 0.5*dZ/Z_+0.5*( dalpha/alpha_-(2*beta_/alpha_)**2* dmu/mu_+ (ddelta+2*(2*beta_/alpha_)**2 *dgamma)*np.cos(azimuth)**2)*np.sin(theta)**2 + 0.5*(dalpha/alpha_+depsilon* np.cos(azimuth)**4+ddelta*np.sin(azimuth)**2*np.cos(azimuth)**2)*np.sin(theta)**2*np.tan(theta)**2
94
+
95
+ return Rpp
96
+
97
+ @staticmethod
98
+ def Aki_Richard(theta, vp1,vp2,vs1,vs2,den1,den2):
99
+ """Aki-Richard approximation to PP reflectivity.
100
+
101
+ Parameters
102
+ ----------
103
+ theta : float or array-like
104
+ incident angle, degree
105
+ vp1 : float
106
+ P wave velocity of layer 1, m/s
107
+ vp2 : float
108
+ P wave velocity of layer 2, m/s
109
+ vs1 : float
110
+ S wave velocity of layer 1, m/s
111
+ vs2 : float
112
+ S wave velocity of layer 2, m/s
113
+ den1 : float
114
+ density of layer 1, kg/m3
115
+ den2 : float
116
+ density of layer 2, kg/m3
117
+
118
+ Returns
119
+ -------
120
+ float or array-like
121
+ R_pp: P wave reflectivity
122
+ R_ps: PS reflectivity
123
+ Rpp0: intercept
124
+ gradient
125
+ """
126
+ # vectorize
127
+ if isinstance(vp1, np.ndarray):
128
+ vp1=vp1[:, np.newaxis]
129
+ vp2=vp2[:, np.newaxis]
130
+ vs1=vs1[:, np.newaxis]
131
+ vs2=vs2[:, np.newaxis]
132
+ den1=den1[:, np.newaxis]
133
+ den2=den2[:, np.newaxis]
134
+
135
+ theta=np.deg2rad(theta) # convert angle in degree to angle in radian
136
+ delta_den=den2-den1
137
+ delta_vp=vp2-vp1
138
+ delta_vs=vs2-vs1
139
+ rho_mean=0.5*(den1+den2)
140
+ vp_mean=0.5*(vp1+vp2)
141
+ vs_mean=0.5*(vs1+vs2)
142
+
143
+ Rpp0=0.5*(delta_den/rho_mean+delta_vp/vp_mean)# intercept
144
+ M= -2*(vs_mean/vp_mean)**2*(2*delta_vs/vs_mean+delta_den/rho_mean)
145
+ N= 0.5* delta_vp/vp_mean
146
+
147
+ R_pp= Rpp0+ M *np.sin(theta)**2+ N * np.tan(theta)**2
148
+ gradient= M+N
149
+ p=np.sin(theta)/vp1 # ray parameter
150
+
151
+ cos_theta_s=np.sqrt(1-(np.sin(theta)**2.*(vs1**2/vp1**2)))
152
+
153
+ R_ps=-0.5*p*vp_mean/cos_theta_s*((1-2*vs_mean**2*p**2+2*vs_mean**2*np.cos(theta)/vp_mean*cos_theta_s/vs_mean)*delta_den/rho_mean-(4*p**2*vs_mean**2-4*vs_mean**2*np.cos(theta)/vp_mean*cos_theta_s/vs_mean)*delta_vs/vs_mean)
154
+ return R_pp,R_ps, Rpp0, gradient
155
+
156
+ @staticmethod
157
+ def zoeppritz(vp1, vs1, rho1, vp2, vs2, rho2, theta):
158
+ """Reflection & Transmission coefficients calculated using full Zoeppritz equations.
159
+
160
+ Parameters
161
+ ----------
162
+ vp1 : float
163
+ P wave velocity of layer 1, m/s
164
+ vs1 : float
165
+ S wave velocity of layer 1, m/s
166
+ rho1 : float
167
+ density of layer 1, kg/m3
168
+ vp2 : float
169
+ P wave velocity of layer 2, m/s
170
+ vs2 : float
171
+ S wave velocity of layer 2, m/s
172
+ rho2 : float
173
+ density of layer 2, kg/m3
174
+ theta : float or array-like
175
+ incident angle, degree
176
+
177
+ Returns
178
+ -------
179
+ float or array-like
180
+ Rpp,Rps: PP and PS reflectivity
181
+ """
182
+
183
+ theta1 = np.deg2rad(theta)
184
+ p = np.sin(theta)/vp1 # Ray parameter
185
+ # Transmission angle of P-wave
186
+ theta2 =np.arcsin(p*vp2)
187
+ phi1 = np.arcsin(p*vs1)# Reflection angle of converted S-wave
188
+ phi2 = np.arcsin(p*vs2)# Transmission angle of converted S-wave
189
+
190
+ a=rho2*(1-2*np.sin(phi2)**2)-rho1*(1-2*np.sin(phi1)**2)
191
+ b=rho2*(1-2*np.sin(phi2)**2)+2*rho1*np.sin(phi1)**2
192
+ c=rho1*(1-2*np.sin(phi1)**2)+2*rho2*np.sin(phi2)**2
193
+ d=2*(rho2*vs2**2-rho1*vs1**2)
194
+ H=a-d*np.cos(theta2)/vp2*np.cos(phi2)/vs2
195
+ E=b*np.cos(theta1)/vp1+c*np.cos(theta2)/vp2
196
+ F=b*np.cos(phi1)/vs1+c*np.cos(phi2)/vs2
197
+ G=a-d*np.cos(theta1)/vp1*np.cos(phi2)/vs2
198
+ D=E*F+G*H*p**2
199
+ Rpp=( ( b*np.cos(theta1)/vp1-c*np.cos(theta2)/vp2)*F-( a+d*np.cos(theta1)/vp1*np.cos(phi2)/vs2)*H*p**2)/D
200
+
201
+ Rps= (-2*np.cos(theta1)/vp1*(a*b+c*d*np.cos(theta2)/vp2*np.cos(phi2)/vs2)*p*vp1)/(vs1*D)
202
+
203
+ # M = np.array([
204
+ # [-np.sin(theta1), -np.cos(phi1), np.sin(theta2), np.cos(phi2)],
205
+ # [np.cos(theta1), -np.sin(phi1), np.cos(theta2), -np.sin(phi2)],
206
+ # [2*rho1*vs1*np.sin(phi1)*np.cos(theta1), rho1*vs1*(1-2*np.sin(phi1)**2),
207
+ # 2*rho2*vs2*np.sin(phi2)*np.cos(theta2), rho2*vs2*(1-2*np.sin(phi2)**2)],
208
+ # [-rho1*vp1*(1-2*np.sin(phi1)**2), rho1*vs1*np.sin(2*phi1),
209
+ # rho2*vp2*(1-2*np.sin(phi2)**2), -rho2*vs2*np.sin(2*phi2)]
210
+ # ])
211
+
212
+ # N = np.array([
213
+ # [np.sin(theta1), np.cos(phi1), -np.sin(theta2), -np.cos(phi2)],
214
+ # [np.cos(theta1), -np.sin(phi1), np.cos(theta2), -np.sin(phi2)],
215
+ # [2*rho1*vs1*np.sin(phi1)*np.cos(theta1), rho1*vs1*(1-2*np.sin(phi1)**2),
216
+ # 2*rho2*vs2*np.sin(phi2)*np.cos(theta2), rho2*vs2*(1-2*np.sin(phi2)**2)],
217
+ # [rho1*vp1*(1-2*np.sin(phi1)**2), -rho1*vs1*np.sin(2*phi1),
218
+ # -rho2*vp2*(1-2*np.sin(phi2)**2), rho2*vs2*np.sin(2*phi2)]
219
+ # ])
220
+ return Rpp, Rps
221
+
222
+ @staticmethod
223
+ def AVO_abe(vp1,vs1,d1,vp2,vs2,d2):
224
+ """Different approximations AVO terms
225
+
226
+ Parameters
227
+ ----------
228
+ vp1 : float or array-like
229
+ P wave velocity of layer 1, m/s
230
+ vs1 : float or array-like
231
+ S wave velocity of layer 1, m/s
232
+ d1 : float or array-like
233
+ density of layer 1, kg/m3
234
+ vp2 : float or array-like
235
+ P wave velocity of layer 2, m/s
236
+ vs2 : float or array-like
237
+ S wave velocity of layer 2, m/s
238
+ d2 : float or array-like
239
+ density of layer 2, kg/m3
240
+
241
+ Returns
242
+ -------
243
+ float or array-like
244
+ different linear AVO approximations
245
+ """
246
+
247
+ da=(d1+d2)/2
248
+ Dd=(d2-d1)
249
+ vpa=(vp1+vp2)/2
250
+ Dvp=(vp2-vp1)
251
+ vsa=(vs1+vs2)/2
252
+ Dvs=(vs2-vs1)
253
+ Ro=0.5*((Dvp/vpa)+(Dd/da))
254
+ A=Ro
255
+
256
+ # case 1 Shuey's paper (2terms->B Castag)
257
+ poi1=((0.5*(vp1/vs1)**2)-1)/((vp1/vs1)**2-1)
258
+ poi2=((0.5*(vp2/vs2)**2)-1)/((vp2/vs2)**2-1)
259
+ poia=(poi1+poi2)/2
260
+ Dpoi=(poi2-poi1)
261
+ Bx=(Dvp/vpa)/((Dvp/vpa)+(Dd/da))
262
+ Ax=Bx-(2*(1+Bx)*(1-2*poia)/(1-poia))
263
+ B1=(Ax*Ro)+(Dpoi/(1-poia)**2)
264
+ # case 2 Castagna's paper->Shuey
265
+ B2=(-2*vsa**2*Dd/(vpa**2*da)) + (0.5*Dvp/vpa)-(4*vsa*Dvs/(vpa**2))
266
+
267
+ # E1 Gonzalez approx.
268
+ E1=(-0.5*Dd/da)-((vsa/vpa)*((Dd/da)+(2*Dvs/vsa))) + (((vsa/vpa)**3)*((0.5*Dd/da)+(Dvs/vsa)))
269
+
270
+ # E2 Alejandro & Reinaldo
271
+ E2=-2*(vs1/vp1)*((Dd/da*(0.5+(0.25*vpa/vsa)))+ (Dvs/vsa))
272
+
273
+ return A,B1,B2,E1,E2
274
+
275
+ @staticmethod
276
+ def EI_ref(Vp,Vs,rho,theta,SP,norm=True):
277
+ """Compute elastic impedance of an isotropic, flat-layered Earth
278
+
279
+ Parameters
280
+ ----------
281
+ vp1 : float or array-like
282
+ P wave velocity of layer 1, m/s
283
+ vs1 : float or array-like
284
+ S wave velocity of layer 1, m/s
285
+ d1 : float or array-like
286
+ density of layer 1, kg/m3
287
+
288
+ Vp : float or array-like
289
+ P wave velocity
290
+ Vs : float or array-like
291
+ S wave velocity
292
+ rho : float or array-like
293
+ density
294
+ theta : array-like
295
+ incident angles
296
+ SP : float
297
+ constant ratio of Vs to Vp, can be taken as the average of input Vs/Vp, i.e. SP= VS.mean()/VP.mean()
298
+ norm : bool, optional
299
+ If True: normalized input velocities and density such that the units and dimension match with acoustic impedance. Defaults to True.
300
+
301
+ Returns
302
+ -------
303
+ float or array-like
304
+ EI_pp: elastic impedance for PP reflection
305
+ EI_svp: elastic impedance for P-SV reflection
306
+ EI_psv: elastic impedance for SV-P reflection
307
+ EI_svsv: elastic impedance for SV-SV reflection
308
+ EI_shsh: elastic impedance for SH-SH reflection
309
+ """
310
+ if isinstance(Vp, np.ndarray):
311
+ Vp=Vp[:, np.newaxis]
312
+ Vs=Vs[:, np.newaxis]
313
+ rho= rho[:, np.newaxis]
314
+
315
+ theta = np.deg2rad(theta)
316
+ p=np.sin(theta)/Vp # ray parameter
317
+ theta_s = np.arcsin(p*Vs)
318
+ ipn=1
319
+ isn=1
320
+ # normalize
321
+ if norm==True:
322
+ ipn= np.mean(Vp)*np.mean(rho)
323
+ isn= np.mean(Vs)*np.mean(rho)
324
+ Vp=Vp/np.mean(Vp)
325
+ Vs=Vs/np.mean(Vs)
326
+ rho=rho/np.mean(rho)
327
+
328
+ # PP
329
+ A = 1+np.tan(theta)**2
330
+ B = -8*SP**2*np.sin(theta)**2
331
+ C = 1-4*SP**2*np.sin(theta)**2
332
+ EI_pp= ipn*Vp**A*Vs**B*rho**C
333
+ # P SV
334
+ B = np.sin(theta)/np.sqrt(1-SP**2*np.sin(theta)**2)*(4*np.sin(theta)**2*SP**2-4*SP*np.cos(theta)*np.sqrt(1-SP**2*np.sin(theta)**2))
335
+ C = -np.sin(theta)/np.sqrt(1-SP**2*np.sin(theta)**2)*(1-2*np.sin(theta)**2*SP**2+2*SP*np.cos(theta)*np.sqrt(1-SP**2*np.sin(theta)**2))
336
+ EI_psv= ipn*Vs**B*rho**C
337
+ # SV P
338
+ B = np.sin(theta_s)/np.sqrt(1-1/SP**2*np.sin(theta_s)**2)*(4*np.sin(theta_s)**2-4*SP*np.cos(theta_s)*np.sqrt(1-1/SP**2*np.sin(theta_s)**2))
339
+ C = -np.sin(theta_s)/np.sqrt(1-1/SP**2*np.sin(theta_s)**2)*(1-2*np.sin(theta_s)**2+2*SP*np.cos(theta_s)*np.sqrt(1-1/SP**2*np.sin(theta_s)**2))
340
+ EI_svp= isn*Vs**B*rho**C
341
+ # SV-SV
342
+ B = -1/np.cos(theta_s)**2+8*np.sin(theta_s)**2
343
+ C = -1+4*np.sin(theta_s)**2
344
+ EI_svsv= isn*Vs**B*rho**C
345
+ # SH-SH
346
+ B = -1+np.tan(theta_s)**2
347
+ C = -1
348
+ EI_shsh= isn*Vs**B*rho**C
349
+ return EI_pp,EI_psv,EI_svp,EI_svsv,EI_shsh
350
+
351
+ @staticmethod
352
+ def AVO_ortho(a1,b1,e11,d11,e12,d12,g1,rho1,a2,b2,e21,d21,e22,d22,g2,rho2,the):
353
+ """calculates the reflectivity in the symmetry plane for interfaces between 2 orthorhombic media, refactered from srb toolbox written by Diana Sava.
354
+ Parameters
355
+ ----------
356
+ a1 : float or array-like
357
+ P-wave vertical velocities of upper medium (1)
358
+ b1 : float or array-like
359
+ S-wave vertical velocities of upper medium (1)
360
+ e11 : float or array-like
361
+ epsilon in the two symmetry planes of the orthorhombic medium for the upper medium (first index indicates the upper medium (1), second index indicates the plane of symmetry (1 - plane perpendicular to x, 2 - plane perpendicular to y);
362
+ d11 : float or array-like
363
+ delta in the two symmetry planes of the orthorhombic medium for the upper medium
364
+ e12 : float or array-like
365
+ epsilon in the two symmetry planes of the orthorhombic medium for the upper medium
366
+ d12 : float or array-like
367
+ delta in the two symmetry planes of the orthorhombic medium for the upper medium
368
+ g1 : float or array-like
369
+ vertical shear wave splitting parameter for the upper medium (1)
370
+ rho1 : float or array-like
371
+ density of the upper medium
372
+ a2 : float or array-like
373
+ P-wave vertical velocities of lower medium (2)
374
+ b2 : float or array-like
375
+ S-wave vertical velocities of lower medium (2)
376
+ e21 : float or array-like
377
+ epsilon in the two symmetry planes of the orthorhombic medium for the lower medium
378
+ d21 : float or array-like
379
+ delta in the two symmetry planes of the orthorhombic medium for the lower medium
380
+ e22 : float or array-like
381
+ epsilon in the two symmetry planes of the orthorhombic medium for the lower medium
382
+ d22 : float or array-like
383
+ delta in the two symmetry planes of the orthorhombic medium for the lower medium
384
+ g2 : float or array-like
385
+ vertical shear wave splitting parameter for the upper medium (2)
386
+ rho2 : float or array-like
387
+ density of the lower medium
388
+ the : float or array-like
389
+ incident angle
390
+
391
+ Returns
392
+ -------
393
+ array-like
394
+ Rxy: PP reflectivity as a function of angle of incidence in xz plane (13).
395
+ Ryz: PP reflectivity as a function of angle of incidence in yz plane (23)
396
+ """
397
+
398
+ Z1=rho1*a1
399
+ Z2=rho2*a2
400
+ G1=rho1*b1*b1
401
+ G2=rho2*b2*b2
402
+ G=(G1+G2)/2
403
+ dG=G2-G1
404
+
405
+ a=(a1+a2)/2
406
+ da=a2-a1
407
+ b=(b1+b2)/2
408
+ db=b2-b1
409
+
410
+ the=the*np.pi/180
411
+
412
+ sthe2=np.sin(the)**2
413
+ tthe2=np.tan(the)**2
414
+
415
+ f=(2*b/a)**2
416
+ Rxz=(Z2-Z1)/(Z2+Z1)+0.5*(da/a-f*(dG/G-2*(g2-g1))+d22-d12)*sthe2+.5*(da/a+e22-e12)*sthe2*tthe2
417
+ Ryz=(Z2-Z1)/(Z2+Z1)+0.5*(da/a-f*dG/G+d21-d11)*sthe2+.5*(da/a+e21-e11)*sthe2*tthe2
418
+
419
+ return Rxz, Ryz