How to use the hyperspy.components.Gaussian function in hyperspy

To help you get started, we’ve selected a few hyperspy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperspy / hyperspy / test_model.py View on Github external
def test_access_component_by_index(self):
        m = self.model
        g1 = Gaussian()
        g2 = Gaussian()
        g2.name = "test"
        m.extend((g1, g2))
        nose.tools.assert_is(m[1], g2)
github hyperspy / hyperspy / test_model.py View on Github external
    @nose.tools.raises(ValueError)
    def test_get_component_wrong(self):
        m = self.model
        g1 = Gaussian()
        g2 = Gaussian()
        g2.name = "test"
        m.extend((g1, g2))
        m._get_component(1.2)
github hyperspy / hyperspy / test_model.py View on Github external
def test_component_name_when_append(self):
        m = self.model
        gs = [Gaussian(), Gaussian(), Gaussian()]
        m.extend(gs)
        nose.tools.assert_is(m['Gaussian'], gs[0])
        nose.tools.assert_is(m['Gaussian_0'], gs[1])
        nose.tools.assert_is(m['Gaussian_1'], gs[2])
github hyperspy / hyperspy / test_model.py View on Github external
def test_several_component_with_same_name(self):
        m = self.model
        gs = [Gaussian(), Gaussian(), Gaussian()]
        m.extend(gs)
        m[0]._name = "Gaussian"
        m[1]._name = "Gaussian"
        m[2]._name = "Gaussian"
        m['Gaussian']
github hyperspy / hyperspy / test_model.py View on Github external
def test_get_component_by_index(self):
        m = self.model
        g1 = Gaussian()
        g2 = Gaussian()
        g2.name = "test"
        m.extend((g1, g2))
        nose.tools.assert_is(m._get_component(1), g2)
github hyperspy / hyperspy / test_model.py View on Github external
def test_component_already_in_model(self):
        m = self.model
        g1 = Gaussian()
        m.extend((g1, g1))
github hyperspy / hyperspy / test_model.py View on Github external
def test_access_component_by_name(self):
        m = self.model
        g1 = Gaussian()
        g2 = Gaussian()
        g2.name = "test"
        m.extend((g1, g2))
        nose.tools.assert_is(m["test"], g2)
github hyperspy / hyperspy / test_model.py View on Github external
def test_get_component_by_component(self):
        m = self.model
        g1 = Gaussian()
        g2 = Gaussian()
        g2.name = "test"
        m.extend((g1, g2))
        nose.tools.assert_is(m._get_component(g2), g2)