From e6b99c9639f2152263d3cf4a6fa427f0b27f9d0b Mon Sep 17 00:00:00 2001 From: kelle Date: Fri, 15 Nov 2024 12:14:36 +0100 Subject: [PATCH] flux calibrate tests --- tests/test_spectrum.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_spectrum.py b/tests/test_spectrum.py index df50dc4..3347843 100644 --- a/tests/test_spectrum.py +++ b/tests/test_spectrum.py @@ -153,11 +153,15 @@ def test_flux_calibrate(self): """ Test that flux calibrate is working properly""" # 1 parsec Distance with unc close_distance = 1 * q.pc, 0.05 * q.pc - abs_sed = sp.Spectrum.flux_calibrate(self.flat1, close_distance) + abs_sed_close = sp.Spectrum.flux_calibrate(self.flat1, close_distance) + assert np.isclose(np.mean(abs_sed_close.flux),0.01, rtol=0.005) + assert np.isclose(np.mean(abs_sed_close.unc),0.001, rtol=0.005) # 15 parsec Distance with unc - far_distance = 15 * q.pc, 5 * q.pc - abs_sed = sp.Spectrum.flux_calibrate(self.flat1, far_distance) + far_distance = 15 * q.pc, 2 * q.pc + abs_sed_far = sp.Spectrum.flux_calibrate(self.flat1, far_distance) + assert np.isclose(np.mean(abs_sed_far.flux), 2.25, rtol=0.005) + assert np.isclose(np.mean(abs_sed_far.unc), 0.6, rtol=0.005) def test_interpolate(self): """Test interpolate method"""