diff --git a/glass/galaxies.py b/glass/galaxies.py index 5cf0dda7..96891010 100644 --- a/glass/galaxies.py +++ b/glass/galaxies.py @@ -296,7 +296,7 @@ def gaussian_phz( def kappa_ia_nla( # noqa: PLR0913 - delta: npt.NDArray[typing.Any], + delta: npt.NDArray[np.float64], zeff: float, a_ia: float, cosmo: Cosmology, @@ -306,7 +306,7 @@ def kappa_ia_nla( # noqa: PLR0913 lbar: float = 0.0, l0: float = 1e-9, beta: float = 0.0, -) -> npt.NDArray[typing.Any]: +) -> npt.NDArray[np.float64]: r""" Effective convergence from intrinsic alignments using the NLA model. diff --git a/glass/user.py b/glass/user.py index 00ce8c60..606a3b44 100644 --- a/glass/user.py +++ b/glass/user.py @@ -27,6 +27,7 @@ if typing.TYPE_CHECKING: import collections.abc + import pathlib def save_cls(filename: str, cls: list[npt.NDArray[np.float64] | None]) -> None: @@ -106,7 +107,7 @@ def write( @contextmanager def write_catalog( - filename: str, + filename: pathlib.Path, *, ext: str | None = None, ) -> collections.abc.Generator[_FitsWriter]: diff --git a/tests/test_fits.py b/tests/test_fits.py index f9349001..09dbab22 100644 --- a/tests/test_fits.py +++ b/tests/test_fits.py @@ -1,5 +1,4 @@ import importlib.util -import os import pathlib import numpy as np @@ -28,15 +27,15 @@ def _test_append(fits, data, names) -> None: # type: ignore[no-untyped-def] @pytest.mark.skipif(not HAVE_FITSIO, reason="test requires fitsio") -def test_basic_write(tmp_path: os.PathLike[str]) -> None: +def test_basic_write(tmp_path: pathlib.Path) -> None: import fitsio filename_gfits = "gfits.fits" # what GLASS creates filename_tfits = "tfits.fits" # file created on the fly to test against with ( - user.write_catalog(tmp_path / filename_gfits, ext="CATALOG") as out, # type: ignore[operator] - fitsio.FITS(tmp_path / filename_tfits, "rw", clobber=True) as my_fits, # type: ignore[operator] + user.write_catalog(tmp_path / filename_gfits, ext="CATALOG") as out, + fitsio.FITS(tmp_path / filename_tfits, "rw", clobber=True) as my_fits, ): for i in range(my_max): array = np.arange(i, i + 1, delta) # array of size 1/delta @@ -47,8 +46,8 @@ def test_basic_write(tmp_path: os.PathLike[str]) -> None: _test_append(my_fits, arrays, names) with ( - fitsio.FITS(tmp_path / filename_gfits) as g_fits, # type: ignore[operator] - fitsio.FITS(tmp_path / filename_tfits) as t_fits, # type: ignore[operator] + fitsio.FITS(tmp_path / filename_gfits) as g_fits, + fitsio.FITS(tmp_path / filename_tfits) as t_fits, ): glass_data = g_fits[1].read() test_data = t_fits[1].read() @@ -59,7 +58,7 @@ def test_basic_write(tmp_path: os.PathLike[str]) -> None: @pytest.mark.skipif(not HAVE_FITSIO, reason="test requires fitsio") def test_write_exception(tmp_path: pathlib.Path) -> None: try: - with user.write_catalog(tmp_path / filename, ext="CATALOG") as out: # type: ignore[arg-type] + with user.write_catalog(tmp_path / filename, ext="CATALOG") as out: for i in range(my_max): if i == except_int: msg = "Unhandled exception"