Skip to content

Commit

Permalink
Add timing for minimization
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSazonov committed Sep 16, 2024
1 parent d20c17c commit 309a5f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 12 additions & 5 deletions easyDiffractionApp/Logic/Fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import copy
import lmfit
import numpy as np
from funcy import print_durations

from PySide6.QtCore import QObject, Signal, Slot, Property, QThreadPool

Expand Down Expand Up @@ -202,15 +203,21 @@ def runLmfit(self):

tol = self._proxy.fitting.minimizerTol
method = self._proxy.fitting.minimizerMethod.lower()

@print_durations()
def minimize(method=method, **kwargs):
result = mini.minimize(method=method, **kwargs)
return result

if method in ['leastsq', 'least_squares']:
self._iterStart == -1
result = mini.minimize(method=method,
ftol=tol,
xtol=tol)
result = minimize(method=method,
ftol=tol,
xtol=tol)
elif method in ['bfgs', 'lbfgsb', 'l-bfgs-b']:
self._iterStart == 1
result = mini.minimize(method=method,
tol=tol)
result = minimize(method=method,
tol=tol)
else:
self.finished.emit()
console.error(f'Optimization method {method} is not supported.')
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies = [
'scipy<1.14',
'lmfit',
'orjson',
'funcy',
'cryspy @ git+https://github.com/ikibalin/cryspy.git@beta',
'EasyApp @ git+https://github.com/easyscience/EasyApp.git@new-easy-app2'
]
Expand Down

0 comments on commit 309a5f8

Please sign in to comment.