Skip to content

Commit 7e78012

Browse files
committed
fix cov-gradient in gempy_simple.py
1 parent 7e107bb commit 7e78012

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

gempy_simple.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,32 @@ def cartesian_dist(x_1, x_2):
6969
# In[9]:
7070

7171
def cov_gradients(dist_tiled):
72+
7273
condition1 = 0
73-
a = (h_u * h_v)
74-
b = dist_tiled ** 2
75-
condition2 = (np.divide(a, b, out=np.zeros_like(a), where=b != 0) * (-c_o_T * ((
76-
-14 / a_T ** 2) + 105 / 4 * dist_tiled / a_T ** 3 - 35 / 2 * dist_tiled ** 3 / a_T ** 5 + 21 / 4 * dist_tiled ** 5 / a_T ** 7) +
77-
c_o_T * 7 * (
78-
9 * dist_tiled ** 5 - 20 * a_T ** 2 * dist_tiled ** 3 +
79-
15 * a_T ** 4 * dist_tiled - 4 * a_T ** 5) / (
80-
2 * a_T ** 7) -
81-
perpendicularity_matrix * c_o_T * ((
82-
-14 / a_T ** 2) + 105 / 4 * dist_tiled / a_T ** 3 -
83-
35 / 2 * dist_tiled ** 3 / a_T ** 5 +
84-
21 / 4 * dist_tiled ** 5 / a_T ** 7)) +
85-
1 / 3 * np.eye(dist_tiled.shape[0]))
86-
87-
C_G = np.where(dist_tiled == 0, condition1, condition2) ## adding nugget effect
74+
a = (h_u*h_v)
75+
b = dist_tiled**2
76+
77+
t1 = np.divide(a, b, out=np.zeros_like(a), where=b!=0)
78+
t2 = -c_o_T*((-14/a_T**2)+
79+
105/4*dist_tiled/a_T**3 -
80+
35/2 * dist_tiled**3 / a_T **5 +
81+
21 /4 * dist_tiled**5/a_T**7)+\
82+
c_o_T * 7 * (9 * dist_tiled ** 5 -
83+
20 * a_T ** 2 * dist_tiled ** 3 +
84+
15 * a_T ** 4 * dist_tiled -
85+
4 * a_T ** 5) / (2 * a_T ** 7)
86+
t3 = perpendicularity_matrix * \
87+
c_o_T * ((-14 / a_T ** 2) + 105 / 4 * dist_tiled / a_T ** 3 -
88+
35 / 2 * dist_tiled ** 3 / a_T ** 5 +
89+
21 / 4 * dist_tiled ** 5 / a_T ** 7)
90+
t4 = 1/3*np.eye(dist_tiled.shape[0])
91+
92+
condition2 = t1 * t2 - t3 + t4
93+
94+
C_G = np.where(dist_tiled==0, condition1, condition2) ## adding nugget effect
8895
return C_G
8996

97+
9098
# In[10]:
9199

92100
dist_tiled = dist_tiled + np.eye(dist_tiled.shape[0])
@@ -397,7 +405,7 @@ def plot_interp_with_drift(point_1_y = 2.,
397405
if show_contours:
398406
plt.contour(XX, YY, intp, 20)
399407
if show_field:
400-
plt.pcolor(XX, YY, intp, alpha=0.6, shading='auto')
408+
plt.pcolor(XX, YY, intp, alpha=0.6)
401409

402410
if show_contours or show_field:
403411
try:

0 commit comments

Comments
 (0)