Skip to content

Commit

Permalink
fix: back compat in loading old saved products
Browse files Browse the repository at this point in the history
fix: back compat in loading old saved products
  • Loading branch information
lgrcia authored Nov 28, 2023
2 parents d37ceb0 + 1478cd4 commit 7db07fd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion prose/core/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions prose/core/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 7db07fd

Please sign in to comment.