catch empty sets before fit
This commit is contained in:
		| @@ -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' | ||||
|   | ||||
| @@ -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]}') | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user