def get_electron_energy_loss_spectrum(self, zlp, t): data = ((-1 / self.data).imag * eels_constant(self, zlp, t).data * self.axes_manager.signal_axes[0].scale) s = self._deepcopy_with_new_data(data) s.set_signal_type("EELS") s.metadata.General.title = ("EELS calculated from " + self.metadata.General.title) return s
def setUp(self): """To test the kramers_kronig_analysis we will generate 3 EELSSpectrum instances. First a model energy loss function(ELF), in our case following the Drude bulk plasmon peak. Second, we simulate the inelastic scattering to generate a model scattering distribution (SPC). Finally, we use a lorentzian peak with integral equal to 1 to simulate a ZLP. """ # Parameters i0 = 1. t = hs.signals.Signal(np.arange(10, 70, 10).reshape((2, 3))) t.axes_manager.set_signal_dimension(0) scale = 0.02 # Create an 3x2x2048 spectrum with Drude plasmon s = hs.signals.EELSSpectrum(np.zeros((2, 3, 2 * 2048))) s.set_microscope_parameters( beam_energy=300.0, convergence_angle=5, collection_angle=10.0) s.axes_manager.signal_axes[0].scale = scale k = eels_constant(s, i0, t) vpm = VolumePlasmonDrude() m = s.create_model(auto_background=False) m.append(vpm) vpm.intensity.map['values'][:] = 1 vpm.plasmon_energy.map['values'] = np.array([[8., 18.4, 15.8], [16.6, 4.3, 3.7]]) vpm.fwhm.map['values'] = np.array([[2.3, 4.8, 0.53], [3.7, 0.3, 0.3]]) vpm.intensity.map['is_set'][:] = True vpm.plasmon_energy.map['is_set'][:] = True vpm.fwhm.map['is_set'][:] = True s.data = (m.as_signal() * k).data # Create ZLP z = s.deepcopy() z.axes_manager.signal_axes[0].scale = scale z.axes_manager.signal_axes[0].offset = -10 zlp = Lorentzian() zlp.A.value = i0 zlp.gamma.value = 0.2 zlp.centre.value = 0.0 z.data[:] = zlp.function(z.axes_manager[-1].axis).reshape((1, 1, -1)) z.data *= scale self.s = s self.thickness = t self.k = k self.zlp = z
def get_electron_energy_loss_spectrum(self, zlp, t): for axis in self.axes_manager.signal_axes: if not axis.is_uniform: raise NotImplementedError( "The function is not implemented for non-uniform axes.") data = ((-1 / self.data).imag * eels_constant(self, zlp, t).data * self.axes_manager.signal_axes[0].scale) s = self._deepcopy_with_new_data(data) s.data = s.data.real s.set_signal_type("EELS") s.metadata.General.title = ("EELS calculated from " + self.metadata.General.title) return s