-
Notifications
You must be signed in to change notification settings - Fork 2
minimizer consolidation #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
parameters[parameter_name] = item.raw_value | ||
return parameters | ||
|
||
def _generate_fit_function(self) -> Callable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetched from bumps / dfo
return _fit_function | ||
|
||
@staticmethod | ||
def _create_signature(parameters: Dict[int, Parameter]) -> Signature: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetched from bumps / lmfit
|
||
lm_fit_function.__signature__ = self._wrap_to_lm_signature(self._cached_pars) | ||
return lm_fit_function | ||
def available_methods(self) -> List[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public method moved to top
""" | ||
super().__init__(obj=obj, fit_function=fit_function, method=method) | ||
|
||
def _make_model(self, pars: Optional[LMParameters] = None) -> LMModel: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private method moved down
assert str(domain_fit_results.minimizer_engine) == "<class 'easyscience.fitting.minimizers.minimizer_lmfit.LMFit'>" | ||
assert domain_fit_results.fit_args is None | ||
|
||
def test_wrap_to_lm_signature(self, minimizer: LMFit) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now tested in minimizer_base
] | ||
|
||
@staticmethod | ||
def _wrap_to_lm_signature(parameters: Dict[int, Parameter]) -> Signature: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now in minimizer_base
assert mock_lm_model.set_param_hint.call_count == 2 | ||
assert model == mock_lm_model | ||
|
||
def test_generate_fit_function_signatur(self, minimizer: LMFit) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now tested in minimizer_base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly done refactoring, one minor question raised.
Ready to merge.
PR related fixes ruff, be quiet. renamed Job->job directory name 38 add tests for minimizer bumps (easyscience#41) * tests and adjustments * handling circular dependency * Updated minimizer names * Made ruff happy * pr response * more consistent usage of enum --------- Co-authored-by: henrikjacobsenfys <henrik.jacobsen.fys@gmail.com> removed unnecessary empty line minimizer consolidation (easyscience#45) * minimizer consolidation * pr response
Moved duplicated functionality to base class.
Tests are moved to module for base class.
minimizer_lmfit
moved public methods to the top of the file.