From a0ca243b195a123aa6b096d7ec12ef4bd1459ea3 Mon Sep 17 00:00:00 2001 From: ConstanceGanot <126498726+ConstanceGanot@users.noreply.github.com> Date: Wed, 21 Feb 2024 23:05:53 +0100 Subject: [PATCH] Salt2 ColorLaw function correction (#389) * Salt2 ColorLaw function correction * Update test_salt2utils.py --- sncosmo/salt2utils.pyx | 2 +- sncosmo/tests/test_salt2utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sncosmo/salt2utils.pyx b/sncosmo/salt2utils.pyx index ff953271..e6316a52 100644 --- a/sncosmo/salt2utils.pyx +++ b/sncosmo/salt2utils.pyx @@ -482,6 +482,6 @@ cdef class SALT2ColorLaw(object): # reconstruct input wavelengths wave_lo = self.l_lo * SALT2CL_V_MINUS_B + SALT2CL_B wave_hi = self.l_hi * SALT2CL_V_MINUS_B + SALT2CL_B - coeffs = [self.coeffs[i+1] for i in range(self.ncoeffs)] + coeffs = [self.coeffs[i+1] for i in range(self.ncoeffs - 1)] return (wave_lo, wave_hi), coeffs diff --git a/sncosmo/tests/test_salt2utils.py b/sncosmo/tests/test_salt2utils.py index 2204df69..41f7e4bf 100644 --- a/sncosmo/tests/test_salt2utils.py +++ b/sncosmo/tests/test_salt2utils.py @@ -109,7 +109,7 @@ def colorlaw_python(wave): def test_salt2colorlaw_pickle(): - colorlaw_coeffs = [-0.504294, 0.787691, -0.461715, 0.0815619] + colorlaw_coeffs = [-0.504294, 0.787691, -0.461715, 0.0815619, 0.0, 0.0] colorlaw_range = (2800., 7000.) colorlaw = SALT2ColorLaw(colorlaw_range, colorlaw_coeffs)