Skip to content

Commit 54bef33

Browse files
authored
Merge pull request #563 from mrava87/patch-debl
fix: better handling of nttot in BlendingContinuous
2 parents 64556cd + 68ee8b9 commit 54bef33

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pylops/waveeqprocessing/blending.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ def __init__(
7676
self.dt = dt
7777
self.times = times
7878
self.shiftall = shiftall
79-
self.nttot = int(np.max(self.times) / self.dt + self.nt + 1)
79+
if np.max(self.times) // dt == np.max(self.times) / dt:
80+
# do not add extra sample as no shift will be applied
81+
self.nttot = int(np.max(self.times) / self.dt + self.nt)
82+
else:
83+
# add 1 extra sample at the end
84+
self.nttot = int(np.max(self.times) / self.dt + self.nt + 1)
8085
if not self.shiftall:
8186
# original implementation, where each source is shifted indipendently
8287
self.PadOp = Pad((self.nr, self.nt), ((0, 0), (0, 1)), dtype=self.dtype)

0 commit comments

Comments
 (0)