Ejemplo n.º 1
0
def test_plot_add_background_windows():
    s = EDS_TEM_Spectrum().isig[5.0:8.0]
    s.plot()
    bw = s.estimate_background_windows()
    s._add_background_windows_markers(bw)
    # Add integration windows
    iw = s.estimate_integration_windows(windows_width=2.0, xray_lines=['Fe_Ka'])
    s._add_vertical_lines_groups(iw, linestyle='--')
Ejemplo n.º 2
0
def test_plot_xray_lines():
    # It should be the same image as with previous test (test_plot_eds_lines)
    a = EDS_TEM_Spectrum()
    s = stack([a, a * 5])
    s.plot()
    s._plot_xray_lines(xray_lines=True)
    s.axes_manager.navigation_axes[0].index = 1
    return s._plot.signal_plot.figure
Ejemplo n.º 3
0
def test_plot_eds_lines_not_in_range(caplog):
    s = EDS_TEM_Spectrum().isig[5.0:8.0]
    s.plot()
    with caplog.at_level(logging.WARNING):
        s._plot_xray_lines(xray_lines=['Pt_Ka'])

    assert "Pt_Ka is not in the data energy range." in caplog.text
Ejemplo n.º 4
0
def test_strings_from_py2():
    s = EDS_TEM_Spectrum()
    assert s.metadata.Sample.elements.dtype.char == "U"
Ejemplo n.º 5
0
def test_comparison_quantification():
    kfactors = [1.450226, 5.075602]  # For Fe Ka and Pt La

    s = EDS_TEM_Spectrum()
    s.add_elements(['Cu'])  # to get good estimation of the background
    m = s.create_model(True)
    m.set_signal_range(5.5, 10.0)  # to get good fit
    m.fit()
    intensities_m = m.get_lines_intensity(['Fe_Ka', "Pt_La"])
    quant_model = s.quantification(intensities_m,
                                   method='CL',
                                   factors=kfactors)

    # Background substracted EDS quantification
    s2 = EDS_TEM_Spectrum()
    s2.add_lines()
    bw = s2.estimate_background_windows(line_width=[5.0, 2.0])
    intensities = s2.get_lines_intensity(background_windows=bw)
    atomic_percent = s2.quantification(intensities,
                                       method='CL',
                                       factors=kfactors)

    np.testing.assert_allclose([q.data for q in quant_model],
                               [q.data for q in atomic_percent],
                               rtol=0.5E-1)
Ejemplo n.º 6
0
def test_strings_from_py2():
    s = EDS_TEM_Spectrum()
    assert isinstance(s.metadata.Sample.elements, list)
Ejemplo n.º 7
0
def test_plot_eds_markers_no_energy():
    s = EDS_TEM_Spectrum()
    del s.metadata.Acquisition_instrument.TEM.beam_energy
    s.plot(True)
Ejemplo n.º 8
0
def test_plot_eds_markers_close():
    s = EDS_TEM_Spectrum()
    s.plot(True)
    return s
Ejemplo n.º 9
0
def test_plot_eds_lines():
    a = EDS_TEM_Spectrum()
    s = stack([a, a * 5])
    s.plot(True)
    s.axes_manager.navigation_axes[0].index = 1
    return s._plot.signal_plot.figure
Ejemplo n.º 10
0
 def test_close_figure_with_plotted_marker(self):
     s = EDS_TEM_Spectrum()
     s.plot(True)
     s._plot.close()
     self._assert_figure_state_after_close(s._plot.signal_plot)
Ejemplo n.º 11
0
def test_strings_from_py2():
    s = EDS_TEM_Spectrum()
    nt.assert_equal(s.metadata.Sample.elements.dtype.char, "U")
Ejemplo n.º 12
0
def test_plot_eds_lines_background():
    s = EDS_TEM_Spectrum().isig[5.0:8.0]
    s.plot()
    bw = s.estimate_background_windows()
    s._plot_xray_lines(background_windows=bw)
Ejemplo n.º 13
0
def test_close_figure_with_plotted_marker():
    s = EDS_TEM_Spectrum()
    s.plot(True)
    s._plot.close()
    check_closing_plot(s)