Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure dtcwt is not used in typing annotations #571

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading