diff --git a/src/napari_stress/_reconstruction/fit_utils.py b/src/napari_stress/_reconstruction/fit_utils.py index 2e03dae5..7c37e73c 100644 --- a/src/napari_stress/_reconstruction/fit_utils.py +++ b/src/napari_stress/_reconstruction/fit_utils.py @@ -183,7 +183,7 @@ def _fancy_edge_fit( DESCRIPTION. """ params = _function_args_to_list(selected_edge_func)[1:] - array = [x for x in array if not np.isnan(x)] # filter out nans + array = array[~np.isnan(array)] # filter out nans try: if selected_edge_func == _sigmoid: # estimate parameters and trim intensity array @@ -252,8 +252,7 @@ def estimate_fit_parameters(intensity): """ # Check if there are too few points if len(intensity) < 5: - print("Warning: Too few points in trace (length < 5)") - return [np.nan] * 5, intensity, intensity + raise ValueError("Warning: Too few points in trace (length < 5)") # Calculate the first derivative (dY) dY = 0.5 * (