diff --git a/heracles/catalog/base.py b/heracles/catalog/base.py index bf02d84..e19c5e0 100644 --- a/heracles/catalog/base.py +++ b/heracles/catalog/base.py @@ -419,7 +419,7 @@ def _names(self) -> TypeVar("Unknown"): ... @abstractmethod - def _size(self, selection: TypeVar("Unknown")) -> TypeVar("Unknown"): + def _size(self, selection: TypeVar("Unknown")) -> int: """Abstract method to return the size of the catalogue or selection. Args: diff --git a/heracles/covariance.py b/heracles/covariance.py index 6dd8217..8bf7c02 100644 --- a/heracles/covariance.py +++ b/heracles/covariance.py @@ -17,7 +17,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with Heracles. If not, see . """Module for covariance matrix computation.""" - import logging import time from datetime import timedelta @@ -26,6 +25,7 @@ import healpy as hp import numpy as np +import numpy.typing as npt from ._kmeans_radec import kmeans_sample @@ -37,9 +37,9 @@ class SampleCovariance(np.ndarray): def __new__( cls, - nrows: TypeVar("Unknown"), - ncols: Optional[TypeVar("Unknown")] = None, - ) -> TypeVar("Unknown"): + nrows: int, + ncols: Optional[int] = None, + ) -> "SampleCovariance": """_summary_. Args: @@ -57,7 +57,7 @@ def __new__( cov.sample_col_mean = np.zeros(ncols) return cov - def __array_finalize__(self, cov: TypeVar("Unknown")) -> None: + def __array_finalize__(self, cov: Optional["SampleCovariance"]) -> None: """_summary_. Args: @@ -74,9 +74,9 @@ def __array_finalize__(self, cov: TypeVar("Unknown")) -> None: def add_sample( - cov: TypeVar("Unknown"), - x: TypeVar("Unknown"), - y: Optional[TypeVar("Unknown")] = None, + cov: "SampleCovariance", + x: npt.NDArray, + y: Optional[npt.NDArray] = None, ) -> None: """Add a sample to a sample covariance matrix. @@ -106,7 +106,7 @@ def add_sample( cov += (np.outer(delta, y - cov.sample_col_mean) - cov) / (cov.sample_count - 1) -def update_covariance(cov: TypeVar("Unknown"), sample: TypeVar("Unknown")) -> None: +def update_covariance(cov: "SampleCovariance", sample: TypeVar("Unknown")) -> None: """Update a set of sample covariances given a sample. Args: @@ -139,7 +139,7 @@ def update_covariance(cov: TypeVar("Unknown"), sample: TypeVar("Unknown")) -> No def jackknife_regions_kmeans( fpmap: TypeVar("Unknown"), - n: TypeVar("Unknown"), + n: int, *, maxrepeat: int = 5, maxiter: int = 1_000, diff --git a/heracles/util.py b/heracles/util.py index d8715e0..3b61784 100644 --- a/heracles/util.py +++ b/heracles/util.py @@ -43,7 +43,7 @@ def __init__(self, out: io.IOBase = sys.stdout) -> None: def start( self, total: TypeVar("Unknown"), - title: Optional[TypeVar("Unknown")] = None, + title: Optional[str] = None, ) -> None: """Start new progress.