Skip to content

Commit 2f01db4

Browse files
committed
Add test from astropy#7035
1 parent 3b37dc3 commit 2f01db4

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎astropy/modeling/tests/test_fitters.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,20 @@ def test_fitters_with_weights():
965965
assert_allclose(pmod.parameters, p2.parameters, atol=10 ** (-2))
966966

967967

968+
def test_linear_fitters_with_weights():
969+
"""Regression test for #7035"""
970+
Xin, Yin = np.mgrid[0:21, 0:21]
971+
fitter = LinearLSQFitter()
972+
973+
zsig = np.random.normal(0, 0.01, size=Xin.shape)
974+
975+
p2 = models.Polynomial2D(3)
976+
p2.parameters = np.arange(10)/1.2
977+
z = p2(Xin, Yin)
978+
pmod = fitter(models.Polynomial2D(3), Xin, Yin, z + zsig, weights=zsig**(-2))
979+
assert_allclose(pmod.parameters, p2.parameters, atol=10 ** (-2))
980+
981+
968982
@pytest.mark.skipif('not HAS_SCIPY')
969983
@pytest.mark.filterwarnings('ignore:The fit may be unsuccessful')
970984
def test_fitters_interface():

0 commit comments

Comments
 (0)