Skip to content

Commit

Permalink
fix: ensure dtcwt is not used in typing annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
mrava87 committed Mar 4, 2024
1 parent 0d19f56 commit 5451f4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pylops/signalprocessing/dtcwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ def _nd_to_2d(self, arr_nd):
arr_2d = arr_nd.reshape(self.dims[self.axis], -1).squeeze()
return arr_2d

def _coeff_to_array(self, pyr: dtcwt.Pyramid) -> NDArray:
def _coeff_to_array(self, pyr): # cannot use dtcwt types as it may not be installed
highpass_coeffs = np.vstack([h for h in pyr.highpasses])
coeffs = np.concatenate((highpass_coeffs, pyr.lowpass), axis=0)
return coeffs

def _array_to_coeff(self, X: NDArray) -> dtcwt.Pyramid:
def _array_to_coeff(self, X): # cannot use dtcwt types as it may not be installed
lowpass = (X[-self.lowpass_size :].real).reshape((-1, self.otherdims))
_ptr = 0
highpasses = ()
Expand All @@ -154,7 +154,7 @@ def _array_to_coeff(self, X: NDArray) -> dtcwt.Pyramid:
highpasses += (_h,)
return dtcwt.Pyramid(lowpass, highpasses)

def get_pyramid(self, x: NDArray) -> dtcwt.Pyramid:
def get_pyramid(self, x): # cannot use dtcwt types as it may not be installed
"""Return Pyramid object from flat real-valued array"""
return self._array_to_coeff(x[0] + 1j * x[1])

Expand Down

0 comments on commit 5451f4d

Please sign in to comment.