From 1478cd4883852938f1fa9a3e9620c3f3e0e4760e Mon Sep 17 00:00:00 2001 From: lgrcia Date: Tue, 28 Nov 2023 11:40:01 -0500 Subject: [PATCH] fix: back compat in loading old saved products --- prose/core/image.py | 6 +++++- prose/core/source.py | 3 +++ pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/prose/core/image.py b/prose/core/image.py index 699fce8d..6e7c244d 100644 --- a/prose/core/image.py +++ b/prose/core/image.py @@ -70,6 +70,10 @@ def __post_init__(self): self.catalogs = {} if self.computed is None: self.computed = {} + + # backward compatibility + self.header = self.computed.get("fits_header", None) + if self.header is None: self.header = Header() if isinstance(self._sources, dict): @@ -261,7 +265,7 @@ def fov(self): @property def fits_header(self): """Same as :code:`header` (backward compatibility)""" - return self.header + return self.computed.get("fits_header", self.header) @property def date(self): diff --git a/prose/core/source.py b/prose/core/source.py index 692f30d7..1487ceca 100644 --- a/prose/core/source.py +++ b/prose/core/source.py @@ -501,10 +501,13 @@ class Sources: """List of sources""" type: Literal["PointSource", None] = None """Source type""" + source_type: Literal["PointSource", None] = None + """Legacy source type""" def __post_init__(self): if self.sources is None: self.sources = [] + self.type = self.source_type if isinstance(self.sources, np.ndarray): if self.sources.dtype != object: diff --git a/pyproject.toml b/pyproject.toml index 0eda31af..52dacbc3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "prose" -version = "3.2.8" +version = "3.2.9" description = "Modular image processing pipelines for Astronomy" authors = ["Lionel Garcia"] license = "MIT"