Skip to content

Commit

Permalink
Fix more typing
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyroddy committed Sep 13, 2023
1 parent 0ea7e75 commit 50a3faf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion heracles/catalog/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 10 additions & 10 deletions heracles/covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public
# License along with Heracles. If not, see <https://www.gnu.org/licenses/>.
"""Module for covariance matrix computation."""

import logging
import time
from datetime import timedelta
Expand All @@ -26,6 +25,7 @@

import healpy as hp
import numpy as np
import numpy.typing as npt

from ._kmeans_radec import kmeans_sample

Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion heracles/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 50a3faf

Please sign in to comment.