Skip to content

Commit e17b549

Browse files
Akhil-Sharma30pre-commit-ci[bot]kratman
authored
[Bug]: pybamm.Simulation.set_parameters and pybamm.Simulation.set_up_and_parameterise_experiment made private in simulation.py (#4489)
* Fix: Add deprecated warning for `set_up_and_parameterise_model_for_experiment` in simulation * Add deprecated warning for `set_parameters` in simulation * Docs: Add deprecated message in unreleased section * style: pre-commit fixes * Docs: Move deprecated to Breaking changes section * Fix: Make set_up_and_parameterise_experiment private * Fix: Make set_paramters func private * Refactor: Add deprecation warning message in set_parameters() func * Refactor: Add deprecation warning in `set_up_and_parameterise_experiment` func * Fix some typos --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Eric G. Kratz <[email protected]> Co-authored-by: kratman <[email protected]>
1 parent 6dfa38e commit e17b549

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
## Breaking changes
3535

36+
- Deprecated `pybamm.Simulation.set_parameters` and `pybamm.Simulation. set_up_and_parameterise_experiment` functions in `pybamm.simulation.py`. ([#3752](https://github.com/pybamm-team/PyBaMM/pull/3752))
3637
- Removed all instances of `param = self.param` and now directly access `self.param` across the codebase. This change simplifies parameter references and enhances readability. ([#4484](https://github.com/pybamm-team/PyBaMM/pull/4494))
3738
- Removed the deprecation warning for the chemistry argument in
3839
ParameterValues ([#4466](https://github.com/pybamm-team/PyBaMM/pull/4466))

src/pybamm/simulation.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ def _set_random_seed(self):
176176
)
177177

178178
def set_up_and_parameterise_experiment(self, solve_kwargs=None):
179+
msg = "pybamm.simulation.set_up_and_parameterise_experiment is deprecated and not meant to be accessed by users."
180+
warnings.warn(msg, DeprecationWarning, stacklevel=2)
181+
self._set_up_and_parameterise_experiment(solve_kwargs=solve_kwargs)
182+
183+
def _set_up_and_parameterise_experiment(self, solve_kwargs=None):
179184
"""
180185
Create and parameterise the models for each step in the experiment.
181186
@@ -254,10 +259,16 @@ def set_up_and_parameterise_experiment(self, solve_kwargs=None):
254259
)
255260

256261
def set_parameters(self):
262+
msg = (
263+
"pybamm.set_parameters is deprecated and not meant to be accessed by users."
264+
)
265+
warnings.warn(msg, DeprecationWarning, stacklevel=2)
266+
self._set_parameters()
267+
268+
def _set_parameters(self):
257269
"""
258270
A method to set the parameters in the model and the associated geometry.
259271
"""
260-
261272
if self._model_with_set_params:
262273
return
263274

@@ -355,7 +366,7 @@ def build_for_experiment(self, initial_soc=None, inputs=None, solve_kwargs=None)
355366
if self.steps_to_built_models:
356367
return
357368
else:
358-
self.set_up_and_parameterise_experiment(solve_kwargs)
369+
self._set_up_and_parameterise_experiment(solve_kwargs)
359370

360371
# Can process geometry with default parameter values (only electrical
361372
# parameters change between parameter values)

0 commit comments

Comments
 (0)