refactor(exafs-scan): improve docstring and logmessage

This commit is contained in:
2025-06-03 17:31:30 +02:00
parent b05f0a6621
commit 0bc35466aa

View File

@@ -65,18 +65,27 @@ class EXAFSScan(ScanBase):
def _check_and_upated_input_arguments(self) -> None:
"""
If any of xas_rel_range, n_points, k_step or integ_time is None,
this method will compute to a default behaviour for the value.
Input parameters for the EXAFS scan must be of the same length for n_points, k_step, integ_time
and xas_rel_range (-1). This methods checks for this condition, and calculates the integration time
for each point in the scan. If the input parameters are not provided with the correct length,
it raises a ValueError which indicates which parameters are not matching.
"""
if not all(
[
len(self.n_points) == len(self.k_step),
len(self.n_points) == len(self.integ_time),
len(self.n_points) == (len(self.xas_rel_range) - 1), # carefule -1
len(self.n_points) == (len(self.xas_rel_range) - 1), # careful -1
]
):
raise ValueError("Wrong length for bla") # TODO add better error handling
raise ValueError(
f"Input parameters must have matching lengths:\n"
f"n_points: {len(self.n_points)}, "
f"k_step: {len(self.k_step)}, expected: {len(self.n_points)}, "
f"integ_time: {len(self.integ_time)}, expected: {len(self.n_points)}, "
f"xas_rel_range: {len(self.xas_rel_range)}, expected: {len(self.n_points)-1} "
)
self.integ_time = np.repeat(np.array(self.integ_time), np.array(self.n_points))
def _set_position_offset(self):