Skip to content
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

Fix tests due to function name changes #156

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions kliff/calculators/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ def get_num_opt_params(self) -> int:
"""
return self.model.get_num_opt_params()

def has_opt_params_bounds(self):
def opt_params_has_bounds(self):
"""
Return a bool to indicate whether there are parameters whose bounds are
provided.
"""
return self.model.has_opt_params_bounds()
return self.model.opt_params_has_bounds()

def get_opt_params_bounds(self):
"""
Expand All @@ -267,7 +267,7 @@ def get_opt_params_bounds(self):
:meth:`get_opt_params`. ``None`` for ``lower`` or ``upper`` means that no bound
should be applied.
"""
return self.model.get_opt_params_bounds()
return self.model.get_formatted_param_bounds()

def update_model_params(self, opt_params: List[float]):
"""
Expand Down Expand Up @@ -373,7 +373,7 @@ def get_calculator_list(self):
calc_list.extend([calc] * N)
return calc_list

def has_opt_params_bounds(self) -> bool:
def opt_params_has_bounds(self) -> bool:
"""
Return a boolean to indicate whether there are parameters whose bounds are
provided.
Expand All @@ -383,7 +383,7 @@ def has_opt_params_bounds(self) -> bool:
"""
calc_list = self._calculators
has_opt_params_bounds_per_calc = [
calc.model.has_opt_params_bounds() for calc in calc_list
calc.model.opt_params_has_bounds() for calc in calc_list
]
return all(has_opt_params_bounds_per_calc)

Expand Down
4 changes: 2 additions & 2 deletions kliff/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _adjust_kwargs(self, method, **kwargs):
)

# adjust bounds
if self.calculator.has_opt_params_bounds():
if self.calculator.opt_params_has_bounds():
if method in ["trf", "dogbox"]:
bounds = self.calculator.get_opt_params_bounds()
lb = [b[0] if b[0] is not None else -np.inf for b in bounds]
Expand All @@ -356,7 +356,7 @@ def _adjust_kwargs(self, method, **kwargs):
else:
calculators = [self.calculator]
for calc in calculators:
if calc.has_opt_params_bounds():
if calc.opt_params_has_bounds():
if method in ["L-BFGS-B", "TNC", "SLSQP"]:
bounds = self.calculator.get_opt_params_bounds()
kwargs["bounds"] = bounds
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def create_all_possible_input(v):
#
# bounds = [[i - 0.1, i + 0.1] for i in x0]
# assert np.array_equal(op.get_opt_params_bounds(), bounds)
# assert op.has_opt_params_bounds() == True
# assert op.opt_params_has_bounds() == True
#
# import sys
#
Expand Down
Loading