Beispiel #1
0
    def _add_edges_from_subshells_names(self,
                                        e_shells=None,
                                        copy2interactive_ns=True):
        """Create the Edge instances and configure them appropiately
        Parameters
        ----------
        e_shells : list of strings
        copy2interactive_ns : bool
            If True, variables with the format Element_Shell will be
            created in IPython's interactive shell
        """
        interactive_ns = get_interactive_ns()
        if e_shells is None:
            e_shells = list(self.spectrum.subshells)
        e_shells.sort()
        master_edge = EELSCLEdge(e_shells.pop(), self.GOS)
        # If self.GOS was None, the GOS is set by eels_cl_edge so
        # we reassing the value of self.GOS
        self.GOS = master_edge.GOS._name
        self.append(master_edge)
        interactive_ns[self[-1].name] = self[-1]
        element = master_edge.element
        interactive_ns[element] = []
        interactive_ns[element].append(self[-1])
        while len(e_shells) > 0:
            next_element = e_shells[-1].split('_')[0]
            if next_element != element:
                # New master edge
                self._add_edges_from_subshells_names(e_shells=e_shells)
            elif self.GOS == 'hydrogenic':
                # The hydrogenic GOS includes all the L subshells in one
                # so we get rid of the others
                e_shells.pop()
            else:
                # Add the other subshells of the same element
                # and couple their intensity and onset_energy to that of the
                # master edge
                edge = EELSCLEdge(e_shells.pop(), GOS=self.GOS)

                edge.intensity.twin = master_edge.intensity
                delta = _give_me_delta(master_edge.GOS.onset_energy,
                                       edge.GOS.onset_energy)
                idelta = _give_me_idelta(master_edge.GOS.onset_energy,
                                         edge.GOS.onset_energy)
                edge.onset_energy.twin_function = delta
                edge.onset_energy.twin_inverse_function = idelta
                edge.onset_energy.twin = master_edge.onset_energy
                edge.free_onset_energy = False
                self.append(edge)
                if copy2interactive_ns is True:
                    interactive_ns[edge.name] = edge
                    interactive_ns[element].append(edge)
Beispiel #2
0
 def _add_edges_from_subshells_names(self, e_shells=None, 
                                     copy2interactive_ns=True):
     """Create the Edge instances and configure them appropiately
     Parameters
     ----------
     e_shells : list of strings
     copy2interactive_ns : bool
         If True, variables with the format Element_Shell will be 
         created in IPython's interactive shell
     """
     interactive_ns = get_interactive_ns()
     if e_shells is None:
         e_shells = list(self.spectrum.subshells)
     e_shells.sort()
     master_edge = EELSCLEdge(e_shells.pop(), self.GOS)
     # If self.GOS was None, the GOS is set by eels_cl_edge so
     # we reassing the value of self.GOS
     self.GOS = master_edge.GOS._name
     self.append(master_edge)
     interactive_ns[self[-1].name] = self[-1]
     element = master_edge.element
     interactive_ns[element] = []
     interactive_ns[element].append(self[-1])
     while len(e_shells) > 0:
         next_element = e_shells[-1].split('_')[0]
         if next_element != element:
             # New master edge
             self._add_edges_from_subshells_names(e_shells=e_shells)
         elif self.GOS == 'hydrogenic':
             # The hydrogenic GOS includes all the L subshells in one
             # so we get rid of the others
             e_shells.pop()
         else:
             # Add the other subshells of the same element
             # and couple their intensity and onset_energy to that of the 
             # master edge
             edge = EELSCLEdge(e_shells.pop(), GOS=self.GOS)
             
             edge.intensity.twin = master_edge.intensity
             delta =  _give_me_delta(master_edge.GOS.onset_energy,
                                    edge.GOS.onset_energy)
             idelta = _give_me_idelta(master_edge.GOS.onset_energy,
                                    edge.GOS.onset_energy)
             edge.onset_energy.twin_function = delta
             edge.onset_energy.twin_inverse_function = idelta
             edge.onset_energy.twin = master_edge.onset_energy
             edge.free_onset_energy = False
             self.append(edge)
             if copy2interactive_ns is True:
                 interactive_ns[edge.name] = edge
                 interactive_ns[element].append(edge)
Beispiel #3
0
    def _add_edges_from_subshells_names(self, e_shells=None):
        """Create the Edge instances and configure them appropiately
        Parameters
        ----------
        e_shells : list of strings
        """
        if e_shells is None:
            e_shells = list(self.spectrum.subshells)
        e_shells.sort()
        master_edge = EELSCLEdge(e_shells.pop(), self.GOS)
        # If self.GOS was None, the GOS is set by eels_cl_edge so
        # we reassing the value of self.GOS
        self.GOS = master_edge.GOS._name
        self.append(master_edge)
        element = master_edge.element
        while len(e_shells) > 0:
            next_element = e_shells[-1].split('_')[0]
            if next_element != element:
                # New master edge
                self._add_edges_from_subshells_names(e_shells=e_shells)
            elif self.GOS == 'hydrogenic':
                # The hydrogenic GOS includes all the L subshells in one
                # so we get rid of the others
                e_shells.pop()
            else:
                # Add the other subshells of the same element
                # and couple their intensity and onset_energy to that of the
                # master edge
                edge = EELSCLEdge(e_shells.pop(), GOS=self.GOS)

                edge.intensity.twin = master_edge.intensity
                delta = _give_me_delta(master_edge.GOS.onset_energy,
                                       edge.GOS.onset_energy)
                idelta = _give_me_idelta(master_edge.GOS.onset_energy,
                                         edge.GOS.onset_energy)
                edge.onset_energy.twin_function = delta
                edge.onset_energy.twin_inverse_function = idelta
                edge.onset_energy.twin = master_edge.onset_energy
                edge.free_onset_energy = False
                self.append(edge)
Beispiel #4
0
    def _add_edges_from_subshells_names(self, e_shells=None):
        """Create the Edge instances and configure them appropiately
        Parameters
        ----------
        e_shells : list of strings
        """
        if e_shells is None:
            e_shells = list(self.spectrum.subshells)
        e_shells.sort()
        master_edge = EELSCLEdge(e_shells.pop(), self.GOS)
        # If self.GOS was None, the GOS is set by eels_cl_edge so
        # we reassing the value of self.GOS
        self.GOS = master_edge.GOS._name
        self.append(master_edge)
        element = master_edge.element
        while len(e_shells) > 0:
            next_element = e_shells[-1].split('_')[0]
            if next_element != element:
                # New master edge
                self._add_edges_from_subshells_names(e_shells=e_shells)
            elif self.GOS == 'hydrogenic':
                # The hydrogenic GOS includes all the L subshells in one
                # so we get rid of the others
                e_shells.pop()
            else:
                # Add the other subshells of the same element
                # and couple their intensity and onset_energy to that of the
                # master edge
                edge = EELSCLEdge(e_shells.pop(), GOS=self.GOS)

                edge.intensity.twin = master_edge.intensity
                delta = _give_me_delta(master_edge.GOS.onset_energy,
                                       edge.GOS.onset_energy)
                idelta = _give_me_idelta(master_edge.GOS.onset_energy,
                                         edge.GOS.onset_energy)
                edge.onset_energy.twin_function = delta
                edge.onset_energy.twin_inverse_function = idelta
                edge.onset_energy.twin = master_edge.onset_energy
                edge.free_onset_energy = False
                self.append(edge)