Ejemplo n.º 1
0
    def test_fit_baseline_plus_bell_invalid(self):
        """Test that the fit procedure works."""

        x = np.arange(0, len(self.series)) * 0.1
        y = np.copy(self.series) + _test_shape(x) + x * 6 + 20
        with pytest.raises(ValueError) as excinfo:
            model, _ = fit_baseline_plus_bell(x, y, ye=10, kind='zxcdf')
        assert 'kind has to be one of: gauss, lorentz' in str(excinfo)
Ejemplo n.º 2
0
    def test_fit_baseline_plus_bell_lorentz(self):
        """Test that the fit procedure works."""

        x = np.arange(0, len(self.series)) * 0.1
        y = np.copy(self.series) + _test_shape(x) + x * 6 + 20

        model, _ = fit_baseline_plus_bell(x, y, ye=10, kind='lorentz')

        np.testing.assert_almost_equal(model.x_0_1, 50., 1)
Ejemplo n.º 3
0
    def test_fit_baseline_plus_bell(self):
        """Test that the fit procedure works."""

        x = np.arange(0, len(self.series)) * 0.1
        y = np.copy(self.series) + _test_shape(x) + x * 6 + 20

        model, _ = fit_baseline_plus_bell(x, y, ye=10, kind='gauss')

        np.testing.assert_almost_equal(model.mean_1, 50., 1)
        np.testing.assert_almost_equal(model.slope_0, 6., 1)
        assert np.abs(model.intercept_0 - 20.) < 2