From f130a967d3a3dbd1a0a1417548199cb1271ef085 Mon Sep 17 00:00:00 2001 From: mrava87 Date: Wed, 29 Nov 2023 14:12:34 +0300 Subject: [PATCH] fix: force dtype for shift operator inputs --- pylops/signalprocessing/shift.py | 4 ++-- pylops/waveeqprocessing/blending.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pylops/signalprocessing/shift.py b/pylops/signalprocessing/shift.py index 43a9a500..b7d17ed7 100644 --- a/pylops/signalprocessing/shift.py +++ b/pylops/signalprocessing/shift.py @@ -109,7 +109,7 @@ def Shift( shift = _value_or_sized_to_array(shift) if shift.size == 1: - shift = np.exp(-1j * 2 * np.pi * Fop.f * shift) + shift = np.exp(-1j * 2 * np.pi * Fop.f * shift).astype(Fop.cdtype) Sop = Diagonal(shift, dims=dimsdiag, axis=axis, dtype=Fop.cdtype) else: # add dimensions to shift to match dimensions of model and data @@ -120,7 +120,7 @@ def Shift( sdims = np.ones(shift.ndim + 1, dtype=int) sdims[:axis] = shift.shape[:axis] sdims[axis + 1 :] = shift.shape[axis:] - shift = np.exp(-1j * 2 * np.pi * f * shift.reshape(sdims)) + shift = np.exp(-1j * 2 * np.pi * f * shift.reshape(sdims)).astype(Fop.cdtype) Sop = Diagonal(shift, dtype=Fop.cdtype) Op = Fop.H * Sop * Fop Op.dims = Op.dimsd = Fop.dims diff --git a/pylops/waveeqprocessing/blending.py b/pylops/waveeqprocessing/blending.py index 828c8ef5..db69db5e 100644 --- a/pylops/waveeqprocessing/blending.py +++ b/pylops/waveeqprocessing/blending.py @@ -111,7 +111,7 @@ def __init__( # Define shift operator self.shifts = (times // self.dt).astype(np.int32) diff = (times / self.dt - self.shifts) * self.dt - diff = np.repeat(diff[:, np.newaxis], self.nr, axis=1) + diff = np.repeat(diff[:, np.newaxis], self.nr, axis=1).astype(self.dtype) self.ShiftOp = Shift( (self.ns, self.nr, self.nt + 1), diff,