Skip to content

Commit

Permalink
docs: typehints for fftfilters
Browse files Browse the repository at this point in the history
  • Loading branch information
Eoghan O'Connell committed Feb 10, 2025
1 parent e1cf228 commit bd671d7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions qpretrieve/fourier/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# flake8: noqa: F401
import warnings
from typing import Type

from .base import FFTFilter
from .ff_numpy import FFTFilterNumpy
Expand All @@ -12,7 +13,7 @@
PREFERRED_INTERFACE = None


def get_available_interfaces() -> list:
def get_available_interfaces() -> list[Type[FFTFilter]]:
"""Return a list of available FFT algorithms"""
interfaces = [
FFTFilterPyFFTW,
Expand All @@ -25,7 +26,7 @@ def get_available_interfaces() -> list:
return interfaces_available


def get_best_interface():
def get_best_interface() -> Type[FFTFilter]:
"""Return the fastest refocusing interface available
If `pyfftw` is installed, :class:`.FFTFilterPyFFTW`
Expand Down
3 changes: 2 additions & 1 deletion qpretrieve/interfere/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import warnings
from abc import ABC, abstractmethod
from typing import Type

import numpy as np

Expand All @@ -25,7 +26,7 @@ class BaseInterferogram(ABC):
}

def __init__(self, data: np.ndarray,
fft_interface: str | FFTFilter = "auto",
fft_interface: str | Type[FFTFilter] = "auto",
subtract_mean=True, padding=2, copy=True,
**pipeline_kws) -> None:
"""
Expand Down
7 changes: 3 additions & 4 deletions qpretrieve/interfere/if_qlsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ class QLSInterferogram(BaseInterferogram):

def __init__(self, data, reference=None, *args, **kwargs):
super(QLSInterferogram, self).__init__(data, *args, **kwargs)
ff_iface = get_best_interface()

if reference is not None:
self.fft_ref = ff_iface(data=reference,
subtract_mean=self.fft.subtract_mean,
padding=self.fft.padding)
self.fft_ref = self.ff_iface(data=reference,
subtract_mean=self.fft.subtract_mean,
padding=self.fft.padding)
else:
self.fft_ref = None

Expand Down

0 comments on commit bd671d7

Please sign in to comment.