From 98e9befcacf03a57d2442f01b7db7c117b2c92b0 Mon Sep 17 00:00:00 2001 From: Astro-Kirsty Date: Tue, 25 Jul 2023 16:00:50 +0200 Subject: [PATCH] Adapt test to include ecpl Signed-off-by: Astro-Kirsty --- gammapy/modeling/models/tests/test_spectral.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gammapy/modeling/models/tests/test_spectral.py b/gammapy/modeling/models/tests/test_spectral.py index 41e59eaea3..9897eb3337 100644 --- a/gammapy/modeling/models/tests/test_spectral.py +++ b/gammapy/modeling/models/tests/test_spectral.py @@ -617,11 +617,23 @@ def test_pwl_pivot_energy(): assert_quantity_allclose(pwl.pivot_energy, np.nan * u.TeV, rtol=1e-5) pwl.covariance = [ - [0.0318377**2, 6.56889442e-14, 0], - [6.56889442e-14, 0, 0], + [0.08**2, 6.56889e-14, 0], + [6.56889e-14, (5.5e-12) ** 2, 0], [0, 0, 0], ] - assert_quantity_allclose(pwl.pivot_energy, 3.3540034 * u.TeV, rtol=1e-5) + assert_quantity_allclose(pwl.pivot_energy, 1.2112653 * u.TeV, rtol=1e-5) + + ecpl = ExpCutoffPowerLawSpectralModel( + amplitude="5.35510540e-11 cm-2 s-1 TeV-1", lambda_=0.001 * (1 / u.TeV), index=2 + ) + ecpl.covariance = [ + [0.08**2, 6.56889e-14, 0, 0, 0], + [6.56889e-14, (5.5e-12) ** 2, 0, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + ] + assert_quantity_allclose(pwl.pivot_energy, ecpl.pivot_energy, rtol=1e-5) def test_num_pivot_energy():