Created
December 25, 2017 13:53
-
-
Save majkelx/0f105055554ce5061264f18be44b5171 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from numpy.testing.utils import assert_allclose | |
| from astropy.modeling.fitting import LevMarLSQFitter, LinearLSQFitter | |
| from astropy.modeling import models | |
| def test_fitters_with_weights(): | |
| """ Fails due issue #7035""" | |
| Xin, Yin = np.mgrid[0:21, 0:21] | |
| # fitter = LevMarLSQFitter() | |
| fitter = LinearLSQFitter() | |
| zsig = np.random.normal(0, 0.01, size=Xin.shape) | |
| p2 = models.Polynomial2D(3) | |
| p2.parameters = np.arange(10)/1.2 | |
| z = p2(Xin, Yin) | |
| pmod = fitter(models.Polynomial2D(3), Xin, Yin, z + zsig, weights=zsig**(-2)) | |
| assert_allclose(pmod.parameters, p2.parameters, atol=10 ** (-2)) | |
| test_fitters_with_weights() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment