From ac90998e14fe96243e9c6854993067524fc1f469 Mon Sep 17 00:00:00 2001 From: Marcus Hughes Date: Sat, 16 Nov 2024 16:35:41 -0700 Subject: [PATCH 1/5] fix-226 --- regularizepsf/transform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/regularizepsf/transform.py b/regularizepsf/transform.py index 7107522..e29f448 100644 --- a/regularizepsf/transform.py +++ b/regularizepsf/transform.py @@ -173,6 +173,7 @@ def save(self, path: pathlib.Path) -> None: None """ + path = pathlib.Path(path) if path.suffix == ".h5": with h5py.File(path, "w") as f: f.create_dataset("coordinates", data=self.coordinates) @@ -201,6 +202,7 @@ def load(cls, path: pathlib.Path) -> ArrayPSFTransform: PSFTransform """ + path = pathlib.Path(path) if path.suffix == ".h5": with h5py.File(path, "r") as f: coordinates = [tuple(c) for c in f["coordinates"][:]] From 8309c6a264bd87b017dddab41acaf42c53d37eb3 Mon Sep 17 00:00:00 2001 From: Marcus Hughes Date: Sat, 16 Nov 2024 16:37:45 -0700 Subject: [PATCH 2/5] Update psf.py --- regularizepsf/psf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/regularizepsf/psf.py b/regularizepsf/psf.py index 9ad9fe4..e2c7af5 100644 --- a/regularizepsf/psf.py +++ b/regularizepsf/psf.py @@ -272,6 +272,7 @@ def save(self, path: pathlib.Path) -> None: None """ + path = pathlib.Path(path) if path.suffix == ".h5": with h5py.File(path, "w") as f: f.create_dataset("coordinates", data=self.coordinates) @@ -302,6 +303,7 @@ def load(cls, path: pathlib.Path) -> ArrayPSF: loaded model """ + path = pathlib.Path(path) if path.suffix == ".h5": with h5py.File(path, "r") as f: coordinates = [tuple(c) for c in f["coordinates"][:]] From 2fe1359e839c47094dc78334dbe48cd1c930f852 Mon Sep 17 00:00:00 2001 From: Marcus Hughes Date: Sat, 16 Nov 2024 16:39:12 -0700 Subject: [PATCH 3/5] always use pathlib --- regularizepsf/psf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regularizepsf/psf.py b/regularizepsf/psf.py index e2c7af5..2c820fe 100644 --- a/regularizepsf/psf.py +++ b/regularizepsf/psf.py @@ -2,6 +2,7 @@ from __future__ import annotations +import pathlib import inspect from typing import TYPE_CHECKING, Any, cast from functools import partial @@ -17,7 +18,6 @@ from regularizepsf.visualize import KERNEL_IMSHOW_ARGS_DEFAULT, PSF_IMSHOW_ARGS_DEFAULT, visualize_grid if TYPE_CHECKING: - import pathlib from numbers import Real from collections.abc import Callable From a503c26610a1a6d1a6703e14af76719e358edf4e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 16 Nov 2024 23:39:17 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- regularizepsf/psf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regularizepsf/psf.py b/regularizepsf/psf.py index 2c820fe..70a9ed4 100644 --- a/regularizepsf/psf.py +++ b/regularizepsf/psf.py @@ -2,8 +2,8 @@ from __future__ import annotations -import pathlib import inspect +import pathlib from typing import TYPE_CHECKING, Any, cast from functools import partial From b37216058f3d2a42b74ce189b0442a1c193bd4c2 Mon Sep 17 00:00:00 2001 From: Marcus Hughes Date: Sat, 16 Nov 2024 16:39:28 -0700 Subject: [PATCH 5/5] always use pathlib --- regularizepsf/transform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regularizepsf/transform.py b/regularizepsf/transform.py index e29f448..4d70a6f 100644 --- a/regularizepsf/transform.py +++ b/regularizepsf/transform.py @@ -2,6 +2,7 @@ from __future__ import annotations +import pathlib from typing import TYPE_CHECKING import h5py @@ -15,7 +16,6 @@ from regularizepsf.visualize import KERNEL_IMSHOW_ARGS_DEFAULT, visualize_grid if TYPE_CHECKING: - import pathlib from regularizepsf.psf import ArrayPSF