Commit 624c294c authored by Henri Payno's avatar Henri Payno
Browse files

[utils] rework the create_dataset to get more realistic values

parent 6f4bb157
......@@ -72,8 +72,7 @@ class TestNxWriting(unittest.TestCase):
"""Test that the nx process is correctly store ad the output data"""
def setUp(self):
self.output_dir = tempfile.mkdtemp()
spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
energy = numpy.linspace(start=3.26, stop=3.96, num=256)
energy, spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
self.xas_obj = XASObject(spectra=spectra, energy=energy)
self.h5_file = os.path.join(self.output_dir, 'output_file.h5')
......
......@@ -80,8 +80,7 @@ class TestNormalizationSingleSpectrum(unittest.TestCase):
class TestNormalizationMultipleSpectrum(unittest.TestCase):
"""Make sure the process is processing correctly on a XASObject spectra"""
def setUp(self):
self.spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
self.energy = numpy.linspace(start=3.26, stop=3.96, num=256)
self.energy, self.spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
self.output_dir = tempfile.mkdtemp()
spectra_path = '/data/NXdata/data'
channel_path = '/data/NXdata/Channel'
......
......@@ -98,8 +98,7 @@ class TestStreamSingleSpectrum(unittest.TestCase):
self.assertTrue(len(out.spectra[0].ft.intensity) > 0)
def test_pymca_with_roi(self):
spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
energy = numpy.linspace(start=3.26, stop=3.96, num=256)
energy, spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
roi = XASROI(origin=(0, 2), size=(5, 1))
xas_obj = XASObject(spectra=spectra, energy=energy,
configuration={'roi': roi.to_dict()})
......@@ -122,8 +121,7 @@ class TestWorkflowAndH5LinkedFile(unittest.TestCase):
"""
def setUp(self):
self.output_dir = tempfile.mkdtemp()
spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
energy = numpy.linspace(start=3.26, stop=3.96, num=256)
energy, spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
roi = XASROI(origin=(0, 2), size=(5, 1))
self.xas_obj = XASObject(spectra=spectra, energy=energy,
configuration={'roi': roi.to_dict()})
......
......@@ -43,8 +43,8 @@ from xas.core.utils import spectra as spectra_utils
class TestRoi(unittest.TestCase):
def setUp(self):
self.spectra = spectra_utils.create_dataset(shape=(16, 100, 30))
self.energy = numpy.linspace(start=3.26, stop=3.96, num=16)
self.energy, self.spectra = spectra_utils.create_dataset(
shape=(16, 100, 30))
self.output_dir = tempfile.mkdtemp()
spectra_path = '/data/NXdata/data'
channel_path = '/data/NXdata/Channel'
......
......@@ -95,8 +95,7 @@ class TestXASObject(unittest.TestCase):
def test_create_from_several_spectrums(self):
"""check that we can create a XASObject from numpy arrays"""
self.spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
self.energy = numpy.linspace(start=3.26, stop=3.96, num=256)
self.energy, self.spectra = spectra_utils.create_dataset(shape=(256, 20, 10))
self.output_dir = tempfile.mkdtemp()
spectra_path = '/data/NXdata/data'
channel_path = '/data/NXdata/Channel'
......
This diff is collapsed.
......@@ -141,8 +141,7 @@ if __name__ == '__main__':
from xas.core.utils import spectra as spectra_utils
from xas.core.process.roi import ROIProcess, _ROI
from silx.gui.colors import Colormap
spectra = spectra_utils.create_dataset(shape=(256, 32, 64))
energy = numpy.linspace(start=3.25, stop=3.69, num=256)
energy, spectra = spectra_utils.create_dataset(shape=(256, 32, 64))
xas_obj = XASObject(spectra=spectra, energy=energy, configuration=None)
app = qt.QApplication([])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment