Skip to content

Commit d66b3dc

Browse files
committed
Fix bug with definition of loop and normalization factor
1 parent 6b37890 commit d66b3dc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/advection_correction.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def advection_correction(R, T=5, t=1):
101101
x, y = np.meshgrid(
102102
np.arange(R[0].shape[1], dtype=float), np.arange(R[0].shape[0], dtype=float),
103103
)
104-
for i in range(1, 1 + int(T / t)):
104+
for i in range(t, T + t, t):
105105

106106
pos1 = (y - i / T * V[1], x - i / T * V[0])
107107
R1 = map_coordinates(R[0], pos1, order=1)
@@ -111,7 +111,7 @@ def advection_correction(R, T=5, t=1):
111111

112112
Rd += (T - i) * R1 + i * R2
113113

114-
return 1 / T ** 2 * Rd
114+
return t / T ** 2 * Rd
115115

116116

117117
###############################################################################
@@ -120,7 +120,7 @@ def advection_correction(R, T=5, t=1):
120120

121121
R_ac = R[0].copy()
122122
for i in range(R.shape[0] - 1):
123-
R_ac += advection_correction(R[i : (i + 2)], T=10)
123+
R_ac += advection_correction(R[i : (i + 2)], T=10, t=1)
124124
R_ac /= R.shape[0]
125125

126126
###############################################################################

0 commit comments

Comments
 (0)