Skip to content

Commit

Permalink
fix: bad header init (#171)
Browse files Browse the repository at this point in the history
fix: bad header init (#171)
  • Loading branch information
lgrcia authored Mar 25, 2024
2 parents eedfa9f + a5b669a commit 4732901
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 3 additions & 4 deletions prose/core/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ def __post_init__(self):
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()
# backward compatibility
self.header = self.computed.get("fits_header", Header())

if isinstance(self._sources, dict):
self._sources = Sources(**self._sources)
if self._sources is None:
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.3.1"
version = "3.3.2"
description = "Modular image processing pipelines for Astronomy"
authors = ["Lionel Garcia"]
license = "MIT"
Expand Down
8 changes: 8 additions & 0 deletions tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,11 @@ def test_fitsimage(tmp_path):

loaded_image = FITSImage(filename)
assert "IMAGETYP" in dict(loaded_image.header)


def test_init_header():

d = np.ones((512, 512))
hdr = dict(FILTER="B")

assert Image(d, header=hdr).header == hdr

0 comments on commit 4732901

Please sign in to comment.