File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,9 @@ def _process_protein_impl(
341
341
model , params = build_model (profile , peaks )
342
342
result = model .fit (profile , params , x = x , weights = weights )
343
343
344
+ latest_result = result
345
+ latest_peaks = peaks
346
+
344
347
# add more peaks if needed
345
348
while len (peaks ) < 12 :
346
349
# area above 'best fit' line
@@ -390,15 +393,16 @@ def _process_protein_impl(
390
393
391
394
# add additional peak
392
395
# print("Adding additional peak at", best_new_peak_index)
393
- new_peaks = np .append (peaks , best_new_peak_index )
396
+ peaks = np .append (peaks , best_new_peak_index )
394
397
model , params = build_model (profile , peaks )
395
- new_result = model .fit (profile , params , x = x , weights = weights )
398
+ result = model .fit (profile , params , x = x , weights = weights )
396
399
397
- if not new_result .success :
398
- break
400
+ if result .success :
401
+ latest_result = result
402
+ latest_peaks = peaks
399
403
400
- result = new_result
401
- peaks = new_peaks
404
+ result = latest_result
405
+ peaks = latest_peaks
402
406
403
407
if not result .success :
404
408
raise ValueError (f"Fit aborted: { result .message } " )
You can’t perform that action at this time.
0 commit comments