Commit db657de7 authored by payno's avatar payno
Browse files

[spectra] fix: replace some _spectra_volume to Spectra.map_to

parent 190f4842
......@@ -167,8 +167,7 @@ class Process(object):
if use == "_spectra_volume":
# if we can display the result as a numpy.array 3d
try:
_data[key] = XASObject._spectra_volume(
xas_obj.spectra,
_data[key] = xas_obj.spectra.map_to(
key=key,
relative_to=relative_to,
)
......
......@@ -297,16 +297,7 @@ class XASObject(object):
return res
def absorbed_beam(self) -> numpy.ndarray:
return XASObject._spectra_volume(
spectra=self.spectra,
key="mu",
)
@staticmethod
def _spectra_volume(spectra: Spectra, key: str, relative_to: str = "energy"):
"""Convert a list of spectra (mu) to a numpy array.
..note: only convert raw data for now"""
return spectra.map_to(key=key, relative_to=relative_to)
return self.spectra.map_to(key="mu")
def load_frm_dict(self, ddict: dict):
"""load XAS values from a dict"""
......
......@@ -242,7 +242,6 @@ class MapViewer(qt.QWidget):
return
# set the map view
spectra_volume = self._xasObj.spectra.map_to(
spectra=self._xasObj.spectra,
key=self.getActiveKey(),
)
self._mainWindow.setStack(spectra_volume)
......@@ -463,9 +462,7 @@ def _plot_norm(obj, **kwargs):
if isinstance(obj, XASObject):
assert "index" in kwargs
index_dim1 = kwargs["index"]
spectra = XASObject._spectra_volume(
obj.spectra, "normalized_mu", obj.dim1, obj.dim2, relative_to="energy"
)
spectra = obj.spectra.map_to("normalized_mu", relative_to="energy")
spectra = spectra[:, index_dim1, :]
mean = numpy.mean(spectra, axis=1)
std = numpy.std(spectra, axis=1)
......@@ -557,9 +554,7 @@ def _plot_raw(obj, **kwargs):
elif isinstance(obj, XASObject):
assert "index" in kwargs
index_dim1 = kwargs["index"]
spectra = XASObject._spectra_volume(
obj.spectra, "normalized_mu", obj.dim1, obj.dim2, relative_to="energy"
)
spectra = obj.spectra.map_to("normalized_mu", relative_to="energy")
spectra = spectra[:, index_dim1, :]
mean = numpy.mean(spectra, axis=1)
std = numpy.std(spectra, axis=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