Ejemplo n.º 1
0
    def test_background_out_of_range_throws_error(self):
        x1 = np.linspace(0, 10)
        x2 = np.linspace(-10, -1)

        spec = Pattern(x1, x1)
        background_spectrum = Pattern(x2, x2)

        with self.assertRaises(BkgNotInRangeError):
            spec.background_pattern = background_spectrum
Ejemplo n.º 2
0
    def test_background_out_of_range_throws_error(self):
        x1 = np.linspace(0, 10)
        x2 = np.linspace(-10, -1)

        spec = Pattern(x1, x1)
        background_spectrum = Pattern(x2, x2)

        with self.assertRaises(BkgNotInRangeError):
            spec.background_pattern = background_spectrum
Ejemplo n.º 3
0
    def test_using_background_spectrum(self):
        x = np.linspace(-5, 5, 100)
        spec_y = x ** 2
        bkg_y = x

        spec = Pattern(x, spec_y)
        background_spectrum = Pattern(x, bkg_y)

        spec.background_pattern = background_spectrum
        new_x, new_y = spec.data

        self.array_almost_equal(new_x, x)
        self.array_almost_equal(new_y, spec_y - bkg_y)
Ejemplo n.º 4
0
    def test_using_background_spectrum(self):
        x = np.linspace(-5, 5, 100)
        spec_y = x**2
        bkg_y = x

        spec = Pattern(x, spec_y)
        background_spectrum = Pattern(x, bkg_y)

        spec.background_pattern = background_spectrum
        new_x, new_y = spec.data

        self.array_almost_equal(new_x, x)
        self.array_almost_equal(new_y, spec_y - bkg_y)
Ejemplo n.º 5
0
    def test_using_background_spectrum_with_different_spacing(self):
        x = np.linspace(-5, 5, 100)
        spec_y = x ** 2
        x_bkg = np.linspace(-5, 5, 99)
        bkg_y = x_bkg

        spec = Pattern(x, spec_y)
        background_spectrum = Pattern(x_bkg, bkg_y)

        spec.background_pattern = background_spectrum
        new_x, new_y = spec.data

        self.array_almost_equal(new_x, x)
        self.array_almost_equal(new_y, spec_y - x)
Ejemplo n.º 6
0
    def test_using_background_spectrum_with_different_spacing(self):
        x = np.linspace(-5, 5, 100)
        spec_y = x**2
        x_bkg = np.linspace(-5, 5, 99)
        bkg_y = x_bkg

        spec = Pattern(x, spec_y)
        background_spectrum = Pattern(x_bkg, bkg_y)

        spec.background_pattern = background_spectrum
        new_x, new_y = spec.data

        self.array_almost_equal(new_x, x)
        self.array_almost_equal(new_y, spec_y - x)