How to use the hyperspy.component.Component.__init__ 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 / hyperspy / components / parabole.py View on Github external
def __init__(self, a=0, b=1.,c = 1., origin = 0):
        Component.__init__(self, ['a', 'b', 'c', 'origin'])
        self.name = 'Parabole'
        self.a.value, self.b.value, self.c.value, self.origin.value = \
        a, b, c, origin
        self.isbackground = False
        self.convolved = True
        self.a.grad = self.grad_a
        self.b.grad = self.grad_b
        self.origin.grad = self.grad_origin
github pyxem / pyxem / pyxem / components / scattering_fit_component_lobato.py View on Github external
fracs: list of float
            A list of fraction of the respective elements. Should sum to 1.
        N : float
            The "slope" of the fit.
        C : float
            An additive constant to the fit.

        References
        ----------
        [1] Lobato, I., & Van Dyck, D. (2014). An accurate parameterization for
        scattering factors, electron densities and electrostatic potentials for
        neutral atoms that obey all physical constraints. Acta Crystallographica
        Section A: Foundations and Advances, 70(6), 636-649.

        """
        Component.__init__(self, ['N', 'C'])
        self._whitelist['elements'] = ('init,sig', elements)
        self._whitelist['fracs'] = ('init,sig', fracs)
        self.elements = elements
        self.fracs = fracs
        params = []
        for e in elements:
            params.append(ATOMIC_SCATTERING_PARAMS_LOBATO[e])
        self.params = params
        self.N.value = N
        self.C.value = C
github hyperspy / hyperspy / hyperspy / components / line.py View on Github external
def __init__( self, a = 0, b = 1 ):
        Component.__init__(self, ['a','b'])
        self.name = 'Line'
        self.a.free, self.b.free = True, True
        self.a.value, self.b.value = a, b

        self.isbackground = True
        self.convolved = False
        self.a.grad = self.grad_a
        self.b.grad = self.grad_b
        self.start_from = None
github pyxem / pyxem / pyxem / components / reduced_intensity_correction_component.py View on Github external
Parameters
        ----------
        a : float
        b : float
        c : float
        d : float
            a, b, c, and d are the coefficients of the 1st, 2nd, 3rd, and 4th
            order terms respectively of the returned polynomial.

        Returns
        -------
        p : polynomial of the form ax + bx^2 + cx^3 + dx^4

        '''

        Component.__init__(self, ('a', 'b', 'c', 'd'))
github hyperspy / hyperspy / hyperspy / components / fixed_pattern.py View on Github external
def __init__( self, array=None ):
        Component.__init__(self, ['intensity', 'origin'])
        self.name = 'Fixed pattern'
        self.array = array
        self.intensity.free = True
        self.intensity.value = 1.
        self.origin.value = 0
        self.origin.free = False
        self.isbackground = True
        self.convolved = False
        self.intensity.grad = self.grad_intensity
        self.interpolate = False
        self._interpolation_ready = False
github pyxem / pyxem / pycrystem / scalable_reference_pattern.py View on Github external
def __init__(self, signal2D,
                 d11=1., d12=0.,
                 d21=0., d22=1.,
                 t1=0., t2=0.,
                 order=3
                 ):

        Component.__init__(self, ['d11', 'd12',
                                    'd21', 'd22',
                                    't1', 't2'])

        self._whitelist['signal2D'] = ('init,sig', signal2D)
        self.signal = signal2D
        self.order = order
        self.d11.value = d11
        self.d12.value = d12
        self.d21.value = d21
        self.d22.value = d22
        self.t1.value = t1
        self.t2.value = t2
github hyperspy / hyperspy / hyperspy / _components / volume_plasmon_drude.py View on Github external
def __init__(self, intensity=1., plasmon_energy=15., fwhm=1.5):
        Component.__init__(self, ['intensity', 'plasmon_energy',
                                  'fwhm'])
        self._position = self.plasmon_energy
        self.intensity.value = intensity
        self.plasmon_energy.value = plasmon_energy
        self.fwhm.value = fwhm
        self.plasmon_energy.grad = self.grad_plasmon_energy
        self.fwhm.grad = self.grad_fwhm
        self.intensity.grad = self.grad_intensity
github hyperspy / hyperspy / hyperspy / _components / eels_vignetting.py View on Github external
def __init__(self):
        Component.__init__(self,
                           ['optical_center',
                            'height',
                            'period',
                            'left_slope',
                            'right_slope',
                            'left',
                            'right',
                            'sigma'])
        self.left.value = np.nan
        self.right.value = np.nan
        self.side_vignetting = False
        self.fix_side_vignetting()
        self.gaussian = Gaussian()
        self.gaussian.centre.free, self.gaussian.A.free = False, False
        self.sigma.value = 1.
        self.gaussian.A.value = 1.
github pyxem / pyxem / pyxem / utils / lobato_fit_component.py View on Github external
def __init__(self, elements, fracs, N = 1., C = 0.):
        """
        N and C are fitting parameters for the Component class.

        Parameters
        ----------
        N = the "slope"
        C = an additive constant

        sum_squares = sum (ci * fi**2 )
        square_sum = (sum(ci * fi))**2 for atomic fraction ci with
        electron scattering factor fi. Used for normalisation.
        """
        Component.__init__(self, ['N', 'C'])
        self.elements = elements
        self.fracs = fracs
        params = []
        for e in elements:
            params.append(ATOMIC_SCATTERING_PARAMS[e])
        self.params = params