Skip to content

Commit

Permalink
Make get_spatial_var private (#3755)
Browse files Browse the repository at this point in the history
* Make `get_spatial_var` private `quick_plot.py`

* Remove round brackets around optional keyword in `QuickPlot.create_gif`

* Make Args in `dynamic_plot` optional

* Document dynamic arg in `pybamm.QuickPlot.plot`

* Add `get_spatial_var` info in `breaking changes` inside `CHANGELOG.md`

---------

Co-authored-by: Robert Timms <43040151+rtimms@users.noreply.github.com>
Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com>
  • Loading branch information
3 people committed May 3, 2024
1 parent 33371b0 commit febf1ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@

## Breaking changes

- The function `get_spatial_var` in `pybamm.QuickPlot.py` is made private. ([#3755](https://github.com/pybamm-team/PyBaMM/pull/3755))
- The parameters `GeometricParameters.A_cooling` and `GeometricParameters.V_cell` are now automatically computed from the electrode heights, widths and thicknesses if the "cell geometry" option is "pouch" and from the parameters "Cell cooling surface area [m2]" and "Cell volume [m3]", respectively, otherwise. When using the lumped thermal model we recommend using the "arbitrary" cell geometry and specifying the parameters "Cell cooling surface area [m2]", "Cell volume [m3]" and "Total heat transfer coefficient [W.m-2.K-1]" directly. ([#3707](https://github.com/pybamm-team/PyBaMM/pull/3707))
- Dropped support for the `[jax]` extra, i.e., the Jax solver when running on Python 3.8. The Jax solver is now available on Python 3.9 and above ([#3550](https://github.com/pybamm-team/PyBaMM/pull/3550))

Expand Down
10 changes: 5 additions & 5 deletions pybamm/plotting/quick_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def set_output_variables(self, output_variables, solutions):

# Set the x variable (i.e. "x" or "r" for any one-dimensional variables)
if first_variable.dimensions == 1:
(spatial_var_name, spatial_var_value) = self.get_spatial_var(
(spatial_var_name, spatial_var_value) = self._get_spatial_var(
variable_tuple, first_variable, "first"
)
self.spatial_variable_dict[variable_tuple] = {
Expand All @@ -324,11 +324,11 @@ def set_output_variables(self, output_variables, solutions):
(
first_spatial_var_name,
first_spatial_var_value,
) = self.get_spatial_var(variable_tuple, first_variable, "first")
) = self._get_spatial_var(variable_tuple, first_variable, "first")
(
second_spatial_var_name,
second_spatial_var_value,
) = self.get_spatial_var(variable_tuple, first_variable, "second")
) = self._get_spatial_var(variable_tuple, first_variable, "second")
self.spatial_variable_dict[variable_tuple] = {
first_spatial_var_name: first_spatial_var_value,
second_spatial_var_name: second_spatial_var_value,
Expand Down Expand Up @@ -360,7 +360,7 @@ def set_output_variables(self, output_variables, solutions):
self.variables[variable_tuple] = variables
self.subplot_positions[variable_tuple] = (self.n_rows, self.n_cols, k + 1)

def get_spatial_var(self, key, variable, dimension):
def _get_spatial_var(self, key, variable, dimension):
"""Return the appropriate spatial variable(s)"""

# Extract name and value
Expand Down Expand Up @@ -465,8 +465,8 @@ def plot(self, t, dynamic=False):
t : float
Dimensional time (in 'time_units') at which to plot.
dynamic : bool, optional
Determine whether to allocate space for a slider at the bottom of the plot when generating a dynamic plot.
If True, creates a dynamic plot with a slider.
"""

plt = import_optional_dependency("matplotlib.pyplot")
Expand Down

0 comments on commit febf1ac

Please sign in to comment.