Commit 6df35132 authored by payno's avatar payno
Browse files

[spectra] remove some remaining of _spectra_volume

parent 97ffd141
Pipeline #39622 failed with stages
in 11 minutes and 18 seconds
......@@ -156,15 +156,15 @@ class Process(object):
"EXAFSSignal",
):
relative_to = "energy"
use = "_spectra_volume"
use = "map_to"
elif key in ("chir_re", "chir_im", "chir_mag", "r"):
relative_to = "r"
use = "_spectra_volume"
use = "map_to"
elif key in ("ft.radius", "ft.intensity", "ft.imaginary"):
relative_to = "radius"
use = "_list_res_ft"
if use == "_spectra_volume":
if use == "map_to":
# if we can display the result as a numpy.array 3d
try:
_data[key] = xas_obj.spectra.map_to(
......
......@@ -142,11 +142,7 @@ class ROIProcess(Process):
# there is no processing for the _larch_grp_members case
if key == "_larch_grp_members":
continue
volume = xas_obj._spectra_volume(
spectra=xas_obj.spectra,
key=key,
)
volume = xas_obj.spectra.map_to(key=key)
volume_res = volume[:, ymin:ymax, xmin:xmax]
volume_res = volume_res.reshape(volume_res.shape[0], -1)
volumes[key] = volume_res
......
......@@ -66,19 +66,13 @@ class TestRoi(unittest.TestCase):
def testApplyRoi(self):
"""Test output of the roi process"""
original_spectra = self.xas_obj._spectra_volume(
spectra=self.xas_obj.spectra,
key="mu",
).copy()
original_spectra = self.xas_obj.spectra.map_to(key="mu").copy()
self.assertEqual(original_spectra.shape, (16, 100, 30))
roi_dict = {"origin": (20, 50), "size": (10, 20)}
self.xas_obj.configuration = {"roi": roi_dict}
res_xas_obj = xas_roi(self.xas_obj)
self.assertEqual(res_xas_obj.n_spectrum, 20 * 10)
reduces_spectra = res_xas_obj._spectra_volume(
spectra=res_xas_obj.spectra,
key="mu",
).copy()
reduces_spectra = res_xas_obj.spectra.map_to(key="mu").copy()
assert reduces_spectra.shape == (16, 20, 10)
numpy.testing.assert_array_equal(
original_spectra[:, 50:70, 20:30], reduces_spectra
......
......@@ -142,10 +142,7 @@ class TestXASObject(unittest.TestCase):
)
obj2 = XASObject.from_dict(ddict)
self.assertEqual(self.xas_obj.n_spectrum, obj2.n_spectrum)
obj2_mu_spectra = obj2._spectra_volume(
spectra=obj2.spectra,
key="mu",
)
obj2_mu_spectra = obj2.spectra.map_to(key="mu")
numpy.testing.assert_array_equal(original_spectra, obj2_mu_spectra)
self.assertEqual(obj2, self.xas_obj)
......
......@@ -113,10 +113,7 @@ class TestXASObject(unittest.TestCase):
)
obj2 = XASObject.from_dict(ddict)
self.assertEqual(self.xas_obj.n_spectrum, obj2.n_spectrum)
obj2_mu_spectra = obj2._spectra_volume(
spectra=obj2.spectra,
key="mu",
)
obj2_mu_spectra = obj2.spectra(key="mu")
numpy.testing.assert_array_equal(original_spectra, obj2_mu_spectra)
self.assertEqual(obj2, self.xas_obj)
......
......@@ -202,12 +202,7 @@ class E0Calculator(qt.QMainWindow):
return
if self.getComputationScale() == _ComputationScale.ALL:
data = self._xas_obj._spectra_volume(
self._xas_obj.spectra,
"mu",
dim_1=self._xas_obj.dim1,
dim_2=self._xas_obj.dim2,
)
data = self._xas_obj.spectra.map_to("mu")
else:
data = self._muView.getActiveImage(just_legend=False).getData()
......
......@@ -60,9 +60,7 @@ class Converter(object):
)
# TODO: prendre normalized_mu and normalized_energy if exists,
# otherwise take mu and energy...
spectra = XASObject._spectra_volume(
xas_object.spectra, key="mu", dim_1=xas_object.dim1, dim_2=xas_object.dim2
)
spectra = xas_object.spectra.map_to(key="mu")
# invert dimensions and axis to fit spectroscopy add-on
X = spectra.reshape((spectra.shape[0], -1))
X = numpy.swapaxes(X, 0, 1)
......
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