Beispiel #1
0
    def __init__(self, element_subshell, GOS=None):
        # Declare the parameters
        Component.__init__(self, [
            'intensity', 'fine_structure_coeff', 'effective_angle',
            'onset_energy'
        ],
                           linear_parameter_list=['intensity'])
        if isinstance(element_subshell, dict):
            self.element = element_subshell['element']
            self.subshell = element_subshell['subshell']
        else:
            self.element, self.subshell = element_subshell.split('_')
        self.name = "_".join([self.element, self.subshell])
        self.energy_scale = None
        self.effective_angle.free = False
        self.fine_structure_active = False
        self.fine_structure_width = 30.
        self.fine_structure_coeff.ext_force_positive = False
        self.GOS = None
        # Set initial actions
        if GOS is None:
            try:
                self.GOS = HartreeSlaterGOS(element_subshell)
                GOS = 'Hartree-Slater'
            except IOError:
                GOS = 'hydrogenic'
                _logger.info('Hartree-Slater GOS not available. '
                             'Using hydrogenic GOS')
        if self.GOS is None:
            if GOS == 'Hartree-Slater':
                self.GOS = HartreeSlaterGOS(element_subshell)
            elif GOS == 'hydrogenic':
                self.GOS = HydrogenicGOS(element_subshell)
            else:
                raise ValueError('gos must be one of: None, \'hydrogenic\''
                                 ' or \'Hartree-Slater\'')
        self.onset_energy.value = self.GOS.onset_energy
        self.onset_energy.free = False
        self._position = self.onset_energy
        self.free_onset_energy = False
        self.intensity.grad = self.grad_intensity
        self.intensity.value = 1
        self.intensity.bmin = 0.
        self.intensity.bmax = None

        self._whitelist['GOS'] = ('init', GOS)
        if GOS == 'Hartree-Slater':
            self._whitelist['element_subshell'] = (
                'init', self.GOS.as_dictionary(True))
        elif GOS == 'hydrogenic':
            self._whitelist['element_subshell'] = ('init', element_subshell)
        self._whitelist['fine_structure_active'] = None
        self._whitelist['fine_structure_width'] = None
        self._whitelist['fine_structure_smoothing'] = None
        self.effective_angle.events.value_changed.connect(
            self._integrate_GOS, [])
        self.onset_energy.events.value_changed.connect(self._integrate_GOS, [])
        self.onset_energy.events.value_changed.connect(self._calculate_knots,
                                                       [])
Beispiel #2
0
 def __init__(self, element_subshell, GOS=None):
     # Declare the parameters
     Component.__init__(self,
         ['intensity',
          'fine_structure_coeff',
          'effective_angle',
          'onset_energy'])
     self.name = element_subshell
     self.element, self.subshell = element_subshell.split('_')
     self.energy_scale = None
     self.effective_angle.free = False
     self.fine_structure_active = preferences.EELS.fine_structure_active
     self.fine_structure_width = preferences.EELS.fine_structure_width
     self.fine_structure_coeff.ext_force_positive = False
     self.GOS = None
     # Set initial actions
     if GOS is None:
         try:
             self.GOS = HartreeSlaterGOS(element_subshell)
             GOS = 'Hartree-Slater'
         except IOError:
             GOS = 'hydrogenic'
             messages.information(
                 'Hartree-Slater GOS not available'
                 'Using hydrogenic GOS')
     if self.GOS is None:
         if GOS=='Hartree-Slater':
             self.GOS = HartreeSlaterGOS(element_subshell)
         elif GOS == 'hydrogenic':
             self.GOS = HydrogenicGOS(element_subshell)
         else:
             raise ValueError(
                 'gos must be one of: None, \'hydrogenic\''
                               ' or \'Hartree-Slater\'')
     self.onset_energy.value = self.GOS.onset_energy
     self.onset_energy.free = False
     self._position = self.onset_energy
     self.free_onset_energy = False        
     self.intensity.grad = self.grad_intensity
     self.intensity.value = 1
     self.intensity.bmin = 0.
     self.intensity.bmax = None