Skip to content

Commit

Permalink
add tests for hdf5.Viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrammer committed Dec 13, 2024
1 parent 9c792b1 commit f22d4cc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions eazy/tests/test_photoz.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ def test_hdf5():
"""
Test HDF5 save / recover state
"""
import matplotlib.pyplot as plt
plt.ioff()

global ez

from .. import hdf5
Expand All @@ -456,6 +459,22 @@ def test_hdf5():
assert(np.allclose(ez.zbest, new_ez.zbest))
assert(np.allclose(ez.lnp, new_ez.lnp, rtol=1.e-4))

_ = new_ez.show_fit(10)
plt.close('all')

# Compact viewer
h5 = hdf5.Viewer('test.hdf5')

assert(h5.NOBJ == new_ez.NOBJ)
assert(h5.NTEMP == new_ez.NTEMP)
assert(h5.NFILT == new_ez.NFILT)
assert(h5.NZ == new_ez.NZ)
assert(np.allclose(h5.zp, new_ez.zp))

_cat = h5.get_catalog()
_ = h5.show_fit(10)
plt.close('all')


def test_cleanup():

Expand Down

0 comments on commit f22d4cc

Please sign in to comment.