Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolaCourtier committed Aug 22, 2024
1 parent f71693c commit acd00a4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
31 changes: 0 additions & 31 deletions pybop/costs/design_costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,6 @@ def __init__(self, problem):
"""
super().__init__(problem)
self.problem = problem
if update_capacity is True:
nominal_capacity_warning = (
"The nominal capacity is approximated for each iteration."
)
else:
nominal_capacity_warning = (
"The nominal capacity is fixed at the initial model value."
)
warnings.warn(nominal_capacity_warning, UserWarning, stacklevel=2)
self.update_capacity = update_capacity
self.parameter_set = problem.model.parameter_set
self.update_simulation_data(self.parameters.as_dict("initial"))

def update_simulation_data(self, inputs: Inputs):
"""
Updates the simulation data based on the initial parameter values.
Parameters
----------
inputs : Inputs
The initial parameter values for the simulation.
"""
if self.update_capacity:
self.problem.model.approximate_capacity(inputs)
solution = self.problem.evaluate(inputs)

if "Time [s]" not in solution:
raise ValueError("The solution does not contain time data.")
self.problem.domain_data = solution["Time [s]"]
self.problem.target = {key: solution[key] for key in self.problem.signal}
self.dt = solution["Time [s]"][1] - solution["Time [s]"][0]


class GravimetricEnergyDensity(DesignCost):
Expand Down
2 changes: 1 addition & 1 deletion pybop/problems/base_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def set_target(self, dataset: Dataset):
if not isinstance(dataset, Dataset):
raise ValueError("Dataset must be a pybop Dataset object.")

self._time_data = dataset["Time [s]"]
self._domain_data = dataset[self.domain]
self._target = {signal: dataset[signal] for signal in self.signal}

@property
Expand Down

0 comments on commit acd00a4

Please sign in to comment.