Commit 0c4a0ecb authored by payno's avatar payno
Browse files

[xftf] add management of rmax for ft

parent 39ce0f6e
Pipeline #40713 failed with stages
in 6 minutes and 41 seconds
......@@ -97,7 +97,6 @@ def process_spectr_xftf(
"rmax_out",
"nfft",
"kstep",
"r_max",
):
if opt_name in _conf:
opts[opt_name] = _conf[opt_name]
......@@ -110,17 +109,29 @@ def process_spectr_xftf(
else:
_spectrum = Spectrum().load_frm_dict(spectrum.to_dict())
xftf(_spectrum, **opts)
# handle chi(x) * k**k_weight plot with r max
if hasattr(_spectrum, "k") and hasattr(_spectrum, "chi"):
if "kweight" in opts:
kweight = opts["kweight"]
else:
kweight = 0
if "rmax" in opts and opts["rmax"] is not None:
mask = spectrum.k < opts["rmax"]
if (
"_plot_chi_k_weighted_r_max" in _conf
and _conf["_plot_chi_k_weighted_r_max"] is not None
):
mask = spectrum.k < _conf["_plot_chi_k_weighted_r_max"]
else:
mask = numpy.ones_like(spectrum.k).astype(numpy.bool)
_spectrum.masked_chi_weighted_k = spectrum.chi[mask] * (spectrum.k[mask] ** kweight)
_spectrum.masked_k = spectrum.k[mask]
# handle ft plot with r max
if hasattr(_spectrum, "r") and hasattr(_spectrum, "chir_mag"):
if "_plot_chi_mag_r_max" in _conf and _conf["_plot_chi_mag_r_max"] is not None:
mask = spectrum.r < _conf["_plot_chi_mag_r_max"]
else:
mask = numpy.ones_like(spectrum.r).astype(numpy.bool)
_spectrum.masked_chir_mag = spectrum.chir_mag[mask]
_spectrum.masked_r = spectrum.r[mask]
if callbacks:
for callback in callbacks:
......@@ -156,10 +167,13 @@ class Larch_xftf(Process):
def __init__(self):
Process.__init__(self, name="xftf")
self._plot_settings = {}
def set_properties(self, properties):
if "_larchSettings" in properties:
self._settings = properties["_larchSettings"]
if "plot_settings" in properties:
self._plot_settings = properties["plot_settings"]
def process(self, xas_obj):
_xas_obj = self.getXasObject(xas_obj=xas_obj)
......@@ -178,7 +192,10 @@ class Larch_xftf(Process):
_NexusDatasetDef("chir_im", "{}^(-3)".format(ANGSTROM_CHAR)),
_NexusDatasetDef("chir_re"),
_NexusDatasetDef("chir_mag", "{}^(-3)".format(ANGSTROM_CHAR)),
_NexusDatasetDef("masked_chir_mag", "{}".format(ANGSTROM_CHAR)),
_NexusDatasetDef("r", "{}".format(ANGSTROM_CHAR)),
_NexusDatasetDef("masked_r", "{}".format(ANGSTROM_CHAR)),
_NexusDatasetDef("k", "{}^(-1)".format(ANGSTROM_CHAR)),
_NexusDatasetDef("masked_k", "{}^(-1)".format(ANGSTROM_CHAR)),
_NexusDatasetDef(
"masked_chi_weighted_k", "{}^(-2)".format(ANGSTROM_CHAR)
......@@ -192,8 +209,8 @@ class Larch_xftf(Process):
silx_style={"signal_scale_type": "linear"},
),
_NexusSpectrumDef(
signal="chir_mag",
axes=("r",),
signal="masked_chir_mag",
axes=("masked_r",),
auxiliary_signals=None,
silx_style={"signal_scale_type": "linear"},
),
......
......@@ -276,6 +276,9 @@ class Process(object):
elif key in ("chir_re", "chir_im", "chir_mag", "r"):
relative_to = "r"
use = "map_to"
elif key in ("masked_chir_mag", "masked_r"):
relative_to = "masked_r"
use = "map_to"
elif key in ("ft.radius", "ft.intensity", "ft.imaginary"):
relative_to = "radius"
use = "_list_res_ft"
......
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