Ejemplo n.º 1
0
    def get_fine_structure_as_spectrum(self):
        """Returns a spectrum containing the fine structure.

        Notes
        -----
        The fine structure is corrected from multiple scattering if
        the model was convolved with a low-loss spectrum

        """
        from hyperspy._signals.eels import EELSSpectrum
        channels = int(np.floor(self.fine_structure_width / self.energy_scale))
        data = np.zeros(self.fine_structure_coeff.map.shape + (channels, ))
        s = EELSSpectrum(data,
                         axes=self.intensity._axes_manager._get_axes_dicts())
        s.get_dimensions_from_data()
        s.axes_manager.signal_axes[0].offset = self.onset_energy.value
        # Backup the axes_manager
        original_axes_manager = self._axes_manager
        self._axes_manager = s.axes_manager
        for spectrum in s:
            self.fetch_stored_values()
            spectrum.data[:] = self.function(
                s.axes_manager.signal_axes[0].axis)
        # Restore the axes_manager and the values
        self._axes_manager = original_axes_manager
        self.fetch_stored_values()

        s.metadata.General.title = self.name.replace('_',
                                                     ' ') + ' fine structure'

        return s
Ejemplo n.º 2
0
    def get_fine_structure_as_spectrum(self):
        """Returns a spectrum containing the fine structure.

        Notes
        -----
        The fine structure is corrected from multiple scattering if
        the model was convolved with a low-loss spectrum

        """
        from hyperspy._signals.eels import EELSSpectrum
        channels = int(np.floor(
            self.fine_structure_width / self.energy_scale))
        data = np.zeros(self.fine_structure_coeff.map.shape +
                        (channels,))
        s = EELSSpectrum(
            data,
            axes=self.intensity._axes_manager._get_axes_dicts())
        s.get_dimensions_from_data()
        s.axes_manager.signal_axes[0].offset = self.onset_energy.value
        # Backup the axes_manager
        original_axes_manager = self._axes_manager
        self._axes_manager = s.axes_manager
        for spectrum in s:
            self.fetch_stored_values()
            spectrum.data[:] = self.function(
                s.axes_manager.signal_axes[0].axis)
        # Restore the axes_manager and the values
        self._axes_manager = original_axes_manager
        self.fetch_stored_values()

        s.metadata.General.title = self.name.replace(
            '_', ' ') + ' fine structure'

        return s
Ejemplo n.º 3
0
 def setup_method(self, method):
     s_eels = EELSSpectrum([list(range(10))] * 3)
     s_eels.metadata.set_item(
         'Acquisition_instrument.TEM.Detector.EELS.collection_angle', 3.0)
     s_eels.metadata.set_item('Acquisition_instrument.TEM.beam_energy', 1.0)
     s_eels.metadata.set_item(
         'Acquisition_instrument.TEM.convergence_angle', 2.0)
     self.eels_m = s_eels.create_model(auto_background=False)
Ejemplo n.º 4
0
 def setUp(self):
     s_eels = EELSSpectrum([list(range(10))] * 3)
     s_eels.metadata.set_item(
         'Acquisition_instrument.TEM.Detector.EELS.collection_angle',
         3.0)
     s_eels.metadata.set_item('Acquisition_instrument.TEM.beam_energy', 1.0)
     s_eels.metadata.set_item(
         'Acquisition_instrument.TEM.convergence_angle',
         2.0)
     self.eels_m = s_eels.create_model(auto_background=False)
Ejemplo n.º 5
0
 def setup_method(self, method):
     data = np.random.random((10, 10, 600))
     s = EELSSpectrum(data)
     s.axes_manager[-1].offset = -150.
     s.axes_manager[-1].scale = 0.5
     s.metadata.set_item(
         'Acquisition_instrument.TEM.Detector.EELS.collection_angle', 3.0)
     s.metadata.set_item('Acquisition_instrument.TEM.beam_energy', 1.0)
     s.metadata.set_item('Acquisition_instrument.TEM.convergence_angle',
                         2.0)
     m = s.create_model(ll=s + 1,
                        auto_background=False,
                        auto_add_edges=False)
     g = Gaussian()
     m.append(g)
     self.model = m
Ejemplo n.º 6
0
 def setUp(self):
     data = np.random.random((10, 10, 600))
     s = EELSSpectrum(data)
     s.axes_manager[-1].offset = -150.
     s.axes_manager[-1].scale = 0.5
     s.metadata.set_item(
         'Acquisition_instrument.TEM.Detector.EELS.collection_angle',
         3.0)
     s.metadata.set_item('Acquisition_instrument.TEM.beam_energy', 1.0)
     s.metadata.set_item(
         'Acquisition_instrument.TEM.convergence_angle',
         2.0)
     m = s.create_model(
         ll=s + 1,
         auto_background=False,
         auto_add_edges=False)
     g = Gaussian()
     m.append(g)
     self.model = m