Source code for est.tests.test_spectrum

"""Test the spectrum class"""

import numpy
from est.core.types import Spectrum
from est.units import ur

[docs] def test_from_dat(spectrum_cu_from_pymca): """check that we can create a Spectrum from a pymca .dat file""" assert is not None assert is not None
[docs] def test_from_numpy_array(): """check that we can create a Spectrum from numpy arrays""" energy = numpy.arange(10, 20) mu = numpy.arange(10) spectrum = Spectrum(energy=energy, mu=mu) numpy.testing.assert_array_equal(, (energy * ur.eV).m) numpy.testing.assert_array_equal(, mu) mu_2 = numpy.arange(30, 40) = mu_2 numpy.testing.assert_array_equal(, mu_2)