Commit ee96302d authored by payno's avatar payno
Browse files

[test] provide column name when requested.

parent 452628eb
......@@ -63,7 +63,7 @@ class TestWorkflowFromOwsFile(unittest.TestCase):
"""Test regarding the instantiation of the pymcaXAS"""
exec_(
scheme=OwsParser.scheme_load(self.orange_file, load_handlers=True),
spec_input=self.input_file1,
spec_input=(self.input_file1, "Column 1", "Column 2", None, None),
output_=self.output_file,
)
self.assertTrue(os.path.exists(self.output_file))
......
......@@ -70,7 +70,10 @@ class TestReprocessingPyMca(unittest.TestCase):
def setUp(self):
self.output_dir = tempfile.mkdtemp()
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
energy, mu = read_spectrum(data_file, dimensions=(Dim.DIM_0, Dim.DIM_1))
energy, mu = read_spectrum(data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
self.spectrum = Spectrum(energy=energy, mu=mu)
self.xas_obj_ref = XASObject(
spectra=(self.spectrum,), energy=energy, dim1=1, dim2=1
......
......@@ -51,7 +51,10 @@ class TestEXAFSSingleSpectrum(unittest.TestCase):
def setUp(self):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
energy, mu = read_spectrum(data_file, dimensions=(Dim.DIM_0, Dim.DIM_1))
energy, mu = read_spectrum(data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
spectrum = Spectrum(energy=energy, mu=mu)
exafs_configuration = {"Knots": {"Values": (1, 2, 5), "Number": 3}}
configuration = {"EXAFS": exafs_configuration}
......
......@@ -52,7 +52,10 @@ class TestFTSingleSpectrum(unittest.TestCase):
def setUp(self):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
energy, mu = read_spectrum(data_file, dimensions=(Dim.DIM_0, Dim.DIM_1))
energy, mu = read_spectrum(data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
self.spectrum = Spectrum(energy=energy, mu=mu)
self.xas_obj = XASObject(
energy=energy, spectra=(self.spectrum,), dim1=1, dim2=1
......
......@@ -62,9 +62,10 @@ class TestReadWrite(unittest.TestCase):
def testReadSpectrum(self):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
res = read_xas(
spectra_url=DataUrl(file_path=data_file, scheme="PyMca"),
channel_url=DataUrl(file_path=data_file, scheme="PyMca"),
dimensions=(Dim.DIM_2, Dim.DIM_0, Dim.DIM_1),
spectra_url=DataUrl(file_path=data_file, scheme="PyMca",
data_path="Column 1"),
channel_url=DataUrl(file_path=data_file, scheme="PyMca",
data_path="Column 2"),
)
self.assertTrue(isinstance(res, XASObject))
self.assertEqual(res.n_spectrum, 1)
......
......@@ -56,7 +56,10 @@ class TestKWeightSingleSpectrum(unittest.TestCase):
}
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
energy, mu = read_spectrum(data_file, dimensions=(Dim.DIM_0, Dim.DIM_1))
energy, mu = read_spectrum(data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
self.spectrum = Spectrum(energy=energy, mu=mu)
self.xas_obj = XASObject(
......
......@@ -56,7 +56,10 @@ class TestNormalizationSingleSpectrum(unittest.TestCase):
def setUp(self):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
energy, mu = read_spectrum(data_file, dimensions=(Dim.DIM_0, Dim.DIM_1))
energy, mu = read_spectrum(data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
self.spectrum = Spectrum(energy=energy, mu=mu)
self.xas_obj = XASObject(
spectra=(self.spectrum,), energy=energy, dim1=1, dim2=1
......
......@@ -74,9 +74,10 @@ class TestStreamSingleSpectrum(unittest.TestCase):
def test_pymca_process(self):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
out = read_xas(
spectra_url=DataUrl(file_path=data_file, scheme="PyMca"),
channel_url=DataUrl(file_path=data_file, scheme="PyMca"),
dimensions=(Dim.DIM_2, Dim.DIM_0, Dim.DIM_1),
spectra_url=DataUrl(file_path=data_file, scheme="PyMca",
data_path="Column 2"),
channel_url=DataUrl(file_path=data_file, scheme="PyMca",
data_path="Column 1"),
)
out.configuration = {"EXAFS": self.exafs_configuration, "SET_KWEIGHT": 0}
out = pymca_normalization(xas_obj=out)
......@@ -88,9 +89,10 @@ class TestStreamSingleSpectrum(unittest.TestCase):
def test_pymca_process_with_dict(self):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
out = read_xas(
spectra_url=DataUrl(file_path=data_file, scheme="PyMca"),
channel_url=DataUrl(file_path=data_file, scheme="PyMca"),
dimensions=(Dim.DIM_2, Dim.DIM_0, Dim.DIM_1),
spectra_url=DataUrl(file_path=data_file, scheme="PyMca",
data_path="Column 2"),
channel_url=DataUrl(file_path=data_file, scheme="PyMca",
data_path="Column 1"),
)
out.configuration = {"EXAFS": self.exafs_configuration, "SET_KWEIGHT": 0}
out = pymca_normalization(xas_obj=out.to_dict())
......@@ -102,9 +104,10 @@ class TestStreamSingleSpectrum(unittest.TestCase):
def test_pymca_process_with_cls(self):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
out = read_xas(
spectra_url=DataUrl(file_path=data_file, scheme="PyMca"),
channel_url=DataUrl(file_path=data_file, scheme="PyMca"),
dimensions=(Dim.DIM_2, Dim.DIM_0, Dim.DIM_1),
spectra_url=DataUrl(file_path=data_file, scheme="PyMca",
data_path="Column 2"),
channel_url=DataUrl(file_path=data_file, scheme="PyMca",
data_path="Column 1"),
)
out = PyMca_normalization()(xas_obj=out)
exafs_process = PyMca_exafs()
......
......@@ -65,7 +65,10 @@ class TestMeldWorkflow(unittest.TestCase):
def setUp(self):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
energy, mu = read_spectrum(data_file, dimensions=(Dim.DIM_0, Dim.DIM_1))
energy, mu = read_spectrum(data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
self.spectrum = Spectrum(energy=energy, mu=mu)
self.xas_obj = XASObject(
energy=energy, spectra=(self.spectrum,), dim1=1, dim2=1
......
......@@ -61,7 +61,9 @@ class TestSpectrum(unittest.TestCase):
"""check that we can create a Spectrum from a pymca .dat file"""
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
energy, mu = read_spectrum(
data_file, dimensions=(Dim.DIM_2, Dim.DIM_0, Dim.DIM_1)
data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
spectrum = Spectrum(energy=energy, mu=mu)
self.assertTrue(spectrum.energy is not None)
......@@ -88,7 +90,9 @@ class TestXASObject(unittest.TestCase):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
spectrum = {}
spectrum["Energy"], spectrum["Mu"] = read_spectrum(
data_file, dimensions=(Dim.DIM_0, Dim.DIM_1)
data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
self.spectrum = Spectrum(energy=spectrum["Energy"], mu=spectrum["Mu"])
self.configuration = {
......
......@@ -60,7 +60,9 @@ class TestSpectra(unittest.TestCase):
"""check that we can create a Spectrum from a pymca .dat file"""
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
energy, mu = read_spectrum(
data_file, dimensions=(Dim.DIM_2, Dim.DIM_0, Dim.DIM_1)
data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
spectrum = Spectrum(energy=energy, mu=mu)
......
......@@ -52,7 +52,9 @@ class TestSpectrum(unittest.TestCase):
"""check that we can create a Spectrum from a pymca .dat file"""
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
energy, mu = read_spectrum(
data_file, dimensions=(Dim.DIM_2, Dim.DIM_0, Dim.DIM_1)
data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
spectrum = Spectrum(energy=energy, mu=mu)
self.assertTrue(spectrum.energy is not None)
......
......@@ -61,7 +61,9 @@ class TestXASObject(unittest.TestCase):
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
spectrum = {}
spectrum["Energy"], spectrum["Mu"] = read_spectrum(
data_file, dimensions=(Dim.DIM_0, Dim.DIM_1)
data_file,
energy_col_name="Column 1",
absorption_col_name="Column 2",
)
self.spectrum = Spectrum(energy=spectrum["Energy"], mu=spectrum["Mu"])
self.configuration = {
......
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