From 68ee8b926a06857dcb02ecd3c1f22b9127547777 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Tue, 9 Jan 2024 22:37:01 +0300 Subject: [PATCH] fix: better handling of nttot in BlendingContinuous --- pylops/waveeqprocessing/blending.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pylops/waveeqprocessing/blending.py b/pylops/waveeqprocessing/blending.py index db69db5e..adca6d93 100644 --- a/pylops/waveeqprocessing/blending.py +++ b/pylops/waveeqprocessing/blending.py @@ -76,7 +76,12 @@ def __init__( self.dt = dt self.times = times self.shiftall = shiftall - self.nttot = int(np.max(self.times) / self.dt + self.nt + 1) + if np.max(self.times) // dt == np.max(self.times) / dt: + # do not add extra sample as no shift will be applied + self.nttot = int(np.max(self.times) / self.dt + self.nt) + else: + # add 1 extra sample at the end + self.nttot = int(np.max(self.times) / self.dt + self.nt + 1) if not self.shiftall: # original implementation, where each source is shifted indipendently self.PadOp = Pad((self.nr, self.nt), ((0, 0), (0, 1)), dtype=self.dtype)