Commit 5f9df6b8 authored by payno's avatar payno
Browse files

black format

parent 72c2e5c4
Pipeline #40547 passed with stages
in 8 minutes and 33 seconds
......@@ -167,12 +167,16 @@ class Larch_pre_edge(Process):
# "I2"
),
plots=(
_NexusSpectrumDef(signal="Mu", axes=("energy",), auxiliary_signals=None),
_NexusSpectrumDef(
signal="Mu", axes=("energy",), auxiliary_signals=None
),
# _plot_definition(signal="energy", axes="mu", auxiliary_signal="I0, I1, I2"),
# _plot_definition(signal="energy", axes="mu",
# auxiliary_signal="mu_ref"),
_NexusSpectrumDef(signal="flat", axes=("energy",), auxiliary_signals=None),
)
_NexusSpectrumDef(
signal="flat", axes=("energy",), auxiliary_signals=None
),
),
)
return _xas_obj
......
......@@ -97,7 +97,6 @@ def process_noise_savgol(
else:
e_max = configuration["e_max"]
if e_min is None:
e_min = spectrum.energy.min() - 1
if e_max is None:
......@@ -105,9 +104,7 @@ def process_noise_savgol(
mask = (spectrum.energy > e_min) & (spectrum.energy < (e_max))
noise_savgol_energy = spectrum.energy[mask]
raw_mu = spectrum.mu[mask]
smooth_spectrum = scipy.signal.savgol_filter(
raw_mu, window_size, polynomial_order
)
smooth_spectrum = scipy.signal.savgol_filter(raw_mu, window_size, polynomial_order)
noise = numpy.absolute(raw_mu - smooth_spectrum)
spectrum.noise_savgol = noise
if hasattr(spectrum, "edge_step"):
......
......@@ -45,6 +45,7 @@ _output_desc = namedtuple("_output_desc", ["name", "type", "doc"])
class _NexusSpectrumDef:
"""Util function to define a Nexus plot"""
def __init__(self, signal, axes, auxiliary_signals):
self.__signal = None
self.__axes = None
......@@ -167,8 +168,9 @@ class Process(object):
self._settings = configuration
def register_process(self, xas_obj: XASObject, data_keys: Iterable,
plots: Iterable = tuple()):
def register_process(
self, xas_obj: XASObject, data_keys: Iterable, plots: Iterable = tuple()
):
"""
Store the current process in the linked h5 file if any,
output data stored will be the one defined by the data_keys
......@@ -241,8 +243,7 @@ class Process(object):
_data[key] = res
else:
raise ValueError()
xas_obj.register_processing(process=self, results=_data,
plots=plots)
xas_obj.register_processing(process=self, results=_data, plots=plots)
def addCallback(self, callback):
self._callbacks.append(callback)
......@@ -472,6 +472,8 @@ class Spectrum(_Spectrum_Base):
self.__x = x
self.__y = y
# def formula_results(self, formula):
class _FT(object):
......
......@@ -417,7 +417,9 @@ def write_xas_proc(
elif dataset_to_link.ndim == 3:
plot_group[name] = dataset_to_link[:, 0, 0]
else:
raise ValueError("Unable to handle dataset {}".format(dataset_to_link.name))
raise ValueError(
"Unable to handle dataset {}".format(dataset_to_link.name)
)
# handle signal
# plot is only handling 1D data
......@@ -438,7 +440,7 @@ def write_xas_proc(
# save plots
for i_plot, plot in enumerate(plots):
print('try to create plot', plot)
print("try to create plot", plot)
plot_name = "plot_{}".format(i_plot)
save_plot(plot_name=plot_name, plot=plot)
......
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