From f22d4cca81842c4bd8f79a4e7a4a8d13914113b8 Mon Sep 17 00:00:00 2001 From: Gabriel Brammer Date: Fri, 13 Dec 2024 09:46:48 +0100 Subject: [PATCH] add tests for hdf5.Viewer --- eazy/tests/test_photoz.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/eazy/tests/test_photoz.py b/eazy/tests/test_photoz.py index 8951e2cc..706b2c64 100644 --- a/eazy/tests/test_photoz.py +++ b/eazy/tests/test_photoz.py @@ -436,6 +436,9 @@ def test_hdf5(): """ Test HDF5 save / recover state """ + import matplotlib.pyplot as plt + plt.ioff() + global ez from .. import hdf5 @@ -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():