diff --git a/src/gui_qt/main/management.py b/src/gui_qt/main/management.py index d334930..56c387a 100644 --- a/src/gui_qt/main/management.py +++ b/src/gui_qt/main/management.py @@ -543,7 +543,7 @@ class UpperManagement(QtCore.QObject): else: d = fit_d.Data(_x[inside], _y[inside], we=we[inside], idx=set_id, complex_type=data_complex) except Exception as e: - raise Exception(f'Setting data failed for {set_id}') + raise Exception(f'Setting data failed for {data_i.name}') from e d.set_model(m) try: @@ -559,7 +559,7 @@ class UpperManagement(QtCore.QObject): return True except Exception as e: - logger.error('Fit preparation failed', *e.args) + logger.error(f'Fit preparation failed with error: {e.args}') QtWidgets.QMessageBox.warning(QtWidgets.QWidget(), 'Fit prep failed', f'Fit preparation failed:\n' diff --git a/src/nmreval/fit/data.py b/src/nmreval/fit/data.py index b6b94ff..7b39aa2 100644 --- a/src/nmreval/fit/data.py +++ b/src/nmreval/fit/data.py @@ -10,6 +10,9 @@ class Data: def __init__(self, x, y, we=None, idx=None, complex_type: int = 0): self.x = np.asarray(x) self.y = np.asarray(y) + if self.x.size == 0 or self.y.size == 0: + raise ValueError("Data is empty") + if self.y.shape[0] != self.x.shape[0]: raise ValueError(f'x and y have different lengths {self.x.shape[0]} and {self.y.shape[0]}')