Commit 335761a6 authored by payno's avatar payno
Browse files

[integrate ewoks] reworks test

parent a7549417
......@@ -115,14 +115,14 @@ class TestStreamSingleSpectrum(unittest.TestCase):
file_path=data_file, scheme="PyMca", data_path="Column 1"
),
)
out = PyMca_normalization()(xas_obj=out)
exafs_process = PyMca_exafs()
out = PyMca_normalization(inputs={"xas_obj": out})()
exafs_process = PyMca_exafs(inputs={"xas_obj": out})
exafs_process.setConfiguration(configuration=self.exafs_configuration)
out = exafs_process(xas_obj=out)
kweight_process = PyMca_k_weight()
kweight_process = PyMca_k_weight(inputs={"xas_obj": out})
kweight_process.setConfiguration({"k_weight": 0})
out = kweight_process(xas_obj=out)
out = PyMca_ft()(xas_obj=out)
out = kweight_process()
out = PyMca_ft(inputs={"xas_obj": out})()
assert isinstance(out, XASObject)
self.assertTrue(out.spectra.data.flat[0].ft is not None)
self.assertTrue(len(out.spectra.data.flat[0].ft.intensity) > 0)
......@@ -175,8 +175,8 @@ class TestWorkflowAndH5LinkedFile(unittest.TestCase):
def test_h5_link_xas_object(self):
"""Test that the processing can be stored continuously on a .h5 file"""
self.assertTrue(self.xas_obj.linked_h5_file is not None)
out = PyMca_normalization()(xas_obj=self.xas_obj)
exafs_process = PyMca_exafs()
out = PyMca_normalization(inputs={"xas_obj": self.xas_obj})()
exafs_process = PyMca_exafs(inputs={"xas_obj": out})
configuration = {
"Knots": {"Values": (1, 2, 5), "Number": 3, "Orders": [3, 3, 3]},
"KMin": 0,
......@@ -184,11 +184,11 @@ class TestWorkflowAndH5LinkedFile(unittest.TestCase):
}
exafs_process.setConfiguration(configuration=configuration)
out = exafs_process(xas_obj=out)
k_weight_process = PyMca_k_weight()
k_weight_process = PyMca_k_weight(inputs={"xas_obj": out})
k_weight_process.setConfiguration({"k_weight": 0})
out = k_weight_process(xas_obj=out)
out = PyMca_ft()(xas_obj=out)
out = PyMca_normalization()(xas_obj=out)
out = PyMca_ft(inputs={"xas_obj": out})()
out = PyMca_normalization(inputs={"xas_obj": out})(xas_obj=out)
assert isinstance(out, XASObject)
assert out.linked_h5_file is self.h5_file
# then check all process are correctly registered with the valid id...
......@@ -209,20 +209,20 @@ class TestWorkflowAndH5LinkedFile(unittest.TestCase):
"""Same test as test_h5_link_xas_object but with a dict pass between
processes"""
self.assertTrue(self.xas_obj.linked_h5_file is not None)
out = PyMca_normalization()(xas_obj=self.xas_obj.to_dict())
exafs_process = PyMca_exafs()
out = PyMca_normalization(inputs={"xas_obj": self.xas_obj.to_dict()})()
exafs_process = PyMca_exafs(inputs={"xas_obj": out})
configuration = {
"Knots": {"Values": (1, 2, 5), "Number": 3, "Orders": [3, 3, 3]},
"KMin": 0,
"KMax": 2.3,
}
exafs_process.setConfiguration(configuration=configuration)
out = exafs_process(xas_obj=out.to_dict())
k_weight_process = PyMca_k_weight()
out = exafs_process()
k_weight_process = PyMca_k_weight(inputs={"xas_obj": out})
k_weight_process.setConfiguration({"k_weight": 0})
out = k_weight_process(xas_obj=out.to_dict())
out = PyMca_ft()(xas_obj=out.to_dict())
out = PyMca_normalization()(xas_obj=out.to_dict())
out = PyMca_ft(inputs={"xas_obj": out.to_dict()})()
out = PyMca_normalization(inputs={"xas_obj": out.to_dict()})()
assert isinstance(out, XASObject)
assert out.linked_h5_file
assert out.linked_h5_file == self.h5_file
......@@ -261,20 +261,20 @@ class TestSaveFlowAuto(unittest.TestCase):
def test(self):
self.assertTrue(self.xas_obj.linked_h5_file is not None)
out = PyMca_normalization()(xas_obj=self.xas_obj)
exafs = PyMca_exafs()
out = PyMca_normalization(inputs={"xas_obj": self.xas_obj})()
exafs = PyMca_exafs(inputs={"xas_obj": out})
configuration = {
"Knots": {"Values": (1, 2, 5), "Number": 3, "Orders": [3, 3, 3]},
"KMin": 0,
"KMax": 2.3,
}
exafs.setConfiguration(configuration)
out = exafs(xas_obj=out)
kweight_process = PyMca_k_weight()
out = exafs()
kweight_process = PyMca_k_weight(inputs={"xas_obj": out})
kweight_process.setConfiguration({"k_weight": 0})
out = kweight_process(xas_obj=out)
out = PyMca_ft()(xas_obj=out)
out = PyMca_normalization()(xas_obj=out)
out = kweight_process()
out = PyMca_ft(inputs={"xas_obj": out})()
out = PyMca_normalization(inputs={"xas_obj": out})()
writer = XASWriter()
writer.output_file = self.h5_file
......
......@@ -92,15 +92,15 @@ class TestMeldWorkflow(unittest.TestCase):
"""
self.xas_obj.configuration = {"EXAFS": self.configuration_exafs}
# pymca normalization
out = PyMca_normalization()(xas_obj=self.xas_obj)
out = PyMca_normalization(inputs={"xas_obj": self.xas_obj})()
# larch autobk
out = Larch_autobk()(xas_obj=out)
out = Larch_autobk(inputs={"xas_obj": out}).run()
# k weight
kweight_process = PyMca_k_weight()
kweight_process = PyMca_k_weight(inputs={"xas_obj": out})
kweight_process.setConfiguration({"k_weight": 0})
out = kweight_process(xas_obj=out)
out = kweight_process()
# pymca ft
out = PyMca_ft()(xas_obj=out)
out = PyMca_ft(inputs={"xas_obj": out})()
self.assertTrue(out.spectra.data.flat[0].ft.intensity is not None)
self.assertTrue(len(out.spectra.data.flat[0].ft.intensity) > 1)
......@@ -110,12 +110,12 @@ class TestMeldWorkflow(unittest.TestCase):
larch pre_edge -> pymca exafs -> larch xftf
"""
# larch pre edge
out = Larch_pre_edge()(self.xas_obj)
out = Larch_pre_edge(inputs={"xas_obj": self.xas_obj}).run()
# pymca exafs
exafs = PyMca_exafs()
exafs = PyMca_exafs(inputs={"xas_obj": out})
exafs.setConfiguration(self.configuration_exafs)
out = exafs(xas_obj=out)
out = exafs()
# for now we cannot link xftf because chi is not set by pymca exafs
spectrum_0 = out.spectra.data.flat[0]
self.assertFalse(spectrum_0["EXAFSSignal"] is None)
......@@ -123,7 +123,7 @@ class TestMeldWorkflow(unittest.TestCase):
self.assertFalse(spectrum_0.chi is None)
self.assertFalse(spectrum_0.k is None)
# larch xftf
out = Larch_xftf()(xas_obj=out)
out = Larch_xftf(inputs={"xas_obj": out})()
writer = XASWriter()
writer.output_file = self.h5_file
......
......@@ -74,8 +74,8 @@ class TestWriteProcess(unittest.TestCase):
def testProcess(self):
self.assertTrue(self.spectrum.pre_edge is None)
self.assertTrue(self.spectrum.e0 is None)
process = Larch_pre_edge()
process.process(self.xas_obj)
process = Larch_pre_edge(inputs={"xas_obj": self.xas_obj})
process.run()
self.assertTrue(self.spectrum.pre_edge is not None)
self.assertTrue(self.spectrum.e0 is not None)
# check process
......
Markdown is supported
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